fix(language-service): Preserve CRLF in templates for language-service (#33241)

This is a potential fix for https://github.com/angular/vscode-ng-language-service/issues/235
suggested by @andrius-pra in
47696136e3.

Currently, CRLF line endings are converted to LFs and this causes the
diagnostics span to be off in templates that use CRLF. The line endings
must be preserved in order to maintain correct span offset. The solution
is to add an option to the Tokenizer to indicate such preservation.

PR Close #33241
This commit is contained in:
Keen Yee Liau
2019-10-17 15:26:10 -07:00
committed by Matias Niemelä
parent e030375d9a
commit 65a0d2b53d
3 changed files with 20 additions and 13 deletions

View File

@ -510,6 +510,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
);
const htmlResult = htmlParser.parse(template.source, fileName, {
tokenizeExpansionForms: true,
preserveLineEndings: true, // do not convert CRLF to LF
});
const {directives, pipes, schemas} = this.getModuleMetadataForDirective(classSymbol);
const parseResult =