(sourceFile: ts.SourceFile, position: number)
| 263 | } |
| 264 | |
| 265 | export 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 | |
| 278 | export enum LanguageId { |
| 279 | TS = 'typescript', |
no test coverage detected