MCPcopy
hub / github.com/continuedev/continue / MessageIde

Class MessageIde

core/protocol/messenger/messageIde.ts:21–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19} from "../..";
20
21export class MessageIde implements IDE {
22 constructor(
23 private readonly request: <T extends keyof ToIdeFromWebviewOrCoreProtocol>(
24 messageType: T,
25 data: ToIdeFromWebviewOrCoreProtocol[T][0],
26 ) => Promise<ToIdeFromWebviewOrCoreProtocol[T][1]>,
27 private readonly on: <T extends keyof FromIdeProtocol>(
28 messageType: T,
29 callback: (data: FromIdeProtocol[T][0]) => FromIdeProtocol[T][1],
30 ) => void,
31 ) {}
32
33 async readSecrets(keys: string[]): Promise<Record<string, string>> {
34 return this.request("readSecrets", { keys });
35 }
36
37 async writeSecrets(secrets: { [key: string]: string }): Promise<void> {
38 return this.request("writeSecrets", { secrets });
39 }
40
41 fileExists(fileUri: string): Promise<boolean> {
42 return this.request("fileExists", { filepath: fileUri });
43 }
44
45 async gotoDefinition(location: Location): Promise<RangeInFile[]> {
46 return this.request("gotoDefinition", { location });
47 }
48
49 async gotoTypeDefinition(location: Location): Promise<RangeInFile[]> {
50 return this.request("gotoTypeDefinition", { location });
51 }
52
53 async getSignatureHelp(location: Location): Promise<SignatureHelp | null> {
54 return this.request("getSignatureHelp", { location });
55 }
56
57 async getReferences(location: Location): Promise<RangeInFile[]> {
58 return this.request("getReferences", { location });
59 }
60
61 async getDocumentSymbols(
62 textDocumentIdentifier: string,
63 ): Promise<DocumentSymbol[]> {
64 return this.request("getDocumentSymbols", { textDocumentIdentifier });
65 }
66
67 onDidChangeActiveTextEditor(callback: (fileUri: string) => void): void {
68 this.on("didChangeActiveTextEditor", (data) => callback(data.filepath));
69 }
70
71 getIdeSettings(): Promise<IdeSettings> {
72 return this.request("getIdeSettings", undefined);
73 }
74
75 getFileStats(files: string[]): Promise<FileStatsMap> {
76 return this.request("getFileStats", { files });
77 }
78 getGitRootPath(dir: string): Promise<string | undefined> {

Callers

nothing calls this directly

Calls 1

requestMethod · 0.65

Tested by

no test coverage detected