@@ -527,21 +527,38 @@ test('Fix properties sorting', () => {
527
527
a.b({/*2*/})./*3*/
528
528
}
529
529
530
- declare function MyComponent(props: { b?; c? } & { a? }): JSX.Element
531
- <MyComponent /*4*/ />;
532
-
533
530
let a: { b:{}, a() } = {
534
531
/*5*/
535
532
}
533
+
534
+ declare function MyComponent(props: { b?; c? } & { a? }): JSX.Element
535
+ <MyComponent /*4*/ />;
536
+ <MyComponent
537
+ c=''
538
+ /*41*/
539
+ />;
540
+ <MyComponent
541
+ test2=''
542
+ /*41*/
543
+ test=''
544
+ />;
545
+ <MyComponent /*42*/
546
+ test2=''
547
+ />;
536
548
` )
537
549
const assertSorted = ( marker : number , expected : string [ ] ) => {
538
550
const { entriesSorted } = getCompletionsAtPosition ( currentTestingContext . markers [ marker ] ! ) !
539
- expect ( entriesSorted . map ( x => x . name ) ) . toEqual ( expected )
551
+ expect (
552
+ entriesSorted . map ( x => x . name ) ,
553
+ `${ marker } ` ,
554
+ ) . toEqual ( expected )
540
555
}
541
556
assertSorted ( 1 , [ 'c' , 'b' ] )
542
557
assertSorted ( 2 , [ 'c' , 'b' ] )
543
558
assertSorted ( 3 , [ 'c' , 'b' ] )
544
559
assertSorted ( 4 , [ 'b' , 'c' , 'a' ] )
560
+ assertSorted ( 41 , [ 'b' , 'c' , 'a' ] )
561
+ assertSorted ( 42 , [ 'b' , 'c' , 'a' ] )
545
562
assertSorted ( 5 , [ 'b' , 'b' , 'a' , 'a' ] )
546
563
settingsOverride . fixSuggestionsSorting = false
547
564
} )
@@ -570,11 +587,36 @@ testTs5('Change to function kind', () => {
570
587
} )
571
588
572
589
testTs5 ( 'Filter JSX Components' , ( ) => {
573
- const tester = fourslashLikeTester ( /* ts */ `
574
- const a = () => {}
575
- a/*1*/
590
+ overrideSettings ( {
591
+ // improveJsxCompletions: false,
592
+ 'experiments.excludeNonJsxCompletions' : true ,
593
+ } )
594
+ const tester = fourslashLikeTester ( /* tsx */ `
595
+ const someFunction = () => {}
596
+ declare namespace JSX {
597
+ interface IntrinsicElements {
598
+ superSpan: any;
599
+ }
600
+ }
601
+ // return < // TODO
602
+ return <s/*1*/
603
+ ` )
604
+ tester . completion ( 1 , {
605
+ excludes : [ 'someFunction' ] ,
606
+ includes : {
607
+ names : [ 'superSpan' ] ,
608
+ } ,
609
+ } )
610
+ // https://github.com/zardoy/typescript-vscode-plugins/issues/205
611
+ const tester2 = fourslashLikeTester ( /* tsx */ `
612
+ const Img = ({ alt }) => {}
613
+ <Img\n\t/*1*/\n/>
576
614
` )
577
- // TODO
615
+ tester2 . completion ( 1 , {
616
+ includes : {
617
+ names : [ 'alt' ] ,
618
+ } ,
619
+ } )
578
620
} )
579
621
580
622
test ( 'Omit<..., ""> suggestions' , ( ) => {
0 commit comments