Skip to content

WIP: LSPClient: respect the "remove tail" auto-completion setting

Ahmad Samir requested to merge work/ahmad/tail into master

The default implementaton of CodeCompletionModelControllerInterface::completionRange() returns a ranges containing the whole word the cursor is inside, which means that when one selects a completion, it will replace the whole word the cursor is inside.

However the KateWordCompletionModel::completionRange() implementation only returns a range containing the word left of the cursor, hence the "remove tail on complete" option in the Editing -> Auto Completion tab in the config dialog, which means that if that option is diabled the completion only replaces the word left of the cursor and leaves the rest of the word the cursor is in as is.

So copy the implementation of KateWordCompletionModel::completionRange() to LSPClientCompletion::completionRange() (note that KateProjectCompletion::completionRange() is also a copy of KateWordCompletionModel's implementation), and read the "Word Completion Remove Tail" config option and either use the base CodeCompletionModelControllerInterface implementaion to remove tail or the override to not remove tail.

BUG: 436170

Merge request reports