refactor(language-service): create getTypeDefinitionAtPosition stubs (#39050)

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 #39050
This commit is contained in:
Andrew Scott 2020-09-29 14:25:28 -07:00 committed by Alex Rickabaugh
parent ddc9e8e47a
commit 31e42f0947
2 changed files with 21 additions and 12 deletions

View File

@ -24,8 +24,13 @@ export function create(info: ts.server.PluginCreateInfo): ts.LanguageService {
return diagnostics;
}
function getTypeDefinitionAtPosition(fileName: string, position: number) {
return undefined;
}
return {
...tsLS,
getSemanticDiagnostics,
getTypeDefinitionAtPosition,
};
}

View File

@ -110,16 +110,20 @@ export function create(info: tss.server.PluginCreateInfo): tss.LanguageService {
return ngLS.getDefinitionAndBoundSpan(fileName, position);
}
const proxy: tss.LanguageService = Object.assign(
// First clone the original TS language service
{}, tsLS,
// Then override the methods supported by Angular language service
{
getCompletionsAtPosition,
getQuickInfoAtPosition,
getSemanticDiagnostics,
getDefinitionAtPosition,
getDefinitionAndBoundSpan,
});
return proxy;
function getTypeDefinitionAtPosition(fileName: string, position: number) {
// Not implemented in VE Language Service
return undefined;
}
return {
// First clone the original TS language service
...tsLS,
// Then override the methods supported by Angular language service
getCompletionsAtPosition,
getQuickInfoAtPosition,
getSemanticDiagnostics,
getDefinitionAtPosition,
getDefinitionAndBoundSpan,
getTypeDefinitionAtPosition,
};
}