diff --git a/src/services/completions.ts b/src/services/completions.ts index 210524b95dd..ef0be7f0fd6 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1392,7 +1392,9 @@ function createCompletionEntry( sortText = SortText.SortBelow(sortText); } - if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") { + if (isJsxIdentifierExpected && !isRightOfOpenTag + && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle + && preferences.jsxAttributeCompletionStyle !== "none" && !(isJsxAttribute(location.parent) && location.parent.initializer)) { let useBraces = preferences.jsxAttributeCompletionStyle === "braces"; const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); diff --git a/tests/cases/fourslash/jsxTagNameCompletionWithExistingJsxInitializer.ts b/tests/cases/fourslash/jsxTagNameCompletionWithExistingJsxInitializer.ts new file mode 100644 index 00000000000..49e9fa6373c --- /dev/null +++ b/tests/cases/fourslash/jsxTagNameCompletionWithExistingJsxInitializer.ts @@ -0,0 +1,27 @@ +/// + +// @filename: /foo.tsx +////declare namespace JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// foo: { +//// className: string; +//// } +//// } +////} +//// + +verify.completions({ + marker: "", + includes: { + name: "className", + text: "(property) className: string", + insertText: undefined, + isSnippet: undefined, + }, + preferences: { + jsxAttributeCompletionStyle: "braces", + includeCompletionsWithSnippetText: true, + includeCompletionsWithInsertText: true, + }, +})