diff --git a/.vscode/launch.json b/.vscode/launch.json index 9a8a7ccab..54d282cc8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,6 +5,27 @@ "version": "0.2.0", "compounds": [], "configurations": [ + { + "name": "Launch extension", + "type": "extensionHost", + "request": "launch", + "cwd": "${workspaceFolder}/extensions/vscode", + "args": [ + // Pass a directory to manually test in + "${workspaceFolder}/manual-testing-sandbox", + "${workspaceFolder}/manual-testing-sandbox/test.js", + "--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode" + ], + "pauseForSourceMap": false, + "outFiles": [ + "${workspaceFolder}/extensions/vscode/out/extension.js", + "/Users/natesesti/.continue/config.ts" + ], + "preLaunchTask": "vscode-extension:build", + "env": { + // "CONTROL_PLANE_ENV": "local" + } + }, { "type": "node", "request": "launch", @@ -52,30 +73,9 @@ "sourceMaps": true // "preLaunchTask": "gui:dev" }, - { - "name": "Extension (VSCode)", - "type": "extensionHost", - "request": "launch", - "cwd": "${workspaceFolder}/extensions/vscode", - "args": [ - // Pass a directory to manually test in - "${workspaceFolder}/extensions/vscode", - "${workspaceFolder}/extensions/vscode/manual-testing-sandbox/test.js", - "--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode" - ], - "pauseForSourceMap": false, - "outFiles": [ - "${workspaceFolder}/extensions/vscode/out/extension.js", - "/Users/natesesti/.continue/config.ts" - ], - "preLaunchTask": "vscode-extension:build", - "env": { - // "CONTROL_PLANE_ENV": "local" - } - }, // Has to be run after starting the server (separately or using the compound configuration) { - "name": "Tests (VSCode)", + "name": "Run tests", "type": "extensionHost", "request": "launch", "cwd": "${workspaceFolder}/extensions/vscode", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 60d6200b5..626adeae1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,6 +71,7 @@ You can run the documentation server locally using either of the following metho 1. Open your terminal and navigate to the root directory of the project. 2. Run the following command to start the documentation server: + ```bash npm run start --prefix docs ``` @@ -116,7 +117,7 @@ nvm use 2. Start debugging: 1. Switch to Run and Debug view - 2. Select `Extension (VS Code)` from drop down + 2. Select `Launch extension` from drop down 3. Hit play button 4. This will start the extension in debug mode and open a new VS Code window with it installed 1. The new VS Code window with the extension is referred to as the _Host VS Code_ diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index cf6f79fe8..2e0054d5b 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -96,17 +96,19 @@ export class LanceDbIndex implements CodebaseIndex { for await (const chunk of chunkDocument(chunkParams)) { if (chunk.content.length === 0) { // File did not chunk properly, let's skip it. - throw new Error(`did not chunk properly`); + throw new Error("did not chunk properly"); } chunks.push(chunk); if (chunks.length > 20) { // Too many chunks to index, probably a larger file than we want to include - throw new Error(`too large to index`); + throw new Error("too large to index"); } } const embeddings = await this.chunkListToEmbedding(chunks); if (chunks.length !== embeddings.length) { - throw new Error(`Unexpected lengths: chunks and embeddings do not match for ${item.path}`); + throw new Error( + `Unexpected lengths: chunks and embeddings do not match for ${item.path}`, + ); } const results = []; for (let i = 0; i < chunks.length; i++) { @@ -118,7 +120,7 @@ export class LanceDbIndex implements CodebaseIndex { startLine: chunks[i].startLine, endLine: chunks[i].endLine, contents: chunks[i].content, - }) + }); } return results; } @@ -126,26 +128,26 @@ export class LanceDbIndex implements CodebaseIndex { private async chunkListToEmbedding(chunks: Chunk[]): Promise { let embeddings: number[][]; try { - embeddings = await this.embeddingsProvider.embed(chunks.map((c) => c.content)); + embeddings = await this.embeddingsProvider.embed( + chunks.map((c) => c.content), + ); } catch (err) { throw new Error( `Failed to generate embedding for ${chunks[0]?.filepath} with provider: ${this.embeddingsProvider.id}: ${err}`, - { cause: err } + { cause: err }, ); } if (embeddings.some((emb) => emb === undefined)) { throw new Error( - `Empty embedding returned for ${chunks[0]?.filepath} with provider: ${this.embeddingsProvider.id}` + `Empty embedding returned for ${chunks[0]?.filepath} with provider: ${this.embeddingsProvider.id}`, ); } return embeddings; } - private async computeRows( - items: PathAndCacheKey[], - ): Promise { + private async computeRows(items: PathAndCacheKey[]): Promise { const rowChunkPromises = items.map(this.packToRows.bind(this)); - const rowChunkLists = [] + const rowChunkLists = []; for (let i = 0; i < items.length; i++) { try { rowChunkLists.push(await rowChunkPromises[i]); @@ -258,9 +260,14 @@ export class LanceDbIndex implements CodebaseIndex { yield { progress: 0, - desc: `Computing embeddings for ${results.compute.length} ${this.formatListPlurality("file", results.compute.length)}`, + desc: `Computing embeddings for ${ + results.compute.length + } ${this.formatListPlurality("file", results.compute.length)}`, status: "indexing", }; + + console.log(results.compute); + const dbRows = await this.computeRows(results.compute); this.insertRows(sqlite, dbRows); await markComplete(results.compute, IndexResultType.Compute); @@ -422,7 +429,10 @@ export class LanceDbIndex implements CodebaseIndex { }); } - private async insertRows(db: DatabaseConnection, rows: LanceDbRow[]): Promise { + private async insertRows( + db: DatabaseConnection, + rows: LanceDbRow[], + ): Promise { return new Promise((resolve, reject) => { db.db.serialize(() => { db.db.exec("BEGIN", (err: Error | null) => { @@ -431,26 +441,40 @@ export class LanceDbIndex implements CodebaseIndex { } }); - const sql = "INSERT INTO lance_db_cache (uuid, cacheKey, path, artifact_id, vector, startLine, endLine, contents) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" - rows.map(r => { - db.db.run(sql, [ - r.uuid, - r.cachekey, - r.path, - this.artifactId, - JSON.stringify(r.vector), - r.startLine, - r.endLine, - r.contents, - ], (result: RunResult, err: Error) => { - if (err) { - reject(new Error("error inserting into lance_db_cache table", { cause: err })); - } - }); + const sql = + "INSERT INTO lance_db_cache (uuid, cacheKey, path, artifact_id, vector, startLine, endLine, contents) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; + rows.map((r) => { + db.db.run( + sql, + [ + r.uuid, + r.cachekey, + r.path, + this.artifactId, + JSON.stringify(r.vector), + r.startLine, + r.endLine, + r.contents, + ], + (result: RunResult, err: Error) => { + if (err) { + reject( + new Error("error inserting into lance_db_cache table", { + cause: err, + }), + ); + } + }, + ); }); db.db.exec("COMMIT", (err: Error | null) => { if (err) { - reject(new Error("error while committing insert into lance_db_rows transaction", { cause: err })); + reject( + new Error( + "error while committing insert into lance_db_rows transaction", + { cause: err }, + ), + ); } }); resolve(); diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index 2ff68b9f0..e73564e2e 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -59,12 +59,12 @@ export const DEFAULT_IGNORE_FILETYPES = [ "*.gcda", "*.gcno", "go.sum", - ".env", - ".gitignore", - ".gitkeep", - ".continueignore", + "*.env", + "*.gitignore", + "*.gitkeep", + "*.continueignore", "config.json", - ".csv", + "*.csv", // "*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt ]; diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index b41ea73df..e8a3b9674 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.195", + "version": "0.9.196", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.195", + "version": "0.9.196", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 0c40f9861..9d6006bcc 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.195", + "version": "0.9.196", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" diff --git a/extensions/vscode/manual-testing-sandbox/example.ipynb b/manual-testing-sandbox/example.ipynb similarity index 100% rename from extensions/vscode/manual-testing-sandbox/example.ipynb rename to manual-testing-sandbox/example.ipynb diff --git a/extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py b/manual-testing-sandbox/nested-folder/helloNested.py similarity index 100% rename from extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py rename to manual-testing-sandbox/nested-folder/helloNested.py diff --git a/extensions/vscode/manual-testing-sandbox/readme.md b/manual-testing-sandbox/readme.md similarity index 100% rename from extensions/vscode/manual-testing-sandbox/readme.md rename to manual-testing-sandbox/readme.md diff --git a/extensions/vscode/manual-testing-sandbox/test.css b/manual-testing-sandbox/test.css similarity index 100% rename from extensions/vscode/manual-testing-sandbox/test.css rename to manual-testing-sandbox/test.css diff --git a/manual-testing-sandbox/test.csv b/manual-testing-sandbox/test.csv new file mode 100644 index 000000000..49ae6b845 --- /dev/null +++ b/manual-testing-sandbox/test.csv @@ -0,0 +1,26 @@ +Date,Temperature,Damage Incident +04/12/1981,66,0 +11/12/1981,70,1 +3/22/82,69,0 +6/27/82,80,NA +01/11/1982,68,0 +04/04/1983,67,0 +6/18/83,72,0 +8/30/83,73,0 +11/28/83,70,0 +02/03/1984,57,1 +04/06/1984,63,1 +8/30/84,70,1 +10/05/1984,78,0 +11/08/1984,67,0 +1/24/85,53,1 +04/12/1985,67,0 +4/29/85,75,0 +6/17/85,70,0 +7/29/85,81,0 +8/27/85,76,0 +10/03/1985,79,0 +10/30/85,75,1 +11/26/85,76,0 +01/12/1986,58,1 +1/28/86,31,Challenger Accident diff --git a/extensions/vscode/manual-testing-sandbox/test.js b/manual-testing-sandbox/test.js similarity index 100% rename from extensions/vscode/manual-testing-sandbox/test.js rename to manual-testing-sandbox/test.js diff --git a/extensions/vscode/manual-testing-sandbox/test.rs b/manual-testing-sandbox/test.rs similarity index 100% rename from extensions/vscode/manual-testing-sandbox/test.rs rename to manual-testing-sandbox/test.rs