Skip to content

Commit 51d907e

Browse files
authored
Revert "fix(client): fix detection of Angular context after string interpolation (#1922)" (#2023)
This reverts commit bd6282e. fixes angular/angular#55223
1 parent 410e31f commit 51d907e

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

client/src/embedded_support.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ export function isInsideStringLiteral(
6767
* `@Component` or `{styleUrls: [someFunction('stringL¦iteral')]}`, the @angular/language-service
6868
* will always give us the correct answer. This helper gives us a quick win for optimizing the
6969
* number of requests we send to the server.
70+
*
71+
* TODO(atscott): tagged templates don't work: #1872 /
72+
* https://github.com/Microsoft/TypeScript/issues/20055
7073
*/
7174
function isPropertyAssignmentToStringOrStringInArray(
7275
documentText: string, offset: number, propertyAssignmentNames: string[]): boolean {
@@ -78,23 +81,8 @@ function isPropertyAssignmentToStringOrStringInArray(
7881
let lastTokenText: string|undefined;
7982
let unclosedBraces = 0;
8083
let unclosedBrackets = 0;
81-
let unclosedTaggedTemplates = 0;
8284
let propertyAssignmentContext = false;
83-
84-
function isTemplateStartOfTaggedTemplate() {
85-
return token === ts.SyntaxKind.NoSubstitutionTemplateLiteral ||
86-
token === ts.SyntaxKind.TemplateHead;
87-
}
88-
8985
while (token !== ts.SyntaxKind.EndOfFileToken && scanner.getStartPos() < offset) {
90-
if (isTemplateStartOfTaggedTemplate()) {
91-
unclosedTaggedTemplates++;
92-
}
93-
if (token === ts.SyntaxKind.CloseBraceToken && unclosedTaggedTemplates > 0) {
94-
// https://github.com/Microsoft/TypeScript/issues/20055
95-
token = scanner.reScanTemplateToken(/*isTaggedTemplate*/ true);
96-
unclosedTaggedTemplates--;
97-
}
9886
if (lastToken === ts.SyntaxKind.Identifier && lastTokenText !== undefined &&
9987
propertyAssignmentNames.includes(lastTokenText) && token === ts.SyntaxKind.ColonToken) {
10088
propertyAssignmentContext = true;

client/src/tests/embedded_support_spec.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,6 @@ describe('embedded language support', () => {
3838
it('at end of template', () => {
3939
test(`template: '<div></div>¦'`, isInsideInlineTemplateRegion, true);
4040
});
41-
42-
it('works for inline templates after a template string', () => {
43-
test(
44-
'const x = `${""}`;\n' +
45-
'template: `hello ¦world`',
46-
isInsideInlineTemplateRegion, true);
47-
});
48-
49-
it('works for inline templates after a tagged template string inside tagged template string',
50-
() => {
51-
test(
52-
'const x = `${`${""}`}`;\n' +
53-
'template: `hello ¦world`',
54-
isInsideInlineTemplateRegion, true);
55-
});
5641
});
5742

5843
describe('isInsideAngularContext', () => {
@@ -127,4 +112,4 @@ function extractCursorInfo(textWithCursor: string): {cursor: number, text: strin
127112
cursor,
128113
text: textWithCursor.substr(0, cursor) + textWithCursor.substr(cursor + 1),
129114
};
130-
}
115+
}

0 commit comments

Comments
 (0)