Skip to content

Fix brace expansion bug #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions server/src/__tests__/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,30 @@ describe('server', () => {
expect(result).toEqual([])
})

it('responds to onCompletion with empty list when word is {', async () => {
const { connection, server } = await initializeServer()
server.register(connection)

const onCompletion = connection.onCompletion.mock.calls[0][0]

const result = await onCompletion(
{
textDocument: {
uri: FIXTURE_URI.ISSUE101,
},
position: {
// the opening brace '{' to 'add_a_user'
line: 4,
character: 0,
},
},
{} as any,
{} as any,
)

expect(result).toEqual([])
})

it('responds to onCompletion when word is found in another file', async () => {
const { connection, server } = await initializeServer()
server.register(connection)
Expand Down
6 changes: 6 additions & 0 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@ export default class BashServer {
// Inside a comment block
return []
}
if (word && word === '{') {
// We should not complete when it is not prefixed by a $.
// This case needs to be here
// because { is a completionProvider triggerCharacter.
return []
}

const currentUri = params.textDocument.uri

Expand Down