angular-docs-cn/packages/language-service/test
ayazhafiz 794dcb58d3 fix(language-service): do not use an i18n parser for templates (#34531)
The compiler's `I18NHtmlParser` may expand template nodes that have
internationalization metadata attached to them; for instance,

```html
<div i18n="@@i18n-el">{{}}</div>
```

gets expanded to an AST with the i18n metadata extracted and text filled
in as necessary; to the language service, the template above, as read in
the AST, now looks something like

```html
<div>{{$implicit}}</div>
```

This is undesirable for the language service because we want to preserve
the original form of the source template source code, and have
information about the original values of the template. The language
service also does not need to use an i18n parser -- we don't generate
any template output.

To fix this turns out to be as easy as moving to using a raw
`HtmlParser`.

---

A note on the testing strategy: as mentioned above, we don't need to use
an i18n parser, but we don't **not** need to use one if the parser
does not heavily modify the template AST. For this reason, the tests
target the functionality of not modifying a template with i18n metadata
rather than testing that the language service does not use an i18n parser.

---

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

PR Close #34531
2020-01-10 08:23:08 -08:00
..
project feat(language-service): Show documentation on hover (#34506) 2020-01-06 11:36:57 -08:00
BUILD.bazel fix(language-service): Remove getExternalFiles() (#34260) 2019-12-05 13:13:20 -08:00
completions_spec.ts fix(language-service): do not use an i18n parser for templates (#34531) 2020-01-10 08:23:08 -08:00
definitions_spec.ts fix(language-service): do not use an i18n parser for templates (#34531) 2020-01-10 08:23:08 -08:00
diagnostics_spec.ts test(language-service): make app.component a constant (#34587) 2020-01-09 13:31:39 -08:00
expression_diagnostics_spec.ts refactor(compiler-cli): Move diagnostics files to language service (#33809) 2019-11-14 09:29:07 -08:00
global_symbols_spec.ts refactor(compiler-cli): Move diagnostics files to language service (#33809) 2019-11-14 09:29:07 -08:00
hover_spec.ts fix(language-service): do not use an i18n parser for templates (#34531) 2020-01-10 08:23:08 -08:00
html_info_spec.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
language_service_spec.ts fix(language-service): Remove getTemplateReferences() from LanguageService API (#33807) 2019-11-15 10:41:51 -08:00
mocks.ts refactor(compiler-cli): Move diagnostics files to language service (#33809) 2019-11-14 09:29:07 -08:00
reflector_host_spec.ts test(language-service): remove MockData from MockTypescriptHost (#32752) 2019-09-18 15:29:25 -07:00
template_spec.ts test(language-service): remove MockData from MockTypescriptHost (#32752) 2019-09-18 15:29:25 -07:00
test_utils.ts fix(language-service): Recompute analyzed modules only when source files change (#33806) 2019-11-15 10:42:09 -08:00
ts_plugin_spec.ts fix(language-service): Remove getExternalFiles() (#34260) 2019-12-05 13:13:20 -08:00
typescript_host_spec.ts fix(language-service): completions after "let x of |" in ngFor (#34473) 2019-12-19 11:34:03 -08:00
typescript_symbols_spec.ts fix(compiler-cli): Refactor getTsTypeFromBuiltinType (#33778) 2019-11-15 10:43:41 -08:00
utils_spec.ts fix(language-service): HTML path should include last node before cursor (#34440) 2019-12-16 14:12:36 -08:00