aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorRaphael <glephunter@gmail.com>2023-08-11 20:20:05 +0800
committerGitHub <noreply@github.com>2023-08-11 05:20:05 -0700
commit72e64a1afef0df1bd244bfb31dfc8619d91ff709 (patch)
tree0b82ea0a6077fcbb0a3b4dc48f9e62c0450799ff /runtime/lua/vim/lsp.lua
parent3d948a4dc4b2cd3c8d3ac497caf3dfe25adfb90d (diff)
downloadrneovim-72e64a1afef0df1bd244bfb31dfc8619d91ff709.tar.gz
rneovim-72e64a1afef0df1bd244bfb31dfc8619d91ff709.tar.bz2
rneovim-72e64a1afef0df1bd244bfb31dfc8619d91ff709.zip
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: https://github.com/neovim/neovim/blob/0ea8dfeb3dc347579753169d9e3588f6306ab703/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
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 0c4290d067..2a16bafbfc 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -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