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:
parent
0028a33e0a
commit
9ff021faa4
14
init.lua
14
init.lua
|
@ -668,7 +668,15 @@ require('lazy').setup({
|
||||||
-- 1) via the mason package manager; or
|
-- 1) via the mason package manager; or
|
||||||
-- 2) via your system's 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.
|
-- 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 = {
|
local servers = {
|
||||||
-- Add any additional override configuration in any of the following tables. Available keys are:
|
-- 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
|
-- - 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
|
-- to the default language server configs as provided by nvim-lspconfig or
|
||||||
-- define a custom server config that's unavailable on nvim-lspconfig.
|
-- 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
|
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)
|
vim.lsp.config(server, config)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -748,7 +756,7 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Manually run vim.lsp.enable for all language servers that are *not* installed via Mason
|
-- 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))
|
vim.lsp.enable(vim.tbl_keys(servers.others))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue