angular-cn/packages/language-service/test
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
..
project fix(language-service): do not treat file URIs as general URLs (#39917) 2020-12-03 13:45:30 -08:00
BUILD.bazel refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00
completions_spec.ts fix(language-service): remove completion for string (#37983) 2020-07-13 14:16:56 -07:00
definitions_spec.ts feat(common): stricter types for DatePipe (#37447) 2020-09-28 12:23:32 -04:00
diagnostic_messages_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
diagnostics_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
expression_diagnostics_spec.ts feat(compiler): support unary operators for more accurate type checking (#37918) 2020-08-21 12:25:53 -07:00
global_symbols_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
hover_spec.ts feat(common): stricter types for DatePipe (#37447) 2020-09-28 12:23:32 -04:00
html_info_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
language_service_spec.ts test(language-service): Remove all markers from test project (#37475) 2020-06-08 10:25:42 -07:00
mocks.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
references_spec.ts feat(language-service): TS references from template items (#37437) 2020-06-08 17:23:49 -07:00
reflector_host_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
test_utils.ts fix(language-service): do not treat file URIs as general URLs (#39917) 2020-12-03 13:45:30 -08:00
ts_plugin_spec.ts fix(language-service): do not treat file URIs as general URLs (#39917) 2020-12-03 13:45:30 -08:00
typescript_host_spec.ts fix(language-service): do not treat file URIs as general URLs (#39917) 2020-12-03 13:45:30 -08:00
typescript_symbols_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
utils_spec.ts refactor(language-service): introduce DisplayParts abstraction for Ivy (#39505) 2020-11-02 10:29:50 -08:00