mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
fix(51077): skip insertText for jsx attribute with existing initializer (#51093)
This commit is contained in:
parent
f3d55db45a
commit
1f32fef5a2
@ -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);
|
||||
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @filename: /foo.tsx
|
||||
////declare namespace JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// foo: {
|
||||
//// className: string;
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
////<foo cl/**/={""} />
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
includes: {
|
||||
name: "className",
|
||||
text: "(property) className: string",
|
||||
insertText: undefined,
|
||||
isSnippet: undefined,
|
||||
},
|
||||
preferences: {
|
||||
jsxAttributeCompletionStyle: "braces",
|
||||
includeCompletionsWithSnippetText: true,
|
||||
includeCompletionsWithInsertText: true,
|
||||
},
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user