aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorDaiki Noda <sys9kdr@users.noreply.github.com>2024-01-31 15:07:01 +0900
committerGitHub <noreply@github.com>2024-01-31 14:07:01 +0800
commite3c3ab74d2ad0b1e47b52ecd6005ee1917df2872 (patch)
tree823b720a55e54d6a714055bd002d7043e7b493e6 /plugin
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-e3c3ab74d2ad0b1e47b52ecd6005ee1917df2872.tar
nvim-lspconfig-e3c3ab74d2ad0b1e47b52ecd6005ee1917df2872.tar.gz
nvim-lspconfig-e3c3ab74d2ad0b1e47b52ecd6005ee1917df2872.tar.bz2
nvim-lspconfig-e3c3ab74d2ad0b1e47b52ecd6005ee1917df2872.tar.lz
nvim-lspconfig-e3c3ab74d2ad0b1e47b52ecd6005ee1917df2872.tar.xz
nvim-lspconfig-e3c3ab74d2ad0b1e47b52ecd6005ee1917df2872.tar.zst
nvim-lspconfig-e3c3ab74d2ad0b1e47b52ecd6005ee1917df2872.zip
refactor: improve get_clients_from_cmd_args (#2943)
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.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/lspconfig.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua
index 8eb368d8..d730d2b8 100644
--- a/plugin/lspconfig.lua
+++ b/plugin/lspconfig.lua
@@ -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 {