mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
fix(lsp): extra "." when completing with tsserver #24646
Problem:
With tsserver LSP, omni completion after "." inserts an extra "."
Solution:
Apply adjust_start_col() regardless of `filterText`.
adjust_start_col() is explained here:
0ea8dfeb3d/runtime/lua/vim/lsp.lua (L2334-L2351)
The `filterText` field is used in the following situations rather than as
a condition for obtaining column values:
1. Real-time filtering: When the user types characters in the editor, the
language server can use the filterText field to filter the list of
suggestions and only return suggestions that match the typed characters. This
helps to provide more precise recommendations.
2. Fuzzy matching: The filterText field can be used to perform fuzzy matching,
allowing matching in the middle or beginning of input characters, not limited
to prefix matching. This can provide a more flexible code completion
experience.
Inspecting usage of `filtertext` in vim-lsp and coc and lsp-mode:
- vim-lsp uses a `refresh_pattern` to judge filterText as completionitem word
(although I think this is not the correct usage).
- coc uses it for filtering.
Fix #22803
This commit is contained in:
parent
3d948a4dc4
commit
72e64a1afe
@ -2262,7 +2262,7 @@ end
|
||||
local function adjust_start_col(lnum, line, items, encoding)
|
||||
local min_start_char = nil
|
||||
for _, item in pairs(items) do
|
||||
if item.filterText == nil and item.textEdit and item.textEdit.range.start.line == lnum - 1 then
|
||||
if item.textEdit and item.textEdit.range.start.line == lnum - 1 then
|
||||
if min_start_char and min_start_char ~= item.textEdit.range.start.character then
|
||||
return nil
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user