From 8758006acca3c7859f58a8658895ef975ef3aea7 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 24 Nov 2020 11:57:34 -0800 Subject: [PATCH] refactor(language-service): create getReferencesAtPosition stubs (#39829) Create stubs for getTypeDefinitionAtPosition for both VE and Ivy Language Service implementations. This will prevent failed requests when it is implemented on the vscode plugin side. PR Close #39829 --- packages/language-service/ivy/ts_plugin.ts | 6 ++++++ packages/language-service/src/ts_plugin.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/language-service/ivy/ts_plugin.ts b/packages/language-service/ivy/ts_plugin.ts index f76ad6c9f8..473842312d 100644 --- a/packages/language-service/ivy/ts_plugin.ts +++ b/packages/language-service/ivy/ts_plugin.ts @@ -56,11 +56,17 @@ export function create(info: ts.server.PluginCreateInfo): ts.LanguageService { } } + function getReferencesAtPosition(fileName: string, position: number) { + // TODO(atscott): implement references + return undefined; + } + return { ...tsLS, getSemanticDiagnostics, getTypeDefinitionAtPosition, getQuickInfoAtPosition, getDefinitionAndBoundSpan, + getReferencesAtPosition, }; } diff --git a/packages/language-service/src/ts_plugin.ts b/packages/language-service/src/ts_plugin.ts index 5f67d491b0..a8da1e47a8 100644 --- a/packages/language-service/src/ts_plugin.ts +++ b/packages/language-service/src/ts_plugin.ts @@ -115,6 +115,11 @@ export function create(info: tss.server.PluginCreateInfo): tss.LanguageService { return undefined; } + function getReferencesAtPosition(fileName: string, position: number) { + // Not implemented in VE Language Service + return undefined; + } + return { // First clone the original TS language service ...tsLS, @@ -125,5 +130,6 @@ export function create(info: tss.server.PluginCreateInfo): tss.LanguageService { getDefinitionAtPosition, getDefinitionAndBoundSpan, getTypeDefinitionAtPosition, + getReferencesAtPosition, }; }