feat(lsp): deprecate vim.lsp.buf.completion

Use `vim.lsp.completion.trigger()` instead'
This commit is contained in:
Lewis Russell
2024-10-24 15:43:38 +01:00
committed by Lewis Russell
parent 7a7747f1e4
commit 54249d051c
4 changed files with 4 additions and 13 deletions

View File

@@ -46,6 +46,7 @@ TREESITTER
LSP LSP
• *vim.lsp.util.jump_to_location* • *vim.lsp.util.jump_to_location*
• *vim.lsp.buf.execute_command* Use |Client:exec_cmd()| instead. • *vim.lsp.buf.execute_command* Use |Client:exec_cmd()| instead.
• *vim.lsp.buf.completion* Use |vim.lsp.completion.trigger()| instead.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
DEPRECATED IN 0.10 *deprecated-0.10* DEPRECATED IN 0.10 *deprecated-0.10*

View File

@@ -1309,19 +1309,6 @@ code_action({opts}) *vim.lsp.buf.code_action()*
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
• vim.lsp.protocol.CodeActionTriggerKind • vim.lsp.protocol.CodeActionTriggerKind
completion({context}) *vim.lsp.buf.completion()*
Retrieves the completion items at the current cursor position. Can only be
called in Insert mode.
Parameters: ~
• {context} (`table`) (context support not yet implemented) Additional
information about the context in which a completion was
triggered (how it was triggered, and by which trigger
character, if applicable)
See also: ~
• vim.lsp.protocol.CompletionTriggerKind
declaration({opts}) *vim.lsp.buf.declaration()* declaration({opts}) *vim.lsp.buf.declaration()*
Jumps to the declaration of the symbol under the cursor. Jumps to the declaration of the symbol under the cursor.

View File

@@ -191,6 +191,7 @@ function M.signature_help()
lsp.buf_request(0, ms.textDocument_signatureHelp, client_positional_params()) lsp.buf_request(0, ms.textDocument_signatureHelp, client_positional_params())
end end
--- @deprecated
--- Retrieves the completion items at the current cursor position. Can only be --- Retrieves the completion items at the current cursor position. Can only be
--- called in Insert mode. --- called in Insert mode.
--- ---
@@ -200,6 +201,7 @@ end
--- ---
---@see vim.lsp.protocol.CompletionTriggerKind ---@see vim.lsp.protocol.CompletionTriggerKind
function M.completion(context) function M.completion(context)
vim.depends('vim.lsp.buf.completion', 'vim.lsp.commpletion.trigger', '0.12')
return lsp.buf_request( return lsp.buf_request(
0, 0,
ms.textDocument_completion, ms.textDocument_completion,

View File

@@ -317,6 +317,7 @@ M[ms.textDocument_formatting] = function(_, result, ctx, _)
util.apply_text_edits(result, ctx.bufnr, client.offset_encoding) util.apply_text_edits(result, ctx.bufnr, client.offset_encoding)
end end
--- @deprecated
--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion --- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
M[ms.textDocument_completion] = function(_, result, _, _) M[ms.textDocument_completion] = function(_, result, _, _)
if vim.tbl_isempty(result or {}) then if vim.tbl_isempty(result or {}) then