Skip to content

Commit b3e84fb

Browse files
authored
Merge pull request #240 from nikita-skobov/fix-brace-expansion-bug
Fix brace expansion bug
2 parents 72ca9de + 2dafe3b commit b3e84fb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

server/src/__tests__/server.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,30 @@ describe('server', () => {
316316
expect(result).toEqual([])
317317
})
318318

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+
319343
it('responds to onCompletion when word is found in another file', async () => {
320344
const { connection, server } = await initializeServer()
321345
server.register(connection)

server/src/server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ export default class BashServer {
316316
// Inside a comment block
317317
return []
318318
}
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+
}
319325

320326
const currentUri = params.textDocument.uri
321327

0 commit comments

Comments
 (0)