@@ -124,9 +124,9 @@ const compareMethodSnippetAgainstMarker = (inputMarkers: number[], marker: numbe
124124 expect ( Array . isArray ( expected ) ? methodSnippet : snippetToInsert , `At marker ${ marker } ` ) . toEqual ( expected )
125125}
126126
127- const assertCompletionInsertText = ( marker : number , entryName : string | undefined , insertTextExpected : string ) => {
127+ const assertCompletionInsertText = ( marker : number , entryPredicate : string | undefined | number , insertTextExpected : string ) => {
128128 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 ]
130130 expect ( entry ?. insertText ) . toEqual ( insertTextExpected )
131131}
132132
@@ -293,7 +293,7 @@ describe('Method snippets', () => {
293293 compareMethodSnippetAgainstMarker ( markers , 2 , 'ambiguous' )
294294 } )
295295
296- test ( 'methodSnippetsInsertText all' , ( ) => {
296+ test . only ( 'methodSnippetsInsertText all' , ( ) => {
297297 overrideSettings ( {
298298 methodSnippetsInsertText : 'all' ,
299299 } )
@@ -306,9 +306,14 @@ describe('Method snippets', () => {
306306 test/*2*/
307307 }
308308 }
309+
310+ const b: { a() } = {
311+ /*3*/
312+ }
309313 ` )
310314 assertCompletionInsertText ( 1 , 'a' , 'a(${1:a}, ${2:b})' )
311315 assertCompletionInsertText ( 2 , 'test' , 'this.test()' )
316+ assertCompletionInsertText ( 3 , 1 , 'a() {\n$0\n},' )
312317 } )
313318} )
314319
@@ -602,7 +607,7 @@ test('Object Literal Completions', () => {
602607 /*1*/
603608 })
604609
605- const somethingWithUntions : { a: string } | { a: any[], b: string } = {/*2*/}
610+ const somethingWithUnions : { a: string } | { a: any[], b: string } = {/*2*/}
606611
607612 makeDay({
608613 additionalOptions: {
@@ -673,7 +678,7 @@ test('Object Literal Completions', () => {
673678 "name": "callback",
674679 },
675680 {
676- "insertText": "callback() {\\\\n $0\\\\n},",
681+ "insertText": "callback() {\\\\n$0\\\\n},",
677682 "isSnippet": true,
678683 "kind": "method",
679684 "kindModifiers": "optional",
@@ -738,7 +743,7 @@ test('Object Literal Completions with keepOriginal: remove & builtin method snip
738743 ` )
739744 completion ( 1 , {
740745 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},' ] ,
742747 all : {
743748 isSnippet : true ,
744749 } ,
0 commit comments