Skip to content

Commit 7f03765

Browse files
committed
Remove duplicated completions for executables and builtins
1 parent 1745e77 commit 7f03765

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

server/src/server.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,19 @@ export default class BashServer {
234234
},
235235
}))
236236

237-
const programCompletions = this.executables.list().map((s: string) => {
238-
return {
239-
label: s,
240-
kind: LSP.SymbolKind.Function,
241-
data: {
242-
name: s,
243-
type: CompletionItemDataType.Executable,
244-
},
245-
}
246-
})
237+
const programCompletions = this.executables
238+
.list()
239+
.filter(executable => !Builtins.isBuiltin(executable))
240+
.map(executable => {
241+
return {
242+
label: executable,
243+
kind: LSP.SymbolKind.Function,
244+
data: {
245+
name: executable,
246+
type: CompletionItemDataType.Executable,
247+
},
248+
}
249+
})
247250

248251
const builtinsCompletions = Builtins.LIST.map(builtin => ({
249252
label: builtin,
@@ -254,7 +257,6 @@ export default class BashServer {
254257
},
255258
}))
256259

257-
// TODO: we have duplicates here (e.g. echo is both a builtin AND have a man page)
258260
const allCompletions = [
259261
...reservedWordsCompletions,
260262
...symbolCompletions,

0 commit comments

Comments
 (0)