Skip to content

Commit

Permalink
fix(language-service): implement getDefinitionAtPosition for Angular …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
clydin authored and atscott committed Apr 9, 2024
1 parent 1c6553e commit bd236cc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/language-service/src/ts_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export function create(info: ts.server.PluginCreateInfo): NgLanguageService {
}
}

function getDefinitionAtPosition(
fileName: string, position: number): readonly ts.DefinitionInfo[]|undefined {
return getDefinitionAndBoundSpan(fileName, position)?.definitions;
}

function getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[]|
undefined {
return ngLS.getReferencesAtPosition(fileName, position);
Expand Down Expand Up @@ -226,6 +231,7 @@ export function create(info: ts.server.PluginCreateInfo): NgLanguageService {
getSemanticDiagnostics,
getTypeDefinitionAtPosition,
getQuickInfoAtPosition,
getDefinitionAtPosition,
getDefinitionAndBoundSpan,
getReferencesAtPosition,
findRenameLocations,
Expand Down

0 comments on commit bd236cc

Please sign in to comment.