Skip to content

Commit bd236cc

Browse files
clydinatscott
authored andcommitted
fix(language-service): implement getDefinitionAtPosition for Angular templates (#55269)
The `getDefinitionAtPosition` function may be called by consumers instead of `getDefinitionAndBoundSpan` with the later of which already implemented. The `getDefinitionAtPosition` result is a subset of what `getDefinitionAndBoundSpan` returns and currently delegates to that function. PR Close #55269
1 parent 1c6553e commit bd236cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/language-service/src/ts_plugin.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ export function create(info: ts.server.PluginCreateInfo): NgLanguageService {
7373
}
7474
}
7575

76+
function getDefinitionAtPosition(
77+
fileName: string, position: number): readonly ts.DefinitionInfo[]|undefined {
78+
return getDefinitionAndBoundSpan(fileName, position)?.definitions;
79+
}
80+
7681
function getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[]|
7782
undefined {
7883
return ngLS.getReferencesAtPosition(fileName, position);
@@ -226,6 +231,7 @@ export function create(info: ts.server.PluginCreateInfo): NgLanguageService {
226231
getSemanticDiagnostics,
227232
getTypeDefinitionAtPosition,
228233
getQuickInfoAtPosition,
234+
getDefinitionAtPosition,
229235
getDefinitionAndBoundSpan,
230236
getReferencesAtPosition,
231237
findRenameLocations,

0 commit comments

Comments
 (0)