Repository navigation
Todo
Description
What
Completion commit characters are characters that accept the selected completion item and are then typed as usual. For example, . or ( after a function name. There are three sources:
CompletionItem.commitCharacters, per item. The client announces it withtextDocument.completion.completionItem.commitCharactersSupport.CompletionOptions.allCommitCharacters(3.2), for all items of the server.CompletionList.itemDefaults.commitCharacters(3.17), announced incompletionList.itemDefaults.
The spec: "If present, this will override allCommitCharacters." Since 3.18, CompletionList.applyKind can merge the two instead.
Why
- typescript-language-server: sends per-item
commitCharacterswhen the client setscommitCharactersSupport(src/lsp-server.ts,src/completion.ts). It moves them toitemDefaultswhen the client supports that. - Pyright and basedpyright: read
commitCharactersSupport(languageServerBase.ts). - Dart: behind
dart.previewCommitCharacters, which is in LSP4IJ's own dart-lsp template (templates/lsp/dart-lsp/settings.schema.json).
What users miss: typing foo. or foo( with the lookup open keeps the typed prefix and closes or refilters the lookup, instead of accepting fooBar and going on.
Today
commitCharactersSupportis not announced (ClientCapabilitiesFactory.java#L169-L179).completionList.itemDefaultslists onlyeditRange(#L182).itemDefaults.commitCharactersis copied onto the items (LSPCompletionContributor.java#L262-L265), but nothing readsgetCommitCharacters()after that.allCommitCharactersis not read anywhere.- There is no
lookup.charFilterin LSP4IJ.
How it could be done
- Add a
CharFilter(extension pointcom.intellij.lookup.charFilter, both versions). InacceptChar(c, prefixLength, lookup), when the current item is anLSPCompletionProposalandcis one of its commit characters, returnResult.SELECT_ITEM_AND_FINISH_LOOKUP. The item's own list wins overitemDefaultsandallCommitCharacters, as the spec says. Otherwise returnnullso that the other filters decide. - Commit only when the lookup is focused (
Lookup.isFocused()). VS Code also commits only a suggestion that the user has selected. This avoids committing an item that the auto-popup merely shows while the user types. handleInsertcan see the character withcontext.getCompletionChar(). Check that the typed character is inserted once, after the item, and that a snippet template still starts.- Announce
commitCharactersSupport: true, and addcommitCharacterstocompletionList.itemDefaults. - Possibly a client setting to turn it off per server, as Dart offers on its side.
Test
Fixture tests:
.with a focused LSP item that hascommitCharacters: ["."];- the same with the lookup unfocused;
allCommitCharactersonly;itemDefaults.commitCharactersoverridden by an item's own list.
Activity
cordeirops commentedon Nov 26, 2026
Hi! I'd like to work on this. Please /assign
Before I start, I checked the servers listed in the issue:
(addExtraCommitChar is a no-op, only Pylance overrides it).
IntelliJ's DefaultCharFilter already accepts the selected item for . , ; = space : ( when
the lookup is focused, so I can't see a difference from this change with any of them.
Do you have a server and a character (not in that list) where the current behavior is wrong,
and should characters that the server doesn't list stop committing?
Thanks!
feat: LSP4IJ announces the completion features it handles: deprecated…
lagergren commentedon Dec 1, 2026
@cordeirops Thanks for checking. You're right: with a focused lookup, IntelliJ's own
DefaultCharFilteralready accepts the selected item on.,;=space:(. So with typescript-language-server and Dart there is no visible difference, and I don't know of a server today that lists a character outside that set.What would still be worth doing:
commitCharactersSupportanditemDefaults.commitCharacters, so that servers which wait for them send them.[,<,{or", would then accept the selected item. As in the issue, only with a focused lookup.To your second question: no, characters that the server doesn't list should keep committing. IntelliJ users expect its own commit characters in every language, so LSP4IJ would only add the server's characters, never remove IntelliJ's.
If that scope works for you, please take it, it's yours.