Skip to content

lsp: Adjust completion range to replace based on server data

Waqar Ahmed requested to merge work/completion-textedit into master

Some server send over completion's for a range whose start is before the position we requested completion for e.g.,

import package:mypackage/[Cursor]

The server might send in a completion "package:mypackage..." for a range that starts right after "import". With our current implementation we end up having something like:

import package:mypackage/package:mypackage/somefile[Cursor]

If the server sent a CompletionItem.textEdit.range and that range's start is different than what we have, perfer the server. This leads to better completion because the server might be supplying items for a bigger range than just the current word under cursor.

Tested with 2 servers dart and clangd and haven't noticed any odd behaviour in the last 2 days.

Merge request reports

Loading