angular-cn/packages
Keen Yee Liau e1e1db3c01 fix(language-service): Paths on Windows should be normalized (#40492)
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);
    // ...
  }
```
9fca9c6651/server/src/session.ts (L594)
Here `scriptInfo.fileName` is always a `ts.server.NormalizedPath`.

However, https://github.com/angular/angular/pull/39917 accidentally leaked
the platform-specific paths, and caused a mismatch between the incoming paths
and the paths stored in the internal data structure `fileToComponent`.

This PR fixes the bug by always normalizing the paths, and updating the
type to reflect the format of the underlying data.

Fixes https://github.com/angular/vscode-ng-language-service/issues/1063

PR Close #40492
2021-01-20 08:46:03 -08:00
..
animations fix(animations): implement getPosition in browser animation builder (#39983) 2020-12-08 16:24:41 -08:00
bazel docs: remove duplicated the (#40434) 2021-01-14 11:33:57 -08:00
benchpress build: support building with TypeScript 4.1 (#39571) 2020-11-25 11:10:01 -08:00
common docs: remove duplicated the (#40434) 2021-01-14 11:33:57 -08:00
compiler fix(compiler): correct the `KeySpan` for animation events and properties (#40347) 2021-01-15 11:38:41 -08:00
compiler-cli refactor(core): add links to top compiler errors (#40326) 2021-01-19 10:14:57 -08:00
core refactor(core): add links to top runtime errors (#40326) 2021-01-19 10:14:56 -08:00
docs docs(di): fix typo in advanced di doc (#36634) 2020-05-01 09:50:28 -07:00
elements fix(elements): update the view of an `OnPush` component when inputs change (#39452) 2020-11-06 09:31:46 -08:00
examples fix(core): Allow passing AbstractType to the inject function (#37958) 2020-11-24 10:42:21 -08:00
forms fix(forms): error if control is removed as a result of another one being reset (#40462) 2021-01-19 11:41:23 -08:00
language-service fix(language-service): Paths on Windows should be normalized (#40492) 2021-01-20 08:46:03 -08:00
localize docs: update JSDOC comment for the ArbTranslationSerializer (#40354) 2021-01-11 10:40:24 -08:00
misc/angular-in-memory-web-api docs: remove duplicated the (#40434) 2021-01-14 11:33:57 -08:00
platform-browser fix(animations): implement getPosition in browser animation builder (#39983) 2020-12-08 16:24:41 -08:00
platform-browser-dynamic docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
platform-server build: support building with TypeScript 4.1 (#39571) 2020-11-25 11:10:01 -08:00
private/testing build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
router fix(router): lazy loaded modules without RouterModule.forChild() won't cause an infinite loop (#36605) 2021-01-15 10:39:55 -08:00
service-worker refactor(service-worker): remove work-around for Chrome code highlighting bug (#40234) 2021-01-11 10:42:50 -08:00
upgrade fix(upgrade): fix HMR for hybrid applications (#40045) 2020-12-10 13:40:53 -08:00
zone.js docs(zone.js): add leading space in the license comment of zone.js bundles (#40456) 2021-01-19 09:16:41 -08:00
BUILD.bazel build: replace @types/trusted-types dep with minimal type defs (#39211) 2020-10-15 09:08:00 -07:00
README.md docs: add doc reference to npm package readme (#33911) 2019-11-20 14:46:23 -08:00
circular-deps-test.conf.js fix(platform-webworker): remove platform-webworker and platform-webworker-dynamic (#38846) 2020-09-30 09:13:59 -04:00
empty.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
goog.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
license-banner.txt build: bump year (#34651) 2020-01-13 07:21:43 -08:00
system.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig-build-no-strict.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-build.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-test.json refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
tsconfig.json fix(platform-webworker): remove platform-webworker and platform-webworker-dynamic (#38846) 2020-09-30 09:13:59 -04:00
types.d.ts build: replace @types/trusted-types dep with minimal type defs (#39211) 2020-10-15 09:08:00 -07:00

README.md

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT