fix small autocomplete bug in merge function
This commit is contained in:
parent
8754465406
commit
1eafa16bcd
10 changed files with 128 additions and 14 deletions
|
|
@ -215,7 +215,7 @@ export async function constructAutocompletePrompt(
|
|||
snippets.push(...importSnippets);
|
||||
}
|
||||
|
||||
if (options.useHierarchicalContext && treePath) {
|
||||
if (options.useRootPathContext && treePath) {
|
||||
const ctx = await rootPathContextService.getContextForPath(
|
||||
filepath,
|
||||
treePath,
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export function deduplicateSnippets(
|
|||
function mergeSnippetsByRange(
|
||||
snippets: Required<AutocompleteSnippet>[],
|
||||
): Required<AutocompleteSnippet>[] {
|
||||
if (snippets.length === 0) {
|
||||
if (snippets.length <= 1) {
|
||||
return snippets;
|
||||
}
|
||||
|
||||
|
|
|
|||
2
core/index.d.ts
vendored
2
core/index.d.ts
vendored
|
|
@ -882,7 +882,7 @@ export interface TabAutocompleteOptions {
|
|||
recentLinePrefixMatchMinLength: number;
|
||||
disableInFiles?: string[];
|
||||
useImports?: boolean;
|
||||
useHierarchicalContext?: boolean;
|
||||
useRootPathContext?: boolean;
|
||||
}
|
||||
|
||||
export interface ContinueUIConfig {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = {
|
|||
recentLinePrefixMatchMinLength: 7,
|
||||
disableInFiles: undefined,
|
||||
useImports: true,
|
||||
useHierarchicalContext: true,
|
||||
useRootPathContext: true,
|
||||
};
|
||||
|
||||
export const COUNT_COMPLETION_REJECTED_AFTER = 10_000;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ export async function getLanguageForFile(
|
|||
export enum TSQueryType {
|
||||
CodeSnippets = "code-snippet-queries",
|
||||
Imports = "import-queries",
|
||||
// Used in HierarchicalContextService.ts
|
||||
// Used in RootPathContextService.ts
|
||||
FunctionDeclaration = "root-path-context-queries/function_declaration",
|
||||
MethodDefinition = "root-path-context-queries/method_definition",
|
||||
FunctionDefinition = "root-path-context-queries/function_definition",
|
||||
|
|
|
|||
36
docs/static/schemas/config.json
vendored
36
docs/static/schemas/config.json
vendored
|
|
@ -1552,7 +1552,8 @@
|
|||
"url",
|
||||
"database",
|
||||
"os",
|
||||
"repo-map"
|
||||
"repo-map",
|
||||
"greptile"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"Reference the contents of the current changes as given by `git diff`",
|
||||
|
|
@ -1576,7 +1577,8 @@
|
|||
"Reference the contents of a page at a URL",
|
||||
"Reference table schemas",
|
||||
"Operating system and CPU Information",
|
||||
"Map of files in the repository with important code highlights"
|
||||
"Map of files in the repository with important code highlights",
|
||||
"Query your greptile index of the current repo"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1954,6 +1956,36 @@
|
|||
},
|
||||
"required": ["host", "port", "user", "password", "database"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"enum": ["greptile"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"params": {
|
||||
"properties": {
|
||||
"GithubToken": {
|
||||
"title": "GithubToken",
|
||||
"description": "Your github access token",
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"GreptileToken": {
|
||||
"title": "GreptileToken",
|
||||
"description": "Your greptile access token",
|
||||
"default": "",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["GreptileToken", "GithubToken"]
|
||||
}
|
||||
}
|
||||
],
|
||||
"required": ["name"]
|
||||
|
|
|
|||
|
|
@ -1552,7 +1552,8 @@
|
|||
"url",
|
||||
"database",
|
||||
"os",
|
||||
"repo-map"
|
||||
"repo-map",
|
||||
"greptile"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"Reference the contents of the current changes as given by `git diff`",
|
||||
|
|
@ -1576,7 +1577,8 @@
|
|||
"Reference the contents of a page at a URL",
|
||||
"Reference table schemas",
|
||||
"Operating system and CPU Information",
|
||||
"Map of files in the repository with important code highlights"
|
||||
"Map of files in the repository with important code highlights",
|
||||
"Query your greptile index of the current repo"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -1954,6 +1956,36 @@
|
|||
},
|
||||
"required": ["host", "port", "user", "password", "database"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"enum": ["greptile"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"params": {
|
||||
"properties": {
|
||||
"GithubToken": {
|
||||
"title": "GithubToken",
|
||||
"description": "Your github access token",
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"GreptileToken": {
|
||||
"title": "GreptileToken",
|
||||
"description": "Your greptile access token",
|
||||
"default": "",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["GreptileToken", "GithubToken"]
|
||||
}
|
||||
}
|
||||
],
|
||||
"required": ["name"]
|
||||
|
|
|
|||
|
|
@ -1723,7 +1723,8 @@
|
|||
"url",
|
||||
"database",
|
||||
"os",
|
||||
"repo-map"
|
||||
"repo-map",
|
||||
"greptile"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"Reference the contents of the current changes as given by `git diff`",
|
||||
|
|
@ -1747,7 +1748,8 @@
|
|||
"Reference the contents of a page at a URL",
|
||||
"Reference table schemas",
|
||||
"Operating system and CPU Information",
|
||||
"Map of files in the repository with important code highlights"
|
||||
"Map of files in the repository with important code highlights",
|
||||
"Query your greptile index of the current repo"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -2190,6 +2192,41 @@
|
|||
"database"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"enum": [
|
||||
"greptile"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"params": {
|
||||
"properties": {
|
||||
"GithubToken": {
|
||||
"title": "GithubToken",
|
||||
"description": "Your github access token",
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"GreptileToken": {
|
||||
"title": "GreptileToken",
|
||||
"description": "Your greptile access token",
|
||||
"default": "",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"GreptileToken",
|
||||
"GithubToken"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"required": [
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.213",
|
||||
"version": "0.9.214",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.213",
|
||||
"version": "0.9.214",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { IDE, RangeInFile } from "core";
|
||||
import type { IDE, Range, RangeInFile } from "core";
|
||||
import { getAst, getTreePathAtCursor } from "core/autocomplete/ast";
|
||||
import { GetLspDefinitionsFunction } from "core/autocomplete/completionProvider";
|
||||
import { AutocompleteLanguageInfo } from "core/autocomplete/languages";
|
||||
|
|
@ -303,6 +303,19 @@ export async function getDefinitionsForNode(
|
|||
}
|
||||
return await Promise.all(
|
||||
ranges.map(async (rif) => {
|
||||
// Convert the VS Code Range type to ours
|
||||
const range: Range = {
|
||||
start: {
|
||||
line: rif.range.start.line,
|
||||
character: rif.range.start.character,
|
||||
},
|
||||
end: {
|
||||
line: rif.range.end.line,
|
||||
character: rif.range.end.character,
|
||||
},
|
||||
};
|
||||
rif.range = range;
|
||||
|
||||
if (!isRifWithContents(rif)) {
|
||||
return {
|
||||
...rif,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue