File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,8 @@ export default (
3737 jsxAttributeCandidate = true
3838 node = node . parent
3939 }
40- if ( jsxAttributeCandidate ) {
41- if (
42- sharedCompletionContext . c ( 'improveJsxCompletions' ) &&
43- Object . keys ( jsxCompletionsMap ) . length > 0 &&
44- ( ts . isJsxOpeningElement ( node ) || ts . isJsxSelfClosingElement ( node ) )
45- ) {
40+ if ( jsxAttributeCandidate && ( ts . isJsxOpeningElement ( node ) || ts . isJsxSelfClosingElement ( node ) ) ) {
41+ if ( sharedCompletionContext . c ( 'improveJsxCompletions' ) && Object . keys ( jsxCompletionsMap ) . length > 0 ) {
4642 const tagName = node . tagName . getText ( )
4743 // TODO use the same perf optimization for replaceSuggestions
4844 const patchEntries : Record < number , Configuration [ 'jsxCompletionsMap' ] [ string ] > = { }
Original file line number Diff line number Diff line change @@ -499,6 +499,7 @@ test('Case-sensetive completions', () => {
499499test ( 'Fix properties sorting' , ( ) => {
500500 overrideSettings ( {
501501 fixSuggestionsSorting : true ,
502+ 'jsxAttributeShortcutCompletions.enable' : 'disable' ,
502503 } )
503504 fourslashLikeTester ( /* tsx */ `
504505 let a: {
@@ -613,6 +614,23 @@ test('Tuple signature', () => {
613614 } )
614615} )
615616
617+ test ( 'JSX attribute shortcut completions' , ( ) => {
618+ const tester = fourslashLikeTester ( /* tsx */ `
619+ const A = ({a, b}) => {}
620+ const a = 5
621+ const c = <A /*1*/ />
622+ const d = <A a={/*2*/} />
623+ ` )
624+ tester . completion ( 1 , {
625+ exact : {
626+ names : [ 'a' , 'a={a}' , 'b' ] ,
627+ } ,
628+ } )
629+ tester . completion ( 2 , {
630+ excludes : [ 'a={a}' ] ,
631+ } )
632+ } )
633+
616634test ( 'Object Literal Completions' , ( ) => {
617635 const [ _positivePositions , _negativePositions , numPositions ] = fileContentsSpecialPositions ( /* ts */ `
618636 interface Options {
You can’t perform that action at this time.
0 commit comments