refactor: based on pr comments

Add lua_ls annotations for improved hover experience and replace vim.fn.empty() with
vim.tbl_isempty()
This commit is contained in:
Kartik Vashistha 2025-06-08 01:33:25 +01:00
parent 0028a33e0a
commit 9ff021faa4
1 changed files with 11 additions and 3 deletions

View File

@ -668,7 +668,15 @@ require('lazy').setup({
-- 1) via the mason package manager; or
-- 2) via your system's package manager; or
-- 3) via a release binary from a language server's repo that's accessible somewhere on your system.
--
-- The servers table comprises of the following sub-tables:
-- 1. mason
-- 2. others
-- Both these tables have an identical structure of language server names as keys and
-- a table of language server configuration as values.
---@class LspServersConfig
---@field mason table<string, vim.lsp.Config>
---@field others table<string, vim.lsp.Config>
local servers = {
-- Add any additional override configuration in any of the following tables. Available keys are:
-- - cmd (table): Override the default command used to start the server
@ -736,7 +744,7 @@ require('lazy').setup({
-- to the default language server configs as provided by nvim-lspconfig or
-- define a custom server config that's unavailable on nvim-lspconfig.
for server, config in pairs(vim.tbl_extend('keep', servers.mason, servers.others)) do
if vim.fn.empty(config) ~= 1 then
if not vim.tbl_isempty(config) then
vim.lsp.config(server, config)
end
end
@ -748,7 +756,7 @@ require('lazy').setup({
}
-- Manually run vim.lsp.enable for all language servers that are *not* installed via Mason
if vim.fn.empty(servers.others) ~= 1 then
if not vim.tbl_isempty(servers.others) then
vim.lsp.enable(vim.tbl_keys(servers.others))
end
end,