Skip to content

Commit 8c9ae7b

Browse files
kartikvashisthabfabio
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 ba1e270 commit 8c9ae7b

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
@@ -669,7 +669,15 @@ require('lazy').setup({
669669
-- 1) via the mason package manager; or
670670
-- 2) via your system's package manager; or
671671
-- 3) via a release binary from a language server's repo that's accessible somewhere on your system.
672-
--
672+
673+
-- The servers table comprises of the following sub-tables:
674+
-- 1. mason
675+
-- 2. others
676+
-- Both these tables have an identical structure of language server names as keys and
677+
-- a table of language server configuration as values.
678+
---@class LspServersConfig
679+
---@field mason table<string, vim.lsp.Config>
680+
---@field others table<string, vim.lsp.Config>
673681
local servers = {
674682
-- Add any additional override configuration in any of the following tables. Available keys are:
675683
-- - cmd (table): Override the default command used to start the server
@@ -759,7 +767,7 @@ require('lazy').setup({
759767
-- to the default language server configs as provided by nvim-lspconfig or
760768
-- define a custom server config that's unavailable on nvim-lspconfig.
761769
for server, config in pairs(vim.tbl_extend('keep', servers.mason, servers.others)) do
762-
if vim.fn.empty(config) ~= 1 then
770+
if not vim.tbl_isempty(config) then
763771
vim.lsp.config(server, config)
764772
end
765773
end
@@ -771,7 +779,7 @@ require('lazy').setup({
771779
}
772780

773781
-- Manually run vim.lsp.enable for all language servers that are *not* installed via Mason
774-
if vim.fn.empty(servers.others) ~= 1 then
782+
if not vim.tbl_isempty(servers.others) then
775783
vim.lsp.enable(vim.tbl_keys(servers.others))
776784
end
777785
end,

0 commit comments

Comments
 (0)