Skip to content

Commit 5f183ad

Browse files
authored
Revert PR 61928 (#62423)
1 parent 6f6efb4 commit 5f183ad

File tree

7 files changed

+16
-21
lines changed

7 files changed

+16
-21
lines changed

src/compiler/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4288,7 +4288,6 @@ export interface SourceFileLike {
42884288
lineMap?: readonly number[];
42894289
/** @internal */
42904290
getPositionOfLineAndCharacter?(line: number, character: number, allowEdits?: true): number;
4291-
languageVariant?: LanguageVariant;
42924291
}
42934292

42944293
/** @internal */

src/services/completions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ function getJsxClosingTagCompletion(location: Node | undefined, sourceFile: Sour
15951595
switch (node.kind) {
15961596
case SyntaxKind.JsxClosingElement:
15971597
return true;
1598-
case SyntaxKind.LessThanSlashToken:
1598+
case SyntaxKind.SlashToken:
15991599
case SyntaxKind.GreaterThanToken:
16001600
case SyntaxKind.Identifier:
16011601
case SyntaxKind.PropertyAccessExpression:
@@ -3508,7 +3508,7 @@ function getCompletionData(
35083508
}
35093509
break;
35103510

3511-
case SyntaxKind.LessThanSlashToken:
3511+
case SyntaxKind.SlashToken:
35123512
if (currentToken.parent.kind === SyntaxKind.JsxSelfClosingElement) {
35133513
location = currentToken;
35143514
}
@@ -3518,7 +3518,7 @@ function getCompletionData(
35183518

35193519
switch (parent.kind) {
35203520
case SyntaxKind.JsxClosingElement:
3521-
if (contextToken.kind === SyntaxKind.LessThanSlashToken) {
3521+
if (contextToken.kind === SyntaxKind.SlashToken) {
35223522
isStartingCloseTag = true;
35233523
location = contextToken;
35243524
}
@@ -5809,7 +5809,7 @@ function isValidTrigger(sourceFile: SourceFile, triggerCharacter: CompletionsTri
58095809
case "/":
58105810
return !!contextToken && (isStringLiteralLike(contextToken)
58115811
? !!tryGetImportFromModuleSpecifier(contextToken)
5812-
: contextToken.kind === SyntaxKind.LessThanSlashToken && isJsxClosingElement(contextToken.parent));
5812+
: contextToken.kind === SyntaxKind.SlashToken && isJsxClosingElement(contextToken.parent));
58135813
case " ":
58145814
return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === SyntaxKind.SourceFile;
58155815
default:

src/services/services.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,8 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea
504504
});
505505
return children;
506506
}
507-
const languageVariant = sourceFile?.languageVariant ?? LanguageVariant.Standard;
507+
508508
scanner.setText((sourceFile || node.getSourceFile()).text);
509-
scanner.setLanguageVariant(languageVariant);
510509
let pos = node.pos;
511510
const processNode = (child: Node) => {
512511
addSyntheticNodes(children, pos, child.pos, node);
@@ -527,7 +526,6 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea
527526
node.forEachChild(processNode, processNodes);
528527
addSyntheticNodes(children, pos, node.end, node);
529528
scanner.setText(undefined);
530-
scanner.setLanguageVariant(LanguageVariant.Standard);
531529
return children;
532530
}
533531

src/services/utilities.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ export function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position:
18891889
}
18901890

18911891
// <div>|</div>
1892-
if (token.kind === SyntaxKind.LessThanSlashToken && token.parent.kind === SyntaxKind.JsxClosingElement) {
1892+
if (token.kind === SyntaxKind.LessThanToken && token.parent.kind === SyntaxKind.JsxClosingElement) {
18931893
return true;
18941894
}
18951895

@@ -1934,7 +1934,6 @@ export function isInsideJsxElement(sourceFile: SourceFile, position: number): bo
19341934
|| node.kind === SyntaxKind.CloseBraceToken
19351935
|| node.kind === SyntaxKind.OpenBraceToken
19361936
|| node.kind === SyntaxKind.SlashToken
1937-
|| node.kind === SyntaxKind.LessThanSlashToken
19381937
) {
19391938
node = node.parent;
19401939
}

tests/baselines/reference/api/typescript.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5908,7 +5908,6 @@ declare namespace ts {
59085908
*/
59095909
interface SourceFileLike {
59105910
readonly text: string;
5911-
languageVariant?: LanguageVariant;
59125911
}
59135912
interface SourceFileLike {
59145913
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;

tests/cases/fourslash/syntacticClassificationsJsx1.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ verify.syntacticClassificationsAre(
1818
c.jsxText(`
1919
some jsx text
2020
`),
21-
c.punctuation("</"), c.jsxCloseTagName("div"), c.punctuation(">"), c.punctuation(";"),
21+
c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div"), c.punctuation(">"), c.punctuation(";"),
2222
c.keyword("let"), c.identifier("y"), c.operator("="),
2323
c.punctuation("<"),
2424
c.jsxSelfClosingTagName("element"),
2525
c.jsxAttribute("attr"), c.operator("="), c.jsxAttributeStringLiteralValue(`"123"`),
2626
c.punctuation("/"), c.punctuation(">")
2727
)
2828

29-
const c2 = classification("2020");
30-
verify.semanticClassificationsAre("2020",
31-
c2.semanticToken("variable.declaration", "x"),
32-
c2.semanticToken("variable.declaration", "y"),
29+
const c2 = classification("2020");
30+
verify.semanticClassificationsAre("2020",
31+
c2.semanticToken("variable.declaration", "x"),
32+
c2.semanticToken("variable.declaration", "y"),
3333
);

tests/cases/fourslash/syntacticClassificationsJsx2.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ verify.syntacticClassificationsAre(
1818
c.jsxText(`
1919
some jsx text
2020
`),
21-
c.punctuation("</"), c.jsxCloseTagName("div.name"), c.punctuation(">"), c.punctuation(";"),
21+
c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div.name"), c.punctuation(">"), c.punctuation(";"),
2222
c.keyword("let"), c.identifier("y"), c.operator("="),
2323
c.punctuation("<"),
2424
c.jsxSelfClosingTagName("element.name"),
2525
c.jsxAttribute("attr"), c.operator("="), c.jsxAttributeStringLiteralValue(`"123"`),
2626
c.punctuation("/"), c.punctuation(">")
2727
)
2828

29-
const c2 = classification("2020");
30-
verify.semanticClassificationsAre("2020",
31-
c2.semanticToken("variable.declaration", "x"),
32-
c2.semanticToken("variable.declaration", "y"),
29+
const c2 = classification("2020");
30+
verify.semanticClassificationsAre("2020",
31+
c2.semanticToken("variable.declaration", "x"),
32+
c2.semanticToken("variable.declaration", "y"),
3333
);

0 commit comments

Comments
 (0)