mirror of
https://github.com/neovim/neovim.git
synced 2026-07-12 20:30:35 +00:00
feat(completion): completeopt=preselect, LSP CompletionItem.preselect #36613
Problem: LSP CompletionItem.preselect is not supported. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionClientCapabilities Solution: - Add "preselect" field to complete-items and "preselect" flag to 'completeopt'. - Set preselectSupport=true in LSP client capabilities.
This commit is contained in:
8
runtime/lua/vim/_meta/options.lua
generated
8
runtime/lua/vim/_meta/options.lua
generated
@@ -1218,8 +1218,12 @@ vim.go.cia = vim.go.completeitemalign
|
||||
--- completion in the preview window. Only works in
|
||||
--- combination with "menu" or "menuone".
|
||||
---
|
||||
--- Only "fuzzy", "longest", "popup", "preinsert" and "preview" have an
|
||||
--- effect when 'autocomplete' is enabled.
|
||||
--- preselect Select the completion item that has the "preselect"
|
||||
--- attribute set. If both "noselect" and "preselect" are present,
|
||||
--- "preselect" takes precedence.
|
||||
---
|
||||
--- Only "fuzzy", "longest", "popup", "preinsert", "preselect" and
|
||||
--- "preview" have an effect when 'autocomplete' is enabled.
|
||||
---
|
||||
--- This option does not apply to `cmdline-completion`. See 'wildoptions'
|
||||
--- for that.
|
||||
|
||||
@@ -441,6 +441,7 @@ function M._lsp_to_complete_items(
|
||||
empty = 1,
|
||||
abbr_hlgroup = hl_group,
|
||||
kind_hlgroup = kind_hlgroup,
|
||||
preselect = item.preselect,
|
||||
user_data = {
|
||||
nvim = {
|
||||
lsp = {
|
||||
|
||||
@@ -474,7 +474,7 @@ function protocol.make_client_capabilities()
|
||||
completionItem = {
|
||||
snippetSupport = true,
|
||||
commitCharactersSupport = false,
|
||||
preselectSupport = false,
|
||||
preselectSupport = true,
|
||||
deprecatedSupport = true,
|
||||
documentationFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
|
||||
insertReplaceSupport = true,
|
||||
|
||||
Reference in New Issue
Block a user