Skip to content

Commit

Permalink
fix: only try to execute lsp command when server supports it
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Oct 19, 2024
1 parent 4b76eda commit d360854
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions lua/care/menu/confirm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ return function(entry)
vim.lsp.util.apply_text_edits(completion_item.additionalTextEdits, cur_ctx.bufnr, "utf-16")
end

if completion_item.command then
---@diagnostic disable-next-line: param-type-mismatch
vim.lsp.buf.execute_command(completion_item.command)
end

if entry.source.execute then
entry.source:execute(entry)
end
Expand Down
5 changes: 5 additions & 0 deletions lua/care/sources/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ function lsp_source.new(client)
end
end)
end or nil,
execute = (client.server_capabilities.executeCommandProvider and function(_, entry)
if entry.completion_item.command then
vim.lsp.buf.execute_command(entry.completion_item.command)
end
end or nil),
}
return source
end
Expand Down

0 comments on commit d360854

Please sign in to comment.