File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -740,7 +740,12 @@ namespace ts.Completions {
740740 }
741741
742742 const kind = SymbolDisplay . getSymbolKind ( typeChecker , symbol , location ) ;
743- if ( kind === ScriptElementKind . jsxAttribute && preferences . includeCompletionsWithSnippetText && preferences . jsxAttributeCompletionStyle && preferences . jsxAttributeCompletionStyle !== "none" ) {
743+ if (
744+ kind === ScriptElementKind . jsxAttribute
745+ && ( location . kind !== SyntaxKind . LessThanToken || location . pos !== location . parent . pos ) // Disable snippet for the first attribute, which is actually the tag name.
746+ && preferences . includeCompletionsWithSnippetText
747+ && preferences . jsxAttributeCompletionStyle
748+ && preferences . jsxAttributeCompletionStyle !== "none" ) {
744749 let useBraces = preferences . jsxAttributeCompletionStyle === "braces" ;
745750 const type = typeChecker . getTypeOfSymbolAtLocation ( symbol , location ) ;
746751
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts" />
2+ //@Filename : file.tsx
3+ ////declare namespace JSX {
4+ //// interface IntrinsicElements {
5+ //// button: any;
6+ //// div: any;
7+ //// }
8+ //// }
9+ ////function fn() {
10+ //// return <>
11+ //// <butto/*1*/
12+ //// </>;
13+ //// }
14+
15+
16+ verify . completions (
17+ {
18+ marker : "1" ,
19+ includes : [
20+ { name : "button" , insertText : undefined , isSnippet : undefined }
21+ ] ,
22+ preferences : {
23+ jsxAttributeCompletionStyle : "braces" ,
24+ includeCompletionsWithSnippetText : true ,
25+ includeCompletionsWithInsertText : true ,
26+ }
27+ } ,
28+ ) ;
You can’t perform that action at this time.
0 commit comments