diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-03-16 09:01:41 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 09:01:41 +1100 |
commit | 506b321d472005d0cf916823dfa8ea37fa0b064a (patch) | |
tree | 6e4da0350772c1143a6efcfaabf99155623fe724 /cli/tsc | |
parent | 2ff9b01551d4bdb3a820774252706d4e58bceaba (diff) |
refactor(lsp): refactor completions and add tests (#9789)
Diffstat (limited to 'cli/tsc')
-rw-r--r-- | cli/tsc/99_main_compiler.js | 16 | ||||
-rw-r--r-- | cli/tsc/compiler.d.ts | 14 |
2 files changed, 29 insertions, 1 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index f8eabc890..c84c2365c 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -594,6 +594,22 @@ delete Object.prototype.__proto__; ), ); } + case "getCompletionDetails": { + debug("request", request); + return respond( + id, + languageService.getCompletionEntryDetails( + request.args.specifier, + request.args.position, + request.args.name, + undefined, + request.args.source, + undefined, + // @ts-expect-error this exists in 4.3 but not part of the d.ts + request.args.data, + ), + ); + } case "getCompletions": { return respond( id, diff --git a/cli/tsc/compiler.d.ts b/cli/tsc/compiler.d.ts index d37b56c06..a3200469c 100644 --- a/cli/tsc/compiler.d.ts +++ b/cli/tsc/compiler.d.ts @@ -51,6 +51,7 @@ declare global { | GetAsset | GetCodeFixes | GetCombinedCodeFix + | GetCompletionDetails | GetCompletionsRequest | GetDefinitionRequest | GetDiagnosticsRequest @@ -102,11 +103,22 @@ declare global { fixId: {}; } + interface GetCompletionDetails extends BaseLanguageServerRequest { + method: "getCompletionDetails"; + args: { + specifier: string; + position: number; + name: string; + source?: string; + data?: unknown; + }; + } + interface GetCompletionsRequest extends BaseLanguageServerRequest { method: "getCompletions"; specifier: string; position: number; - preferences: ts.UserPreferences; + preferences: ts.GetCompletionsAtPositionOptions; } interface GetDiagnosticsRequest extends BaseLanguageServerRequest { |