diff --git a/src/services/completions.ts b/src/services/completions.ts index 4193e651a037f..f8cd16953ef29 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -2898,7 +2898,8 @@ function getCompletionData( // First case is for `
` or `
`, // `parent` will be `{true}` and `previousToken` will be `}` // Second case is for `
` - if (previousToken.kind === SyntaxKind.CloseBraceToken || (previousToken.kind === SyntaxKind.Identifier || previousToken.parent.kind === SyntaxKind.JsxAttribute)) { + // Second case must not match for `
` + if (previousToken.kind === SyntaxKind.CloseBraceToken || (previousToken.kind === SyntaxKind.Identifier && previousToken.parent.kind === SyntaxKind.JsxAttribute)) { isJsxIdentifierExpected = true; } break; diff --git a/src/testRunner/tests.ts b/src/testRunner/tests.ts index b177391f8ce95..01f8bd7465b15 100644 --- a/src/testRunner/tests.ts +++ b/src/testRunner/tests.ts @@ -190,4 +190,4 @@ import "./unittests/tsserver/typingsInstaller"; import "./unittests/tsserver/versionCache"; import "./unittests/tsserver/watchEnvironment"; import "./unittests/debugDeprecation"; -import "./unittests/tsserver/inconsistentErrorInEditor"; \ No newline at end of file +import "./unittests/tsserver/inconsistentErrorInEditor"; diff --git a/tests/cases/fourslash/completionsJsxExpression.ts b/tests/cases/fourslash/completionsJsxExpression.ts new file mode 100644 index 0000000000000..b21e0d08c37b9 --- /dev/null +++ b/tests/cases/fourslash/completionsJsxExpression.ts @@ -0,0 +1,30 @@ +/// + +// @Filename: /a.tsx +// @jsx: react +//// declare namespace JSX { +//// interface IntrinsicElements { +//// div: { a: string, b: string } +//// } +//// } +//// const value = "test"; +////
+ +verify.completions( + { + marker: "", + isNewIdentifierLocation: false, + preferences: { + includeCompletionsWithSnippetText: true, + includeCompletionsWithInsertText: true, + jsxAttributeCompletionStyle: "auto", + }, + includes: { + name: "value", + kind: "const", + kindModifiers: "", + sortText: completion.SortText.LocationPriority, + insertText: undefined, + }, + }, +); \ No newline at end of file