Skip to content

Commit 805d2e2

Browse files
Merge branch 'main' into pe/remove-pre-indexed-docs-ui
2 parents f0fff46 + ad29bf8 commit 805d2e2

File tree

228 files changed

+5804
-4575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+5804
-4575
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @continuedev/continue-code-reviewers

.github/workflows/pr_checks.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,7 @@ jobs:
420420
id: test-extensions-cache
421421
with:
422422
path: extensions/vscode/e2e/.test-extensions
423-
# package.json used as the key because that's where the download script is defined
424-
key: vscode-test-extensions-${{ hashFiles('extensions/vscode/package.json') }}
423+
key: CONSTANT
425424

426425
- name: Download build artifact
427426
uses: actions/download-artifact@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,15 @@ Icon?
157157
notes.md
158158

159159
manual-testing-sandbox/.idea/**
160+
manual-testing-sandbox/.continue/**
160161
extensions/intellij/.idea/**
161162

162163
**/.idea/workspace.xml
163164
**/.idea/usage.statistics.xml
164165
**/.idea/shelf/
166+
**/.idea/inspectionProfiles/Project_Default.xml
167+
**/.idea/php.xml
168+
165169

166170
extensions/intellij/bin
167171
extensions/.continue-debug/

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ gui/dist
1414
**/.continueignore
1515
CHANGELOG.md
1616
**/continue_tutorial.py
17-
**/node_modules
17+
**/node_modules
18+
**/CODEOWNERS

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<div align="center">
1010

11-
**[Continue](https://docs.continue.dev) enables to developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)**
11+
**[Continue](https://docs.continue.dev) enables developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)**
1212

1313
</div>
1414

binary/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/.eslintrc.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
"project": "./tsconfig.json"
66
},
77
"rules": {
8-
"quotes": ["warn", "double", {}],
8+
"quotes": ["off", "double", {}],
99
"@typescript-eslint/naming-convention": "off",
10-
"@typescript-eslint/no-floating-promises": "warn"
10+
"@typescript-eslint/no-floating-promises": "off",
11+
"import/order": "off",
12+
"curly": "off",
13+
"@typescript-eslint/semi": "off",
14+
"eqeqeq": "error",
15+
"complexity": ["error", { "max": 38 }],
16+
"max-lines-per-function": ["error", { "max": 996 }],
17+
"max-statements": ["error", { "max": 112 }],
18+
"max-depth": ["error", { "max": 6 }],
19+
"max-nested-callbacks": ["error", { "max": 4 }],
20+
"max-params": ["error", { "max": 11 }]
1121
}
1222
}

core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { streamLines } from "../../../diff/util";
2-
import { PosthogFeatureFlag, Telemetry } from "../../../util/posthog";
32
import { HelperVars } from "../../util/HelperVars";
43

54
import { stopAtStartOf, stopAtStopTokens } from "./charStream";
@@ -73,9 +72,7 @@ export class StreamTransformPipeline {
7372
fullStop,
7473
);
7574

76-
const timeoutValue = await Telemetry.getValueForFeatureFlag(
77-
PosthogFeatureFlag.AutocompleteTimeout,
78-
);
75+
const timeoutValue = helper.options.showWhateverWeHaveAtXMs;
7976

