Skip to content

Commit 9ff021f

Browse files
refactor: based on pr comments
Add lua_ls annotations for improved hover experience and replace vim.fn.empty() with vim.tbl_isempty()
1 parent 0028a33 commit 9ff021f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

init.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,15 @@ require('lazy').setup({
668668
-- 1) via the mason package manager; or
669669
-- 2) via your system's package manager; or
670670
-- 3) via a release binary from a language server's repo that's accessible somewhere on your system.
671-
--
671+
672+
-- The servers table comprises of the following sub-tables:
673+
-- 1. mason
674+
-- 2. others
675+
-- Both these tables have an identical structure of language server names as keys and
676+
-- a table of language server configuration as values.
677+
---@class LspServersConfig
678+
---@field mason table<string, vim.lsp.Config>
679+
---@field others table<string, vim.lsp.Config>
672680
local servers = {
673681
-- Add any additional override configuration in any of the following tables. Available keys are:
674682
-- - cmd (table): Override the default command used to start the server
@@ -736,7 +744,7 @@ require('lazy').setup({
736744
-- to the default language server configs as provided by nvim-lspconfig or
737745
-- define a custom server config that's unavailable on nvim-lspconfig.
738746
for server, config in pairs(vim.tbl_extend('keep', servers.mason, servers.others)) do
739-
if vim.fn.empty(config) ~= 1 then
747+
if not vim.tbl_isempty(config) then
740748
vim.lsp.config(server, config)
741749
end
742750
end
@@ -748,7 +756,7 @@ require('lazy').setup({
748756
}
749757

750758
-- Manually run vim.lsp.enable for all language servers that are *not* installed via Mason
751-
if vim.fn.empty(servers.others) ~= 1 then
759+
if not vim.tbl_isempty(servers.others) then
752760
vim.lsp.enable(vim.tbl_keys(servers.others))
753761
end
754762
end,

0 commit comments

Comments
 (0)