fix: ignore CSV files (#1972)
* fix: ignore CSV files * Update CONTRIBUTING.md * Update tsconfig.json
This commit is contained in:
parent
c51260c8c8
commit
1272f3402a
13 changed files with 112 additions and 61 deletions
44
.vscode/launch.json
vendored
44
.vscode/launch.json
vendored
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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_
|
||||
|
|
|
|||
|
|
@ -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<number[][]> {
|
||||
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<LanceDbRow[]> {
|
||||
private async computeRows(items: PathAndCacheKey[]): Promise<LanceDbRow[]> {
|
||||
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<void> {
|
||||
private async insertRows(
|
||||
db: DatabaseConnection,
|
||||
rows: LanceDbRow[],
|
||||
): Promise<void> {
|
||||
return new Promise<void>((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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
];
|
||||
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
26
manual-testing-sandbox/test.csv
Normal file
26
manual-testing-sandbox/test.csv
Normal file
|
|
@ -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
|
||||
|
Loading…
Add table
Reference in a new issue