From 8a7e1b19b9bf6cf3d081ca9d87bbe0045f93d556 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 26 Mar 2025 05:49:48 -0700 Subject: docs: news, lsp autocomplete #33047 --- runtime/lua/vim/lsp/completion.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua index 9345cb8d83..4f16d4173a 100644 --- a/runtime/lua/vim/lsp/completion.lua +++ b/runtime/lua/vim/lsp/completion.lua @@ -22,6 +22,14 @@ --- end, --- }) --- ``` +--- +--- [lsp-autocompletion]() +--- +--- The LSP `triggerCharacters` field decides when to trigger autocompletion. If you want to trigger +--- on EVERY keypress you can either: +--- - Extend `client.server_capabilities.completionProvider.triggerCharacters` on `LspAttach`, +--- before you call `vim.lsp.completion.enable(… {autotrigger=true})`. See the |lsp-attach| example. +--- - Call `vim.lsp.completion.get()` from the handler described at |compl-autocomplete|. local M = {} @@ -781,6 +789,9 @@ end --- Enables or disables completions from the given language client in the given buffer. --- 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 |lsp-autocompletion|. +--- --- @param enable boolean True to enable, false to disable --- @param client_id integer Client ID --- @param bufnr integer Buffer handle, or 0 for the current buffer -- cgit