Merge branch 'preview' of https://github.com/continuedev/continue into preview
This commit is contained in:
commit
e2abe3b059
7 changed files with 89 additions and 11 deletions
|
|
@ -6,7 +6,7 @@ import {
|
|||
} from "../..";
|
||||
import { getBasename } from "../../util";
|
||||
|
||||
const highlighterPromise = import("llm-code-highlighter/dist/index.continue");
|
||||
import { getSourceSetHighlights } from "llm-code-highlighter/dist/index.continue";
|
||||
|
||||
class CodeHighlightsContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
|
|
@ -33,8 +33,7 @@ class CodeHighlightsContextProvider extends BaseContextProvider {
|
|||
})
|
||||
);
|
||||
const topPercentile = 0.5;
|
||||
const highlighter = await highlighterPromise;
|
||||
const repoMap = await highlighter.getRepoHighlights(
|
||||
const repoMap = await getSourceSetHighlights(
|
||||
topPercentile,
|
||||
[],
|
||||
allFiles
|
||||
|
|
|
|||
57
core/context/providers/CodeOutlineContextProvider.ts
Normal file
57
core/context/providers/CodeOutlineContextProvider.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { BaseContextProvider } from "..";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
} from "../..";
|
||||
import { getBasename } from "../../util";
|
||||
|
||||
import { getFileOutlineHighlights } from "llm-code-highlighter/dist/index.continue";
|
||||
|
||||
class CodeOutlineContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "outlines",
|
||||
displayTitle: "Outlines",
|
||||
description: "Definition lines only (from open files)",
|
||||
type: "normal",
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras
|
||||
): Promise<ContextItem[]> {
|
||||
const ide = extras.ide;
|
||||
const openFiles = await ide.getOpenFiles();
|
||||
const allFiles: { name: string; absPath: string; content: string }[] =
|
||||
await Promise.all(
|
||||
openFiles.map(async (filepath: string) => {
|
||||
return {
|
||||
name: getBasename(filepath),
|
||||
absPath: filepath,
|
||||
content: `${await ide.readFile(filepath)}`,
|
||||
};
|
||||
})
|
||||
);
|
||||
const outlines = await getFileOutlineHighlights(
|
||||
allFiles
|
||||
.filter((file) => file.content.length > 0)
|
||||
.map((file) => {
|
||||
return {
|
||||
relPath: file.name,
|
||||
code: file.content,
|
||||
};
|
||||
})
|
||||
);
|
||||
return [
|
||||
{
|
||||
content: outlines ? outlines : "",
|
||||
name: "Code Outline",
|
||||
description: "Definition lines only (from open files)",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async load(): Promise<void> {}
|
||||
}
|
||||
|
||||
export default CodeOutlineContextProvider;
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
import { BaseContextProvider } from "..";
|
||||
import { ContextProviderName } from "../..";
|
||||
import CodebaseContextProvider from "./CodebaseContextProvider";
|
||||
// import CodeHighlightsContextProvider from "./CodeHighlightsContextProvider";
|
||||
import CodeHighlightsContextProvider from "./CodeHighlightsContextProvider";
|
||||
import CodeOutlineContextProvider from "./CodeOutlineContextProvider";
|
||||
import DiffContextProvider from "./DiffContextProvider";
|
||||
import DocsContextProvider from "./DocsContextProvider";
|
||||
import FileTreeContextProvider from "./FileTreeContextProvider";
|
||||
|
|
@ -29,7 +30,8 @@ const Providers: (typeof BaseContextProvider)[] = [
|
|||
ProblemsContextProvider,
|
||||
FolderContextProvider,
|
||||
DocsContextProvider,
|
||||
// CodeHighlightsContextProvider,
|
||||
CodeHighlightsContextProvider,
|
||||
CodeOutlineContextProvider,
|
||||
];
|
||||
|
||||
export function contextProviderClassFromName(
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
"fastest-levenshtein": "^1.0.16",
|
||||
"handlebars": "^4.7.8",
|
||||
"js-tiktoken": "^1.0.8",
|
||||
"llm-code-highlighter": "^0.0.3",
|
||||
"llm-code-highlighter": "^0.0.5",
|
||||
"node-fetch": "^3.3.2",
|
||||
"node-html-markdown": "^1.3.0",
|
||||
"ollama": "^0.4.6",
|
||||
|
|
|
|||
20
extensions/vscode/package-lock.json
generated
20
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.57",
|
||||
"version": "0.9.58",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.57",
|
||||
"version": "0.9.58",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
@ -46,7 +46,8 @@
|
|||
"uuidv4": "^6.2.13",
|
||||
"vectordb": "^0.4.3",
|
||||
"vscode-languageclient": "^8.0.2",
|
||||
"ws": "^8.13.0"
|
||||
"ws": "^8.13.0",
|
||||
"yarn": "^1.22.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "^8.4.7",
|
||||
|
|
@ -13413,6 +13414,19 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/yarn": {
|
||||
"version": "1.22.21",
|
||||
"resolved": "https://registry.npmjs.org/yarn/-/yarn-1.22.21.tgz",
|
||||
"integrity": "sha512-ynXaJsADJ9JiZ84zU25XkPGOvVMmZ5b7tmTSpKURYwgELdjucAOydqIOrOfTxVYcNXe91xvLZwcRh68SR3liCg==",
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"yarn": "bin/yarn.js",
|
||||
"yarnpkg": "bin/yarn.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/yauzl": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"version": "0.9.57",
|
||||
"version": "0.9.58",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
@ -484,6 +484,7 @@
|
|||
"uuidv4": "^6.2.13",
|
||||
"vectordb": "^0.4.3",
|
||||
"vscode-languageclient": "^8.0.2",
|
||||
"ws": "^8.13.0"
|
||||
"ws": "^8.13.0",
|
||||
"yarn": "^1.22.21"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7515,6 +7515,11 @@ yargs@^17.0.1, yargs@^17.3.1:
|
|||
y18n "^5.0.5"
|
||||
yargs-parser "^21.1.1"
|
||||
|
||||
yarn@^1.22.21:
|
||||
version "1.22.21"
|
||||
resolved "https://registry.npmjs.org/yarn/-/yarn-1.22.21.tgz"
|
||||
integrity sha512-ynXaJsADJ9JiZ84zU25XkPGOvVMmZ5b7tmTSpKURYwgELdjucAOydqIOrOfTxVYcNXe91xvLZwcRh68SR3liCg==
|
||||
|
||||
yauzl@^2.3.1, yauzl@^2.9.2:
|
||||
version "2.10.0"
|
||||
resolved "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue