fix(language-service): CRLF offset in inline template (#34737)
This commit fixes incorrect CRLF offsets in inline template. PR closes https://github.com/angular/vscode-ng-language-service/issues/520 PR Close #34737
This commit is contained in:
@ -98,7 +98,9 @@ export class InlineTemplate extends BaseTemplate {
|
||||
throw new Error(`Inline template and component class should belong to the same source file`);
|
||||
}
|
||||
this.fileName = sourceFile.fileName;
|
||||
this.source = templateNode.text;
|
||||
// node.text returns the TS internal representation of the normalized text,
|
||||
// and all CR characters are stripped. node.getText() returns the raw text.
|
||||
this.source = templateNode.getText().slice(1, -1); // strip leading and trailing quotes
|
||||
this.span = {
|
||||
// TS string literal includes surrounding quotes in the start/end offsets.
|
||||
start: templateNode.getStart() + 1,
|
||||
|
Reference in New Issue
Block a user