Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

fix(capabilities): replace variable #105

Merged
merged 5 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/lspsaga/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ M.code_action_execute = function(client_id, action, ctx)
if
not action.edit
and client
and type(client.resolved_capabilities.code_action) == "table"
and client.resolved_capabilities.code_action.resolveProvider
and type(client.server_capabilities.codeActionProvider) == "table"
and client.server_capabilities.codeActionProvider.resolveProvider
then
client.request("codeAction/resolve", action, function(err, resolved_action)
if err then
Expand Down
2 changes: 1 addition & 1 deletion lua/lspsaga/codeaction/indicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ M.check = function()
vim.lsp.for_each_buffer_client(vim.api.nvim_get_current_buf(), function(client)
if M.servers[current_file] then return end
if
client.resolved_capabilities.code_action
client.server_capabilities.codeActionProvider
and client.supports_method "code_action"
then
M.servers[current_file] = true
Expand Down
2 changes: 1 addition & 1 deletion lua/lspsaga/signaturehelp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local function check_server_support_signaturehelp()
end
local clients = vim.lsp.buf_get_clients()
for _, client in pairs(clients) do
if client.resolved_capabilities.signature_help == true then
if client.server_capabilities.signatureHelpProvider == true then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the server_capabilities.signatureHelpProvider is a table, so table will never be true

Suggested change
if client.server_capabilities.signatureHelpProvider == true then
if client.server_capabilities.signatureHelpProvider then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I use ~= nil as condition? For readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like somebody is already doing great job in #106 , maybe I should close this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I use ~= nil as condition? For readability.

I'm not so sure about this one, I don't know if there's no provider it will be nil, are you sure about this?
if not, we could avoid that with this

if client.server_capabilities.signatureHelpProvider then

return true
end
end
Expand Down