8077
lineGenerator = showWhateverWeHaveAtXMs(lineGenerator, timeoutValue!);
8178

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import {
2+
processTestCase,
3+
type CompletionTestCase,
4+
} from "./completionTestUtils";
5+
6+
describe("processTestCase utility", () => {
7+
it("processes simple console.log completion", () => {
8+
const testCase: CompletionTestCase = {
9+
original: "console.log(|cur||till|)",
10+
completion: "\"foo,\", bar",
11+
};
12+
13+
expect(processTestCase(testCase)).toEqual({
14+
input: {
15+
lastLineOfCompletionText: "\"foo,\", bar",
16+
currentText: ")",
17+
cursorPosition: "console.log(".length,
18+
},
19+
expectedResult: {
20+
completionText: "\"foo,\", bar",
21+
},
22+
});
23+
});
24+
25+
it("processes simple console.log completion with overwriting", () => {
26+
const testCase: CompletionTestCase = {
27+
original: "console.log(|cur|)|till|",
28+
completion: "\"foo,\", bar);",
29+
};
30+
31+
expect(processTestCase(testCase)).toEqual({
32+
input: {
33+
lastLineOfCompletionText: "\"foo,\", bar);",
34+
currentText: ")",
35+
cursorPosition: "console.log(".length,
36+
},
37+
expectedResult: {
38+
completionText: "\"foo,\", bar);",
39+
range: {
40+
start: "console.log(".length,
41+
end: "console.log()".length,
42+
},
43+
},
44+
});
45+
});
46+
47+
it("partially applying completion", () => {
48+
const testCase: CompletionTestCase = {
49+
original: "|cur||till|fetch(\"https://example.com\");",
50+
completion: "await fetch(\"https://example.com\");",
51+
appliedCompletion: "await ",
52+
};
53+
54+
expect(processTestCase(testCase)).toEqual({
55+
input: {
56+
lastLineOfCompletionText: "await fetch(\"https://example.com\");",
57+
currentText: "fetch(\"https://example.com\");",
58+
cursorPosition: 0,
59+
},
60+
expectedResult: {
61+
completionText: "await ",
62+
},
63+
});
64+
});
65+
});
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
export interface CompletionTestCase {
2+
original: string; // Text with |cur| and |till| markers
3+
completion: string; // Text to insert/overwrite
4+
appliedCompletion?: string | null;
5+
cursorMarker?: string;
6+
tillMarker?: string;
7+
}
8+
9+
export interface ProcessedTestCase {
10+
input: {
11+
lastLineOfCompletionText: string;
12+
currentText: string;
13+
cursorPosition: number;
14+
};
15+
expectedResult: {
16+
completionText: string;
17+
range?: {
18+
start: number;
19+
end: number;
20+
};
21+
};
22+
}
23+
24+
/**
25+
* Transforms human-readable test case into input and expected results.
26+
*
27+
* - `original`: Your original text with |cur| marking where the cursor is before completion,
28+
* and |till| marking where the cursor should be after accepting completion (and this is
29+
* the end of the actual applied completion)
30+
* - `completion`: LLM completion output
31+
* - `appliedCompletion` (optional): part of the LLM completion output that is actually applied
32+
* (written between |cur| and |till| in the original)
33+
*
34+
* For example, you have this line:
35+
*
36+
* console.log("<cursor here>");
37+
*
38+
* and expect it to be completed this way:
39+
*
40+
* console.log("foo: ", bar<cursor here>);
41+
*
42+
* with your completion coming from LLM being: `'foo: ", bar<cursor here>);'`
43+
*
44+
* Your input to this function should be:
45+
* - original: `'console.log("|cur|"|till|);'`
46+
* - completion: `'foo: ", bar);'`
47+
* - appliedCompletion: `'foo: ", bar'`
48+
*
49+
* Output: input and expected output of {@link core/autocomplete/util/processSingleLineCompletion/processSingleLineCompletion|processSingleLineCompletion()}
50+
*
51+
*/
52+
export function processTestCase({
53+
original,
54+
completion,
55+
appliedCompletion = null,
56+
cursorMarker = "|cur|",
57+
tillMarker = "|till|",
58+
}: CompletionTestCase): ProcessedTestCase {
59+
// Validate cursor marker
60+
if (!original.includes(cursorMarker)) {
61+
throw new Error("Cursor marker not found in original text");
62+
}
63+
64+
const cursorPos = original.indexOf(cursorMarker);
65+
original = original.replace(cursorMarker, "");
66+
67+
let tillPos = original.indexOf(tillMarker);
68+
if (tillPos < 0) {
69+
tillPos = cursorPos;
70+
} else {
71+
original = original.replace(tillMarker, "")
72+
}
73+
74+
// Calculate currentText based on what's between cursor and till marker
75+
const currentText = original.substring(cursorPos);
76+
77+
return {
78+
input: {
79+
lastLineOfCompletionText: completion,
80+
currentText,
81+
cursorPosition: cursorPos,
82+
},
83+
expectedResult: {
84+
completionText: appliedCompletion || completion,
85+
range: cursorPos === tillPos ? undefined : {
86+
start: cursorPos,
87+
end: tillPos,
88+
},
89+
},
90+
};
91+
}

0 commit comments

Comments
 (0)