aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2025-03-26 14:43:40 +0100
committerGitHub <noreply@github.com>2025-03-26 06:43:40 -0700
commit6566b66f65a2b96061b42cdc48ea27ad7cd00973 (patch)
tree57b15fd128bfaad3bc04a4d936bc2c4986f923d9
parent8a7e1b19b9bf6cf3d081ca9d87bbe0045f93d556 (diff)
downloadrneovim-6566b66f65a2b96061b42cdc48ea27ad7cd00973.tar.gz
rneovim-6566b66f65a2b96061b42cdc48ea27ad7cd00973.tar.bz2
rneovim-6566b66f65a2b96061b42cdc48ea27ad7cd00973.zip
docs(lsp): completion.enable #33063
-rw-r--r--runtime/doc/lsp.txt10
-rw-r--r--runtime/lua/vim/lsp/completion.lua12
2 files changed, 20 insertions, 2 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index e77ad5dcf3..6d232657c9 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -1900,7 +1900,15 @@ you want to trigger on EVERY keypress you can either:
*vim.lsp.completion.enable()*
enable({enable}, {client_id}, {bufnr}, {opts})
Enables or disables completions from the given language client in the
- given buffer. Example: |lsp-attach| |lsp-completion|
+ given buffer. Effects of enabling completions are:
+ • Calling |vim.lsp.completion.get()| uses the enabled clients to retrieve
+ completion candidates
+ • Accepting a completion candidate using `<c-y>` applies side effects like
+ expanding snippets, text edits (e.g. insert import statements) and
+ executing associated commands. This works for completions triggered via
+ autotrigger, omnifunc or completion.get()
+
+ Example: |lsp-attach| |lsp-completion|
Note: the behavior of `autotrigger=true` is controlled by the LSP
`triggerCharacters` field. You can override it on LspAttach, see
diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua
index 4f16d4173a..77cd30c87b 100644
--- a/runtime/lua/vim/lsp/completion.lua
+++ b/runtime/lua/vim/lsp/completion.lua
@@ -786,7 +786,17 @@ local function disable_completions(client_id, bufnr)
end
end
---- Enables or disables completions from the given language client in the given buffer.
+--- Enables or disables completions from the given language client in the given
+--- buffer. Effects of enabling completions are:
+---
+--- - Calling |vim.lsp.completion.get()| uses the enabled clients to retrieve
+--- completion candidates
+---
+--- - Accepting a completion candidate using `<c-y>` applies side effects like
+--- expanding snippets, text edits (e.g. insert import statements) and
+--- executing associated commands. This works for completions triggered via
+--- autotrigger, omnifunc or completion.get()
+---
--- Example: |lsp-attach| |lsp-completion|
---
--- Note: the behavior of `autotrigger=true` is controlled by the LSP `triggerCharacters` field. You