Skip to content

Commit 17878a3

Browse files
kartikvashisthaoriori1703
authored andcommitted
refactor: based on pr comments
Add lua_ls annotations for improved hover experience and replace vim.fn.empty() with vim.tbl_isempty()
1 parent 3436e0e commit 17878a3

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

init.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,15 @@ require('lazy').setup({
614614
-- 1) via the mason package manager; or
615615
-- 2) via your system's package manager; or
616616
-- 3) via a release binary from a language server's repo that's accessible somewhere on your system.
617-
--
617+
618+
-- The servers table comprises of the following sub-tables:
619+
-- 1. mason
620+
-- 2. others
621+
-- Both these tables have an identical structure of language server names as keys and
622+
-- a table of language server configuration as values.
623+
---@class LspServersConfig
624+
---@field mason table<string, vim.lsp.Config>
625+
---@field others table<string, vim.lsp.Config>
618626
local servers = {
619627
-- Add any additional override configuration in any of the following tables. Available keys are:
620628
-- - cmd (table): Override the default command used to start the server
@@ -696,7 +704,7 @@ require('lazy').setup({
696704
-- to the default language server configs as provided by nvim-lspconfig or
697705
-- define a custom server config that's unavailable on nvim-lspconfig.
698706
for server, config in pairs(vim.tbl_extend('keep', servers.mason, servers.others)) do
699-
if vim.fn.empty(config) ~= 1 then vim.lsp.config(server, config) end
707+
if not vim.tbl_isempty(config) then vim.lsp.config(server, config) end
700708
end
701709

702710
-- After configuring our language servers, we now enable them
@@ -706,7 +714,7 @@ require('lazy').setup({
706714
}
707715

708716
-- Manually run vim.lsp.enable for all language servers that are *not* installed via Mason
709-
if vim.fn.empty(servers.others) ~= 1 then vim.lsp.enable(vim.tbl_keys(servers.others)) end
717+
if not vim.tbl_isempty(servers.others) then vim.lsp.enable(vim.tbl_keys(servers.others)) end
710718
end,
711719
},
712720

0 commit comments

Comments
 (0)