mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-29 22:29:57 +02:00
feat(lsp): add option to override default nvim-lsp-installer
settings (#2698)
This commit is contained in:
parent
12f8798bb0
commit
c6431a09c7
5 changed files with 53 additions and 7 deletions
|
@ -119,6 +119,19 @@ return {
|
||||||
insert_mode = {},
|
insert_mode = {},
|
||||||
visual_mode = {},
|
visual_mode = {},
|
||||||
},
|
},
|
||||||
|
---@usage list of settings of nvim-lsp-installer
|
||||||
|
installer = {
|
||||||
|
setup = {
|
||||||
|
ensure_installed = {},
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
server_installed = "✓",
|
||||||
|
server_pending = "",
|
||||||
|
server_uninstalled = "✗",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
null_ls = {
|
null_ls = {
|
||||||
setup = {},
|
setup = {},
|
||||||
config = {},
|
config = {},
|
||||||
|
|
|
@ -122,10 +122,7 @@ function M.setup()
|
||||||
append_default_schemas = true,
|
append_default_schemas = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
require("nvim-lsp-installer").setup {
|
require("nvim-lsp-installer").setup(lvim.lsp.installer.setup)
|
||||||
-- use the default nvim_data_dir, since the server binaries are independent
|
|
||||||
install_root_dir = utils.join_paths(vim.call("stdpath", "data"), "lsp_servers"),
|
|
||||||
}
|
|
||||||
|
|
||||||
require("lvim.lsp.null-ls").setup()
|
require("lvim.lsp.null-ls").setup()
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,20 @@ end
|
||||||
|
|
||||||
local skipped_filetypes = lvim.lsp.automatic_configuration.skipped_filetypes
|
local skipped_filetypes = lvim.lsp.automatic_configuration.skipped_filetypes
|
||||||
local skipped_servers = lvim.lsp.automatic_configuration.skipped_servers
|
local skipped_servers = lvim.lsp.automatic_configuration.skipped_servers
|
||||||
|
local ensure_installed_servers = lvim.lsp.installer.setup.ensure_installed
|
||||||
|
|
||||||
|
---Check if we should skip generating an ftplugin file based on the server_name
|
||||||
|
---@param server_name string name of a valid language server
|
||||||
|
local function should_skip(server_name)
|
||||||
|
-- ensure_installed_servers should take priority over skipped_servers
|
||||||
|
return vim.tbl_contains(skipped_servers, server_name) and not vim.tbl_contains(ensure_installed_servers, server_name)
|
||||||
|
end
|
||||||
|
|
||||||
---Generates an ftplugin file based on the server_name in the selected directory
|
---Generates an ftplugin file based on the server_name in the selected directory
|
||||||
---@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc.
|
---@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc.
|
||||||
---@param dir string the full path to the desired directory
|
---@param dir string the full path to the desired directory
|
||||||
function M.generate_ftplugin(server_name, dir)
|
function M.generate_ftplugin(server_name, dir)
|
||||||
if vim.tbl_contains(skipped_servers, server_name) then
|
if should_skip(server_name) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,20 @@ lvim.builtin.treesitter.highlight.enabled = true
|
||||||
|
|
||||||
-- generic LSP settings
|
-- generic LSP settings
|
||||||
|
|
||||||
|
-- -- make sure server will always be installed even if the server is in skipped_servers list
|
||||||
|
-- lvim.lsp.installer.setup.ensure_installed = {
|
||||||
|
-- "sumeko_lua",
|
||||||
|
-- "jsonls",
|
||||||
|
-- }
|
||||||
|
-- -- change UI setting of `LspInstallInfo`
|
||||||
|
-- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
|
||||||
|
-- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
|
||||||
|
-- lvim.lsp.installer.setup.ui.border = "rounded"
|
||||||
|
-- lvim.lsp.installer.setup.ui.keymaps = {
|
||||||
|
-- uninstall_server = "d",
|
||||||
|
-- toggle_server_expand = "o",
|
||||||
|
-- }
|
||||||
|
|
||||||
-- ---@usage disable automatic installation of servers
|
-- ---@usage disable automatic installation of servers
|
||||||
-- lvim.lsp.automatic_servers_installation = false
|
-- lvim.lsp.automatic_servers_installation = false
|
||||||
|
|
||||||
|
@ -94,7 +108,7 @@ lvim.builtin.treesitter.highlight.enabled = true
|
||||||
-- require("lvim.lsp.manager").setup("pyright", opts)
|
-- require("lvim.lsp.manager").setup("pyright", opts)
|
||||||
|
|
||||||
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
|
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
|
||||||
-- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
|
-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
|
||||||
-- vim.tbl_map(function(server)
|
-- vim.tbl_map(function(server)
|
||||||
-- return server ~= "emmet_ls"
|
-- return server ~= "emmet_ls"
|
||||||
-- end, lvim.lsp.automatic_configuration.skipped_servers)
|
-- end, lvim.lsp.automatic_configuration.skipped_servers)
|
||||||
|
|
|
@ -99,6 +99,20 @@ lvim.builtin.treesitter.highlight.enabled = true
|
||||||
|
|
||||||
-- generic LSP settings
|
-- generic LSP settings
|
||||||
|
|
||||||
|
-- -- make sure server will always be installed even if the server is in skipped_servers list
|
||||||
|
-- lvim.lsp.installer.setup.ensure_installed = {
|
||||||
|
-- "sumeko_lua",
|
||||||
|
-- "jsonls",
|
||||||
|
-- }
|
||||||
|
-- -- change UI setting of `LspInstallInfo`
|
||||||
|
-- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
|
||||||
|
-- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
|
||||||
|
-- lvim.lsp.installer.setup.ui.border = "rounded"
|
||||||
|
-- lvim.lsp.installer.setup.ui.keymaps = {
|
||||||
|
-- uninstall_server = "d",
|
||||||
|
-- toggle_server_expand = "o",
|
||||||
|
-- }
|
||||||
|
|
||||||
-- ---@usage disable automatic installation of servers
|
-- ---@usage disable automatic installation of servers
|
||||||
-- lvim.lsp.automatic_servers_installation = false
|
-- lvim.lsp.automatic_servers_installation = false
|
||||||
|
|
||||||
|
@ -109,7 +123,7 @@ lvim.builtin.treesitter.highlight.enabled = true
|
||||||
-- require("lvim.lsp.manager").setup("pyright", opts)
|
-- require("lvim.lsp.manager").setup("pyright", opts)
|
||||||
|
|
||||||
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
|
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
|
||||||
-- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
|
-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
|
||||||
-- vim.tbl_map(function(server)
|
-- vim.tbl_map(function(server)
|
||||||
-- return server ~= "emmet_ls"
|
-- return server ~= "emmet_ls"
|
||||||
-- end, lvim.lsp.automatic_configuration.skipped_servers)
|
-- end, lvim.lsp.automatic_configuration.skipped_servers)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue