Skip to content

Commit

Permalink
refactor: improve get_clients_from_cmd_args
Browse files Browse the repository at this point in the history
improve the get_clients_from_cmd_args for better readability and consistency.

- replace unnecessary dictionary-based approaches with array-based ones.
- use the '#' to improve code readability.
- use the '#' for an empty check.
  • Loading branch information
sys9kdr committed Dec 20, 2023
1 parent a2e84dd commit 8d6048d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ end
local get_clients_from_cmd_args = function(arg)
local result = {}
for id in (arg or ''):gmatch '(%d+)' do
result[id] = lsp.get_client_by_id(tonumber(id))
result[#result + 1] = lsp.get_client_by_id(tonumber(id))
end
if vim.tbl_isempty(result) then
if #result == 0 then
return require('lspconfig.util').get_managed_clients()
end
return vim.tbl_values(result)
return result
end

for group, hi in pairs {
Expand Down

0 comments on commit 8d6048d

Please sign in to comment.