mirror of
https://github.com/neovim/neovim.git
synced 2026-08-30 11:02:01 +00:00
docs: misc, lsp
Problem:
This doc on `vim.lsp.completion.get()`:
--- Used by the default LSP |omnicompletion| provider |vim.lsp.omnifunc()|, thus |i_CTRL-X_CTRL-O|
--- invokes this in LSP-enabled buffers. Use CTRL-Y to select an item from the completion menu.
--- |complete_CTRL-Y|
...makes two wrong claims:
1. "Used by the default LSP omnicompletion provider vim.lsp.omnifunc()"
- `_omnifunc` does not call `M.get()`, it calls the internal `trigger()` directly.
2. "thus |i_CTRL-X_CTRL-O| invokes this in LSP-enabled buffers"
- The two paths use different client sets:
- `M.get()` reads `buf_handles[bufnr].clients` (clients
explicitly registered via `vim.lsp.completion.enable(true, ...)`).
- `_omnifunc` reads `lsp.get_clients({method='textDocument/completion'})` (every
completion client, regardless of `enable()`).
Solution:
Update docs.
Co-authored-by: Koichi Shiraishi <zchee.io@gmail.com>
Co-authored-by: y9san9 / Alex Sokol <y9san9@gmail.com>
Co-authored-by: adv0r <>
This commit is contained in:
@@ -1211,7 +1211,11 @@ end
|
||||
---
|
||||
--- Examples: |lsp-attach| |lsp-completion|
|
||||
---
|
||||
--- Note: the behavior of `autotrigger=true` is controlled by the LSP `triggerCharacters` field. You
|
||||
--- @note |vim.lsp.omnifunc()| (|i_CTRL-X_CTRL-O|) queries every client that advertises completion,
|
||||
--- including clients that were disabled by `enable(false)`. To suppress completions for a client,
|
||||
--- clear its capability on |LspAttach|: `client.server_capabilities.completionProvider = nil`.
|
||||
---
|
||||
--- @note 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
|
||||
@@ -1235,9 +1239,7 @@ end
|
||||
--- Triggers LSP completion once in the current buffer, if LSP completion is enabled
|
||||
--- (see |lsp-attach| |lsp-completion|).
|
||||
---
|
||||
--- Used by the default LSP |omnicompletion| provider |vim.lsp.omnifunc()|, thus |i_CTRL-X_CTRL-O|
|
||||
--- invokes this in LSP-enabled buffers. Use CTRL-Y to select an item from the completion menu.
|
||||
--- |complete_CTRL-Y|
|
||||
--- Use CTRL-Y to select an item from the completion menu. |complete_CTRL-Y|
|
||||
---
|
||||
--- To invoke manually with CTRL-space, use this mapping:
|
||||
--- ```lua
|
||||
|
||||
Reference in New Issue
Block a user