| 1 | import type { |
| 2 | DocumentSymbol, |
| 3 | FileStatsMap, |
| 4 | FileType, |
| 5 | IDE, |
| 6 | IdeInfo, |
| 7 | IdeSettings, |
| 8 | IndexTag, |
| 9 | Location, |
| 10 | Problem, |
| 11 | Range, |
| 12 | RangeInFile, |
| 13 | SignatureHelp, |
| 14 | TerminalOptions, |
| 15 | Thread, |
| 16 | } from "../"; |
| 17 | import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes"; |
| 18 | |
| 19 | export interface GetGhTokenArgs { |
| 20 | force?: boolean; |
| 21 | } |
| 22 | |
| 23 | export type ToIdeFromWebviewOrCoreProtocol = { |
| 24 | // Methods from IDE type |
| 25 | getIdeInfo: [undefined, IdeInfo]; |
| 26 | getWorkspaceDirs: [undefined, string[]]; |
| 27 | writeFile: [{ path: string; contents: string }, void]; |
| 28 | showVirtualFile: [{ name: string; content: string }, void]; |
| 29 | openFile: [{ path: string }, void]; |
| 30 | openUrl: [string, void]; |
| 31 | runCommand: [{ command: string; options?: TerminalOptions }, void]; |
| 32 | getSearchResults: [{ query: string; maxResults?: number }, string]; |
| 33 | getFileResults: [{ pattern: string; maxResults?: number }, string[]]; |
| 34 | subprocess: [{ command: string; cwd?: string }, [string, string]]; |
| 35 | saveFile: [{ filepath: string }, void]; |
| 36 | fileExists: [{ filepath: string }, boolean]; |
| 37 | readFile: [{ filepath: string }, string]; |
| 38 | getProblems: [{ filepath: string }, Problem[]]; |
| 39 | getOpenFiles: [undefined, string[]]; |
| 40 | getCurrentFile: [ |
| 41 | undefined, |
| 42 | ( |
| 43 | | undefined |
| 44 | | { |
| 45 | isUntitled: boolean; |
| 46 | path: string; |
| 47 | contents: string; |
| 48 | } |
| 49 | ), |
| 50 | ]; |
| 51 | getPinnedFiles: [undefined, string[]]; |
| 52 | showLines: [{ filepath: string; startLine: number; endLine: number }, void]; |
| 53 | readRangeInFile: [{ filepath: string; range: Range }, string]; |
| 54 | getDiff: [{ includeUnstaged: boolean }, string[]]; |
| 55 | getTerminalContents: [undefined, string]; |
| 56 | getDebugLocals: [{ threadIndex: number }, string]; |
| 57 | getTopLevelCallStackSources: [ |
| 58 | { threadIndex: number; stackDepth: number }, |
| 59 | string[], |
| 60 | ]; |
| 61 | getAvailableThreads: [undefined, Thread[]]; |
| 62 | isTelemetryEnabled: [undefined, boolean]; |
| 63 | isWorkspaceRemote: [undefined, boolean]; |
| 64 | getUniqueId: [undefined, string]; |
| 65 | getTags: [string, IndexTag[]]; |
| 66 | readSecrets: [{ keys: string[] }, Record<string, string>]; |
| 67 | writeSecrets: [{ secrets: Record<string, string> }, void]; |
| 68 | // end methods from IDE type |
| 69 | |
| 70 | getIdeSettings: [undefined, IdeSettings]; |
| 71 | |
| 72 | // Git |
| 73 | getBranch: [{ dir: string }, string]; |
| 74 | getRepoName: [{ dir: string }, string | undefined]; |
| 75 | |
| 76 | showToast: [ |
| 77 | Parameters<IDE["showToast"]>, |
| 78 | Awaited<ReturnType<IDE["showToast"]>>, |
| 79 | ]; |
| 80 | getGitRootPath: [{ dir: string }, string | undefined]; |
| 81 | listDir: [{ dir: string }, [string, FileType][]]; |
| 82 | getFileStats: [{ files: string[] }, FileStatsMap]; |
| 83 | |
| 84 | gotoDefinition: [{ location: Location }, RangeInFile[]]; |
| 85 | gotoTypeDefinition: [{ location: Location }, RangeInFile[]]; |
| 86 | getSignatureHelp: [{ location: Location }, SignatureHelp | null]; |
| 87 | getReferences: [{ location: Location }, RangeInFile[]]; |
| 88 | getDocumentSymbols: [{ textDocumentIdentifier: string }, DocumentSymbol[]]; |
| 89 | |
| 90 | getControlPlaneSessionInfo: [ |
| 91 | { silent: boolean; useOnboarding: boolean }, |
| 92 | ControlPlaneSessionInfo | undefined, |
| 93 | ]; |
| 94 | logoutOfControlPlane: [undefined, void]; |
| 95 | reportError: [any, void]; |
| 96 | closeSidebar: [undefined, void]; |
| 97 | }; |
| 98 | |
| 99 | export type ToWebviewOrCoreFromIdeProtocol = { |
| 100 | didChangeActiveTextEditor: [{ filepath: string }, void]; |
| 101 | }; |