MCPcopy Create free account
hub / github.com/angular/angular / getTokenAtPosition

Function getTokenAtPosition

vscode-ng-language-service/server/src/utils.ts:265–276  ·  view source on GitHub ↗
(sourceFile: ts.SourceFile, position: number)

Source from the content-addressed store, hash-verified

263}
264
265export function getTokenAtPosition(sourceFile: ts.SourceFile, position: number): ts.Node {
266 let current: ts.Node = sourceFile;
267 while (true) {
268 const child = current
269 .getChildren(sourceFile)
270 .find((c) => c.getStart(sourceFile) <= position && c.getEnd() > position);
271 if (!child || child.kind === ts.SyntaxKind.EndOfFileToken) {
272 return current;
273 }
274 current = child;
275 }
276}
277
278export enum LanguageId {
279 TS = 'typescript',

Callers 2

onHoverFunction · 0.90
onCompletionFunction · 0.90

Calls 1

findMethod · 0.45

Tested by

no test coverage detected