mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Many `ts.LanguageService` APIs accept a filename, for example
```ts
getQuickInfoAtPosition(fileName: string, position: number)
```
The requirement is that `fileName` is agnostic to the platform (Linux, Mac,
Windows, etc), and is always normalized to TypeScript's internal
`NormalizedPath`.
This is evident from the way these APIs are called from the language server:
```ts
private onHover(params: lsp.TextDocumentPositionParams) {
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
if (lsInfo === undefined) {
return;
}
const {languageService, scriptInfo} = lsInfo;
const offset = lspPositionToTsPosition(scriptInfo, params.position);
const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
// ...
}
```
|
||
|---|---|---|
| .. | ||
| project | ||
| BUILD.bazel | ||
| completions_spec.ts | ||
| definitions_spec.ts | ||
| diagnostic_messages_spec.ts | ||
| diagnostics_spec.ts | ||
| expression_diagnostics_spec.ts | ||
| global_symbols_spec.ts | ||
| hover_spec.ts | ||
| html_info_spec.ts | ||
| language_service_spec.ts | ||
| mocks.ts | ||
| references_spec.ts | ||
| reflector_host_spec.ts | ||
| test_utils.ts | ||
| ts_plugin_spec.ts | ||
| typescript_host_spec.ts | ||
| typescript_symbols_spec.ts | ||
| utils_spec.ts | ||