We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f6efb4 commit 5f183adCopy full SHA for 5f183ad
src/compiler/types.ts
@@ -4288,7 +4288,6 @@ export interface SourceFileLike {
4288
lineMap?: readonly number[];
4289
/** @internal */
4290
getPositionOfLineAndCharacter?(line: number, character: number, allowEdits?: true): number;
4291
- languageVariant?: LanguageVariant;
4292
}
4293
4294
src/services/completions.ts
@@ -1595,7 +1595,7 @@ function getJsxClosingTagCompletion(location: Node | undefined, sourceFile: Sour
1595
switch (node.kind) {
1596
case SyntaxKind.JsxClosingElement:
1597
return true;
1598
- case SyntaxKind.LessThanSlashToken:
+ case SyntaxKind.SlashToken:
1599
case SyntaxKind.GreaterThanToken:
1600
case SyntaxKind.Identifier:
1601
case SyntaxKind.PropertyAccessExpression:
@@ -3508,7 +3508,7 @@ function getCompletionData(
3508
3509
break;
3510
3511
3512
if (currentToken.parent.kind === SyntaxKind.JsxSelfClosingElement) {
3513
location = currentToken;
3514
@@ -3518,7 +3518,7 @@ function getCompletionData(
3518
3519
switch (parent.kind) {
3520
3521
- if (contextToken.kind === SyntaxKind.LessThanSlashToken) {
+ if (contextToken.kind === SyntaxKind.SlashToken) {
3522
isStartingCloseTag = true;
3523
location = contextToken;
3524
@@ -5809,7 +5809,7 @@ function isValidTrigger(sourceFile: SourceFile, triggerCharacter: CompletionsTri
5809
case "/":
5810
return !!contextToken && (isStringLiteralLike(contextToken)
5811
? !!tryGetImportFromModuleSpecifier(contextToken)
5812
- : contextToken.kind === SyntaxKind.LessThanSlashToken && isJsxClosingElement(contextToken.parent));
+ : contextToken.kind === SyntaxKind.SlashToken && isJsxClosingElement(contextToken.parent));
5813
case " ":
5814
return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === SyntaxKind.SourceFile;
5815
default:
src/services/services.ts
@@ -504,9 +504,8 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea
504
});
505
return children;
506
507
- const languageVariant = sourceFile?.languageVariant ?? LanguageVariant.Standard;
+
508
scanner.setText((sourceFile || node.getSourceFile()).text);
509
- scanner.setLanguageVariant(languageVariant);
510
let pos = node.pos;
511
const processNode = (child: Node) => {
512
addSyntheticNodes(children, pos, child.pos, node);
@@ -527,7 +526,6 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea
527
526
node.forEachChild(processNode, processNodes);
528
addSyntheticNodes(children, pos, node.end, node);
529
scanner.setText(undefined);
530
- scanner.setLanguageVariant(LanguageVariant.Standard);
531
532
533
src/services/utilities.ts
@@ -1889,7 +1889,7 @@ export function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position:
1889
1890
1891
// <div>|</div>
1892
- if (token.kind === SyntaxKind.LessThanSlashToken && token.parent.kind === SyntaxKind.JsxClosingElement) {
+ if (token.kind === SyntaxKind.LessThanToken && token.parent.kind === SyntaxKind.JsxClosingElement) {
1893
1894
1895
@@ -1934,7 +1934,6 @@ export function isInsideJsxElement(sourceFile: SourceFile, position: number): bo
1934
|| node.kind === SyntaxKind.CloseBraceToken
1935
|| node.kind === SyntaxKind.OpenBraceToken
1936
|| node.kind === SyntaxKind.SlashToken
1937
- || node.kind === SyntaxKind.LessThanSlashToken
1938
) {
1939
node = node.parent;
1940
tests/baselines/reference/api/typescript.d.ts
@@ -5908,7 +5908,6 @@ declare namespace ts {
5908
*/
5909
interface SourceFileLike {
5910
readonly text: string;
5911
5912
5913
5914
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
tests/cases/fourslash/syntacticClassificationsJsx1.ts
@@ -18,16 +18,16 @@ verify.syntacticClassificationsAre(
18
c.jsxText(`
19
some jsx text
20
`),
21
- c.punctuation("</"), c.jsxCloseTagName("div"), c.punctuation(">"), c.punctuation(";"),
+ c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div"), c.punctuation(">"), c.punctuation(";"),
22
c.keyword("let"), c.identifier("y"), c.operator("="),
23
c.punctuation("<"),
24
c.jsxSelfClosingTagName("element"),
25
c.jsxAttribute("attr"), c.operator("="), c.jsxAttributeStringLiteralValue(`"123"`),
26
c.punctuation("/"), c.punctuation(">")
27
)
28
29
-const c2 = classification("2020");
30
-verify.semanticClassificationsAre("2020",
31
- c2.semanticToken("variable.declaration", "x"),
32
- c2.semanticToken("variable.declaration", "y"),
+const c2 = classification("2020");
+verify.semanticClassificationsAre("2020",
+ c2.semanticToken("variable.declaration", "x"),
+ c2.semanticToken("variable.declaration", "y"),
33
);
tests/cases/fourslash/syntacticClassificationsJsx2.ts
- c.punctuation("</"), c.jsxCloseTagName("div.name"), c.punctuation(">"), c.punctuation(";"),
+ c.punctuation("<"), c.punctuation("/"), c.jsxCloseTagName("div.name"), c.punctuation(">"), c.punctuation(";"),
c.jsxSelfClosingTagName("element.name"),
0 commit comments