@@ -124,9 +124,9 @@ const compareMethodSnippetAgainstMarker = (inputMarkers: number[], marker: numbe
124
124
expect ( Array . isArray ( expected ) ? methodSnippet : snippetToInsert , `At marker ${ marker } ` ) . toEqual ( expected )
125
125
}
126
126
127
- const assertCompletionInsertText = ( marker : number , entryName : string | undefined , insertTextExpected : string ) => {
127
+ const assertCompletionInsertText = ( marker : number , entryPredicate : string | undefined | number , insertTextExpected : string ) => {
128
128
const { entries } = getCompletionsAtPosition ( currentTestingContext . markers [ marker ] ! ) !
129
- const entry = entryName === undefined ? entries [ 0 ] : entries . find ( ( { name } ) => name === entryName )
129
+ const entry = typeof entryPredicate === 'string' ? entries . find ( ( { name } ) => name === entryPredicate ) : entries [ entryPredicate ?? 0 ]
130
130
expect ( entry ?. insertText ) . toEqual ( insertTextExpected )
131
131
}
132
132
@@ -293,7 +293,7 @@ describe('Method snippets', () => {
293
293
compareMethodSnippetAgainstMarker ( markers , 2 , 'ambiguous' )
294
294
} )
295
295
296
- test ( 'methodSnippetsInsertText all' , ( ) => {
296
+ test . only ( 'methodSnippetsInsertText all' , ( ) => {
297
297
overrideSettings ( {
298
298
methodSnippetsInsertText : 'all' ,
299
299
} )
@@ -306,9 +306,14 @@ describe('Method snippets', () => {
306
306
test/*2*/
307
307
}
308
308
}
309
+
310
+ const b: { a() } = {
311
+ /*3*/
312
+ }
309
313
` )
310
314
assertCompletionInsertText ( 1 , 'a' , 'a(${1:a}, ${2:b})' )
311
315
assertCompletionInsertText ( 2 , 'test' , 'this.test()' )
316
+ assertCompletionInsertText ( 3 , 1 , 'a() {\n$0\n},' )
312
317
} )
313
318
} )
314
319
@@ -602,7 +607,7 @@ test('Object Literal Completions', () => {
602
607
/*1*/
603
608
})
604
609
605
- const somethingWithUntions : { a: string } | { a: any[], b: string } = {/*2*/}
610
+ const somethingWithUnions : { a: string } | { a: any[], b: string } = {/*2*/}
606
611
607
612
makeDay({
608
613
additionalOptions: {
@@ -673,7 +678,7 @@ test('Object Literal Completions', () => {
673
678
"name": "callback",
674
679
},
675
680
{
676
- "insertText": "callback() {\\\\n $0\\\\n},",
681
+ "insertText": "callback() {\\\\n$0\\\\n},",
677
682
"isSnippet": true,
678
683
"kind": "method",
679
684
"kindModifiers": "optional",
@@ -738,7 +743,7 @@ test('Object Literal Completions with keepOriginal: remove & builtin method snip
738
743
` )
739
744
completion ( 1 , {
740
745
exact : {
741
- insertTexts : [ 'a: {\n\t$1\n},$0' , 'onA() {\n $0\n},' ] ,
746
+ insertTexts : [ 'a: {\n\t$1\n},$0' , 'onA() {\n$0\n},' ] ,
742
747
all : {
743
748
isSnippet : true ,
744
749
} ,
0 commit comments