Skip to content

Commit 6f89354

Browse files
sestinjspewRob LeidlePatrick-Erichseninimaz
authored
Dev (#1679)
* Fix an issue where CMD+K does not clear the terminal when the terminal has focus (#1671) On MacOS, ⌘+K is bound, by default, to Terminal:Clear. Without this change ⌘+K does not clear the terminal but instead iniates a chord sequence and waits for the next stroke of the chord. Co-authored-by: Rob Leidle <[email protected]> * Change treeSitter to cache the Language objects it loads from wasm (#1672) Without this change, for a repository with 600 typescript files, the indexer would fail to finish correctly and there would be many of the following errors in the webview console log: 'Unable to load language for file ${path} RuntimeError: table index is out of bounds' The following bash will create a repo that reproduces the problem: current_path="." for ((i=1; i<=20; i++)); do new_folder="folder-$i" mkdir -p "$current_path/$new_folder" current_path="$current_path/$new_folder" for ((a=1; a<=30; a++)); do head -c 10000 /dev/urandom | base64 > "$current_path/file-$a.ts" done done Co-authored-by: Rob Leidle <[email protected]> * acknowledge sourcemap flag in esbuild.js * don't run jetbrains-release.yaml on vscode releases * further testing for walkDir * chore: add telemetry to commands (#1673) * test: Add basic unit test to baseLLM (#1668) * update version * test: Add basic unit test to baseLLM --------- Co-authored-by: Nate Sesti <[email protected]> Co-authored-by: inimaz <[email protected]> * feat: add Quick Actions CodeLens feature (#1674) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * add voyage rerank-1 * import Handlebars * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * small UI tweaks * media query * feat: add best experience onboarding * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * chore: add telemetry for full screen toggle (#1618) * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables * "stash" instead of "delete" in indexing progress * fix preview.yaml * also fix main.yaml * Update troubleshooting.md (#1637) * feat: add quick actions * Update index.d.ts * quick actions mvp * update docs * subscribe to vscode change settings * Update commands.ts * cleanup * Update quick-actions.md * Update VerticalPerLineCodeLensProvider.ts * resolve feedback --------- Co-authored-by: Nate Sesti <[email protected]> Co-authored-by: Nate Sesti <[email protected]> Co-authored-by: Jonah Wagner <[email protected]> * chore: add `isCommandEvent` to command telemetry (#1675) * chore: add `isCommandEvent` to command telemetry * Update commands.ts * Nate/better retrieval (#1677) * deduplicatearray tests * break out separate retrieval pipelines * IConfigHandler * tests for codebase indexer * better .continueignore for continue * indexing fixes * ignore .gitignore and .continueignore when indexing * retrieval pipeline improvements * fix formatting err in out .continueignore * add necessary filter to lance_db_cache * update package.json version * skip unused tests --------- Co-authored-by: Rob Leidle <[email protected]> Co-authored-by: Rob Leidle <[email protected]> Co-authored-by: Patrick Erichsen <[email protected]> Co-authored-by: inimaz <[email protected]> Co-authored-by: inimaz <[email protected]> Co-authored-by: Jonah Wagner <[email protected]>
1 parent f72b00d commit 6f89354

File tree

4 files changed

+183
-3
lines changed

4 files changed

+183
-3
lines changed

core/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ target
22
**/node_modules
33
**/.DS_Store
44
npm-debug.log*
5-
.env
5+
.env
6+
.continue-test

core/test/context/retrieval/RetrievalPipeline.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ function testRetrievalPipeline(pipeline: IRetrievalPipeline) {
44
test("should successfully run");
55
}
66

7+
8+
describe.skip("RetrievalPipeline", () => {
9+
test.todo("should successfully run");
10+
});
11+
712
// describe("Retrieval Pipelines", () => {
813
// const ide = new FileSystemIde();
914
// const options: RetrievalPipelineOptions;
+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
import fs from "node:fs";
2+
import path from "node:path";
3+
import { ConfigHandler } from "../../config/ConfigHandler";
4+
import { ContinueServerClient } from "../../continueServer/stubs/client";
5+
import { CodebaseIndexer, PauseToken } from "../../indexing/CodebaseIndexer";
6+
import { LanceDbIndex } from "../../indexing/LanceDbIndex";
7+
import TransformersJsEmbeddingsProvider from "../../indexing/embeddings/TransformersJsEmbeddingsProvider";
8+
import FileSystemIde from "../../util/filesystem";
9+
import {
10+
getIndexFolderPath,
11+
getIndexSqlitePath,
12+
getLanceDbPath,
13+
} from "../../util/paths";
14+
import {
15+
addToTestDir,
16+
setUpTestDir,
17+
tearDownTestDir,
18+
TEST_DIR,
19+
} from "../testUtils/testDir";
20+
21+
const TEST_TS = `\
22+
function main() {
23+
console.log("Hello, world!");
24+
}
25+
26+
class Foo {
27+
constructor(public bar: string) {}
28+
}
29+
`;
30+
31+
const TEST_PY = `\
32+
def main():
33+
print("Hello, world!")
34+
35+
class Foo:
36+
def __init__(self, bar: str):
37+
self.bar = bar
38+
`;
39+
40+
const TEST_RS = `\
41+
fn main() {
42+
println!("Hello, world!");
43+
}
44+
45+
struct Foo {
46+
bar: String,
47+
}
48+
`;
49+
50+
// These are more like integration tests, whereas we should separately test
51+
// the individual CodebaseIndex classes
52+
describe.skip("CodebaseIndexer", () => {
53+
const ide = new FileSystemIde(TEST_DIR);
54+
const ideSettingsPromise = ide.getIdeSettings();
55+
const configHandler = new ConfigHandler(
56+
ide,
57+
ideSettingsPromise,
58+
async (text) => {},
59+
);
60+
const pauseToken = new PauseToken(false);
61+
const continueServerClient = new ContinueServerClient(undefined, undefined);
62+
const codebaseIndexer = new CodebaseIndexer(
63+
configHandler,
64+
ide,
65+
pauseToken,
66+
continueServerClient,
67+
);
68+
const lancedbIndex = new LanceDbIndex(
69+
new TransformersJsEmbeddingsProvider(),
70+
ide.readFile.bind(ide),
71+
continueServerClient,
72+
);
73+
74+
beforeAll(async () => {
75+
setUpTestDir();
76+
});
77+
78+
afterAll(async () => {
79+
tearDownTestDir();
80+
});
81+
82+
test("should index test folder without problem", async () => {
83+
addToTestDir([
84+
["test.ts", TEST_TS],
85+
["py/main.py", TEST_PY],
86+
]);
87+
const abortController = new AbortController();
88+
const abortSignal = abortController.signal;
89+
90+
const updates = [];
91+
for await (const update of codebaseIndexer.refresh(
92+
[TEST_DIR],
93+
abortSignal,
94+
)) {
95+
updates.push(update);
96+
}
97+
98+
expect(updates.length).toBeGreaterThan(0);
99+
});
100+
101+
test("should have created index folder with all necessary files", async () => {
102+
expect(fs.existsSync(getIndexFolderPath())).toBe(true);
103+
expect(fs.existsSync(getIndexSqlitePath())).toBe(true);
104+
expect(fs.existsSync(getLanceDbPath())).toBe(true);
105+
});
106+
107+
test("should be able to query lancedb index", async () => {
108+
const chunks = await lancedbIndex.retrieve(
109+
"What is the main function doing?",
110+
10,
111+
await ide.getTags(lancedbIndex.artifactId),
112+
undefined,
113+
);
114+
115+
expect(chunks.length).toBe(2);
116+
// Check that the main function from both files is returned
117+
expect(chunks.some((chunk) => chunk.filepath.endsWith("test.ts"))).toBe(
118+
true,
119+
);
120+
expect(chunks.some((chunk) => chunk.filepath.endsWith("main.py"))).toBe(
121+
true,
122+
);
123+
});
124+
125+
test("should successfully re-index after adding a file", async () => {
126+
addToTestDir([["main.rs", TEST_RS]]);
127+
const abortController = new AbortController();
128+
const abortSignal = abortController.signal;
129+
const updates = [];
130+
for await (const update of codebaseIndexer.refresh(
131+
[TEST_DIR],
132+
abortSignal,
133+
)) {
134+
updates.push(update);
135+
}
136+
expect(updates.length).toBeGreaterThan(0);
137+
// Check that the new file was indexed
138+
const chunks = await lancedbIndex.retrieve(
139+
"What is the main function doing?",
140+
3,
141+
await ide.getTags(lancedbIndex.artifactId),
142+
undefined,
143+
);
144+
expect(chunks.length).toBe(3);
145+
expect(chunks.some((chunk) => chunk.filepath.endsWith("main.rs"))).toBe(
146+
true,
147+
);
148+
});
149+
150+
test("should successfully re-index after deleting a file", async () => {
151+
fs.rmSync(path.join(TEST_DIR, "main.rs"));
152+
const abortController = new AbortController();
153+
const abortSignal = abortController.signal;
154+
const updates = [];
155+
for await (const update of codebaseIndexer.refresh(
156+
[TEST_DIR],
157+
abortSignal,
158+
)) {
159+
updates.push(update);
160+
}
161+
expect(updates.length).toBeGreaterThan(0);
162+
// Check that the deleted file was removed from the index
163+
const chunks = await lancedbIndex.retrieve(
164+
"What is the main function doing?",
165+
10,
166+
await ide.getTags(lancedbIndex.artifactId),
167+
undefined,
168+
);
169+
expect(chunks.length).toBe(2);
170+
expect(chunks.every((chunk) => !chunk.filepath.endsWith("main.rs"))).toBe(
171+
true,
172+
);
173+
});
174+
});

core/test/walkDir.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe("walkDir", () => {
244244
});
245245

246246
test("should walk continue repo without getting any files of the default ignore types", async () => {
247-
const results = await walkDir(path.join(__dirname, "..", ".."), ide, {
247+
const results = await walkDir(path.join(__dirname, ".."), ide, {
248248
ignoreFiles: [".gitignore", ".continueignore"],
249249
});
250250
expect(results.length).toBeGreaterThan(0);
@@ -263,7 +263,7 @@ describe("walkDir", () => {
263263
});
264264

265265
test("should walk continue/extensions/vscode without getting any files in the .continueignore", async () => {
266-
const vscodePath = path.join(__dirname, "..", "..", "extensions", "vscode");
266+
const vscodePath = path.join(__dirname, "..", "extensions", "vscode");
267267
const results = await walkDir(vscodePath, ide, {
268268
ignoreFiles: [".gitignore", ".continueignore"],
269269
});

0 commit comments

Comments
 (0)