Skip to content

Commit

Permalink
feat(lsp): deprecate vim.lsp.buf.completion
Browse files Browse the repository at this point in the history
Use `vim.lsp.completion.trigger()` instead'
  • Loading branch information
lewis6991 committed Oct 24, 2024
1 parent 7a7747f commit 54249d0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions runtime/doc/deprecated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TREESITTER
LSP
*vim.lsp.util.jump_to_location*
*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*
Expand Down
13 changes: 0 additions & 13 deletions runtime/doc/lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1309,19 +1309,6 @@ code_action({opts}) *vim.lsp.buf.code_action()*
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
• 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()*
Jumps to the declaration of the symbol under the cursor.

Expand Down
2 changes: 2 additions & 0 deletions runtime/lua/vim/lsp/buf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ function M.signature_help()
lsp.buf_request(0, ms.textDocument_signatureHelp, client_positional_params())
end

--- @deprecated
--- Retrieves the completion items at the current cursor position. Can only be
--- called in Insert mode.
---
Expand All @@ -200,6 +201,7 @@ end
---
---@see vim.lsp.protocol.CompletionTriggerKind
function M.completion(context)
vim.depends('vim.lsp.buf.completion', 'vim.lsp.commpletion.trigger', '0.12')
return lsp.buf_request(
0,
ms.textDocument_completion,
Expand Down
1 change: 1 addition & 0 deletions runtime/lua/vim/lsp/handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ M[ms.textDocument_formatting] = function(_, result, ctx, _)
util.apply_text_edits(result, ctx.bufnr, client.offset_encoding)
end

--- @deprecated
--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
M[ms.textDocument_completion] = function(_, result, _, _)
if vim.tbl_isempty(result or {}) then
Expand Down

0 comments on commit 54249d0

Please sign in to comment.