File tree 2 files changed +34
-1
lines changed
2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -740,7 +740,12 @@ namespace ts.Completions {
740
740
}
741
741
742
742
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" ) {
744
749
let useBraces = preferences . jsxAttributeCompletionStyle === "braces" ;
745
750
const type = typeChecker . getTypeOfSymbolAtLocation ( symbol , location ) ;
746
751
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