Skip to content

Commit

Permalink
add option to calculate CompletionItemKind for keywords (#1499)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdietrich authored May 20, 2024
1 parent 75aa73e commit 6971c83
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/langium/src/lsp/completion/completion-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,16 @@ export class DefaultCompletionProvider implements CompletionProvider {
}
acceptor(context, {
label: keyword.value,
kind: CompletionItemKind.Keyword,
kind: this.getKeywordCompletionItemKind(keyword),
detail: 'Keyword',
sortText: '1'
});
}

protected getKeywordCompletionItemKind(_keyword: ast.Keyword): CompletionItemKind {
return CompletionItemKind.Keyword;
}

protected filterKeyword(context: CompletionContext, keyword: ast.Keyword): boolean {
// Filter out keywords that do not contain any word character
return /\p{L}/u.test(keyword.value);
Expand Down

0 comments on commit 6971c83

Please sign in to comment.