add gotoTypeDefinition method

This commit is contained in:
Jacob Kim 2025-06-28 16:04:46 -07:00
parent e4b412acfe
commit fed6ba1591
2 changed files with 35 additions and 23 deletions

47
core/index.d.ts vendored
View file

@ -49,13 +49,13 @@ export interface IndexingProgressUpdate {
desc: string;
shouldClearIndexes?: boolean;
status:
| "loading"
| "indexing"
| "done"
| "failed"
| "paused"
| "disabled"
| "cancelled";
| "loading"
| "indexing"
| "done"
| "failed"
| "paused"
| "disabled"
| "cancelled";
debugInfo?: string;
}
@ -91,7 +91,7 @@ type RequiredLLMOptions =
export interface ILLM
extends Omit<LLMOptions, RequiredLLMOptions>,
Required<Pick<LLMOptions, RequiredLLMOptions>> {
Required<Pick<LLMOptions, RequiredLLMOptions>> {
get providerName(): string;
get underlyingProviderName(): string;
@ -773,10 +773,10 @@ export interface IDE {
getCurrentFile(): Promise<
| undefined
| {
isUntitled: boolean;
path: string;
contents: string;
}
isUntitled: boolean;
path: string;
contents: string;
}
>;
getPinnedFiles(): Promise<string[]>;
@ -814,6 +814,7 @@ export interface IDE {
// LSP
gotoDefinition(location: Location): Promise<RangeInFile[]>;
gotoTypeDefinition(location: Location): Promise<RangeInFile[]>;
// Callbacks
onDidChangeActiveTextEditor(callback: (fileUri: string) => void): void;
@ -955,11 +956,11 @@ export interface CustomCommand {
export interface Prediction {
type: "content";
content:
| string
| {
type: "text";
text: string;
}[];
| string
| {
type: "text";
text: string;
}[];
}
export interface ToolExtras {
@ -1455,9 +1456,9 @@ export interface Config {
embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
/** The model that Continue will use for tab autocompletions. */
tabAutocompleteModel?:
| CustomLLM
| JSONModelDescription
| (CustomLLM | JSONModelDescription)[];
| CustomLLM
| JSONModelDescription
| (CustomLLM | JSONModelDescription)[];
/** Options for tab autocomplete */
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
/** UI styles customization */
@ -1551,9 +1552,9 @@ export type PackageDetailsSuccess = PackageDetails & {
export type PackageDocsResult = {
packageInfo: ParsedPackageInfo;
} & (
| { error: string; details?: never }
| { details: PackageDetailsSuccess; error?: never }
);
| { error: string; details?: never }
| { details: PackageDetailsSuccess; error?: never }
);
export interface TerminalOptions {
reuseTerminal?: boolean;

View file

@ -88,6 +88,17 @@ class VsCodeIde implements IDE {
return result;
}
async gotoTypeDefinition(location: Location): Promise<RangeInFile[]> {
const result = await executeGotoProvider({
uri: vscode.Uri.parse(location.filepath),
line: location.position.line,
character: location.position.character,
name: "vscode.executeTypeDefinitionProvider",
});
return result;
}
onDidChangeActiveTextEditor(callback: (uri: string) => void): void {
vscode.window.onDidChangeActiveTextEditor((editor) => {
if (editor) {