File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,30 @@ describe('server', () => {
316
316
expect ( result ) . toEqual ( [ ] )
317
317
} )
318
318
319
+ it ( 'responds to onCompletion with empty list when word is {' , async ( ) => {
320
+ const { connection, server } = await initializeServer ( )
321
+ server . register ( connection )
322
+
323
+ const onCompletion = connection . onCompletion . mock . calls [ 0 ] [ 0 ]
324
+
325
+ const result = await onCompletion (
326
+ {
327
+ textDocument : {
328
+ uri : FIXTURE_URI . ISSUE101 ,
329
+ } ,
330
+ position : {
331
+ // the opening brace '{' to 'add_a_user'
332
+ line : 4 ,
333
+ character : 0 ,
334
+ } ,
335
+ } ,
336
+ { } as any ,
337
+ { } as any ,
338
+ )
339
+
340
+ expect ( result ) . toEqual ( [ ] )
341
+ } )
342
+
319
343
it ( 'responds to onCompletion when word is found in another file' , async ( ) => {
320
344
const { connection, server } = await initializeServer ( )
321
345
server . register ( connection )
Original file line number Diff line number Diff line change @@ -316,6 +316,12 @@ export default class BashServer {
316
316
// Inside a comment block
317
317
return [ ]
318
318
}
319
+ if ( word && word === '{' ) {
320
+ // We should not complete when it is not prefixed by a $.
321
+ // This case needs to be here
322
+ // because { is a completionProvider triggerCharacter.
323
+ return [ ]
324
+ }
319
325
320
326
const currentUri = params . textDocument . uri
321
327
You can’t perform that action at this time.
0 commit comments