angular-cn/packages/language-service/src
ayazhafiz 3b700985f0 fix(language-service): do not treat file URIs as general URLs (#39917)
In the past, the legacy (VE-based) language service would use a
`UrlResolver` instance to resolve file paths, primarily for compiler
resources like external templates. The problem with this is that the
UrlResolver is designed to resolve URLs in general, and so for a path
like `/a/b/#c`, `#c` is treated as hash/fragment rather than as part
of the path, which can lead to unexpected path resolution (f.x.,
`resolve('a/b/#c/d.ts', './d.html')` would produce `'a/b/d.html'` rather
than the expected `'a/b/#c/d.html'`).

This commit resolves the issue by using Node's `path` module to resolve
file paths directly, which aligns more with how resources are resolved
in the Ivy compiler.

The testing story here is not great, and the API for validating a file
path could be a little bit prettier/robust. However, since the VE-based
language service is going into more of a "maintenance mode" now that
there is a clear path for the Ivy-based LS moving forward, I think it is
okay not to spend too much time here.

Closes https://github.com/angular/vscode-ng-language-service/issues/892
Closes https://github.com/angular/vscode-ng-language-service/issues/1001

PR Close #39917
2020-12-03 13:45:30 -08:00
..
binding_utils.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
completions.ts refactor(compiler): element.startSourceSpan is required (#38581) 2020-09-02 14:47:28 -07:00
definitions.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00
diagnostic_messages.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
diagnostics.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00
expression_diagnostics.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
expression_type.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
expressions.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
global_symbols.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
hover.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00
html_info.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
language_service.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00
locate_symbol.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
reflector_host.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
symbols.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
template.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ts_plugin.ts refactor(language-service): create findRenameLocations stubs (#39919) 2020-12-03 13:44:49 -08:00
ts_utils.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00
types.ts feat(language-service): TS references from template items (#37437) 2020-06-08 17:23:49 -07:00
typescript_host.ts fix(language-service): do not treat file URIs as general URLs (#39917) 2020-12-03 13:45:30 -08:00
typescript_symbols.ts feat(compiler-cli): add support for TypeScript 4.0 (#38076) 2020-08-24 13:06:59 -07:00
utils.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00