Skip to content

Commit dfc6fd9

Browse files
authored
Merge branch 'main' into nate/log-errors
2 parents c692709 + 869ecec commit dfc6fd9

File tree

134 files changed

+6157
-2559
lines changed

Some content is hidden

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

134 files changed

+6157
-2559
lines changed

.continue/prompts/update-llm-info.prompt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const AllMediaTypes = [
4444

4545
2. EXTRACT NEW INFORMATION
4646

47-
New information will be pulled from the internet.
48-
If you do not see a web search tool, let me know.
47+
Fetch information from the internet using the search web and read url tools.
48+
If you do not see either of these tools, stop and let me know.
4949

5050
Retrieve the following sites per these providers, and consider these notes on how to extract the information:
5151
- "gemini": https://ai.google.dev/gemini-api/docs/models - maxCompletionTokens is called "Output token limit", contextLength is called "Input token limit"

.eslintrc.shared.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@typescript-eslint/naming-convention": "off",
1111
"@typescript-eslint/no-floating-promises": "warn",
1212
"@typescript-eslint/semi": "warn",
13+
"@typescript-eslint/no-misused-promises": "error",
1314
"curly": "warn",
1415
"eqeqeq": "warn",
1516
"no-throw-literal": "warn",

.github/workflows/submit-github-dependency-graph.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Submit Gradle Dependency Graph For Dependabot
22

33
on:
44
push:
5-
branches: ['main']
5+
branches: ["main"]
66

77
permissions:
88
contents: write
@@ -11,15 +11,15 @@ jobs:
1111
dependency-submission:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout sources
15-
uses: actions/checkout@v4
16-
- name: Setup Java
17-
uses: actions/setup-java@v4
18-
with:
19-
distribution: 'temurin'
20-
java-version: 17
21-
- name: Generate and submit dependency graph
22-
uses: gradle/actions/dependency-submission@v4
23-
with:
24-
# The gradle project is not in the root of the repository.
25-
build-root-directory: extensions/intellij
14+
- name: Checkout sources
15+
uses: actions/checkout@v4
16+
- name: Setup Java
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: "temurin"
20+
java-version: 17
21+
- name: Generate and submit dependency graph
22+
uses: gradle/actions/dependency-submission@v4
23+
with:
24+
# The gradle project is not in the root of the repository.
25+
build-root-directory: extensions/intellij

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ version of Node.js for this project by running the following command in the root
123123
nvm use
124124
```
125125

126+
Then, install Vite globally
127+
128+
```bash
129+
npm i -g vite
130+
```
131+
126132
#### Fork the Continue Repository
127133

128134
1. Go to the [Continue GitHub repository](https://github.com/continuedev/continue) and fork it to your GitHub account.

binary/package-lock.json

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

core/autocomplete/CompletionProvider.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export class CompletionProvider {
127127
public async provideInlineCompletionItems(
128128
input: AutocompleteInput,
129129
token: AbortSignal | undefined,
130+
force?: boolean,
130131
): Promise<AutocompleteOutcome | undefined> {
131132
try {
132133
// Create abort signal if not given
@@ -146,8 +147,12 @@ export class CompletionProvider {
146147
const options = await this._getAutocompleteOptions(llm);
147148

148149
// Debounce
149-
if (await this.debouncer.delayAndShouldDebounce(options.debounceDelay)) {
150-
return undefined;
150+
if (!force) {
151+
if (
152+
await this.debouncer.delayAndShouldDebounce(options.debounceDelay)
153+
) {
154+
return undefined;
155+
}
151156
}
152157

153158
if (llm.promptTemplates?.autocomplete) {

core/autocomplete/context/root-path-context/test/testUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function testRootPathContext(
4040
// @ts-ignore
4141
.spyOn(service, "getSnippets")
4242
// @ts-ignore
43-
.mockImplementation(async (_filepath, _endPosition) => {
43+
.mockImplementation((_filePath, _endPosition) => {
4444
return [];
4545
});
4646

core/autocomplete/snippets/getAllSnippets.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { findUriInDirs } from "../../util/uri";
33
import { ContextRetrievalService } from "../context/ContextRetrievalService";
44
import { GetLspDefinitionsFunction } from "../types";
55
import { HelperVars } from "../util/HelperVars";
6+
import { openedFilesLruCache } from "../util/openedFilesLruCache";
67
import { getDiffsFromCache } from "./gitDiffCache";
78

89
import {
@@ -22,6 +23,7 @@ export interface SnippetPayload {
2223
recentlyVisitedRangesSnippets: AutocompleteCodeSnippet[];
2324
diffSnippets: AutocompleteDiffSnippet[];
2425
clipboardSnippets: AutocompleteClipboardSnippet[];
26+
recentlyOpenedFileSnippets: AutocompleteCodeSnippet[];
2527
}
2628

2729
function racePromise<T>(promise: Promise<T[]>, timeout = 100): Promise<T[]> {
@@ -103,6 +105,65 @@ const getDiffSnippets = async (
103105
});
104106
};
105107

108+
const getSnippetsFromRecentlyOpenedFiles = async (
109+
helper: HelperVars,
110+
ide: IDE,
111+
): Promise<AutocompleteCodeSnippet[]> => {
112+
if (helper.options.useRecentlyOpened === false) {
113+
return [];
114+
}
115+
116+
try {
117+
const currentFileUri = `${helper.filepath}`;
118+
119+
// Get all file URIs excluding the current file
120+
const fileUrisToRead = [...openedFilesLruCache.entriesDescending()]
121+
.filter(([fileUri, _]) => fileUri !== currentFileUri)
122+
.map(([fileUri, _]) => fileUri);
123+
124+
// Create an array of promises that each read a file with timeout
125+
const fileReadPromises = fileUrisToRead.map((fileUri) => {
126+
// Create a promise that resolves to a snippet or null
127+
const readPromise = new Promise<AutocompleteCodeSnippet | null>(
128+
(resolve) => {
129+
ide
130+
.readFile(fileUri)
131+
.then((fileContent) => {
132+
if (!fileContent || fileContent.trim() === "") {
133+
resolve(null);
134+
return;
135+
}
136+
137+
resolve({
138+
filepath: fileUri,
139+
content: fileContent,
140+
type: AutocompleteSnippetType.Code,
141+
});
142+
})
143+
.catch((e) => {
144+
console.error(`Failed to read file ${fileUri}:`, e);
145+
resolve(null);
146+
});
147+
},
148+
);
149+
// Cut off at 80ms via racing promises
150+
return Promise.race([
151+
readPromise,
152+
new Promise<null>((resolve) => setTimeout(() => resolve(null), 80)),
153+
]);
154+
});
155+
156+
// Execute all file reads in parallel
157+
const results = await Promise.all(fileReadPromises);
158+
159+
// Filter out null results
160+
return results.filter(Boolean) as AutocompleteCodeSnippet[];
161+
} catch (e) {
162+
console.error("Error processing opened files cache:", e);
163+
return [];
164+
}
165+
};
166+
106167
export const getAllSnippets = async ({
107168
helper,
108169
ide,
@@ -123,6 +184,7 @@ export const getAllSnippets = async ({
123184
ideSnippets,
124185
diffSnippets,
125186
clipboardSnippets,
187+
recentlyOpenedFileSnippets,
126188
] = await Promise.all([
127189
racePromise(contextRetrievalService.getRootPathSnippets(helper)),
128190
racePromise(
@@ -133,6 +195,7 @@ export const getAllSnippets = async ({
133195
: [],
134196
[], // racePromise(getDiffSnippets(ide)) // temporarily disabled, see https://github.com/continuedev/continue/pull/5882,
135197
racePromise(getClipboardSnippets(ide)),
198+
racePromise(getSnippetsFromRecentlyOpenedFiles(helper, ide)), // giving this one a little more time to complete
136199
]);
137200

138201
return {
@@ -143,5 +206,6 @@ export const getAllSnippets = async ({
143206
diffSnippets,
144207
clipboardSnippets,
145208
recentlyVisitedRangesSnippets: helper.input.recentlyVisitedRanges,
209+
recentlyOpenedFileSnippets,
146210
};
147211
};

0 commit comments

Comments
 (0)