deprecate lspinstall in faviour of lsp_installer

neovim_0.6
ray-x 3 years ago
parent 7514301d80
commit 87f4c2b664

@ -223,7 +223,7 @@ require'navigator'.setup({
diagnostic_head_severity_1 = "🈲", diagnostic_head_severity_1 = "🈲",
-- refer to lua/navigator.lua for more icons setups -- refer to lua/navigator.lua for more icons setups
}, },
lspinstall = false, -- set to true if you would like use the lsp installed by lspinstall lsp_installer = false, -- set to true if you would like use the lsp installed by williamboman/nvim-lsp-installer
lsp = { lsp = {
code_action = {enable = true, sign = true, sign_priority = 40, virtual_text = true}, code_action = {enable = true, sign = true, sign_priority = 40, virtual_text = true},
code_lens_action = {enable = true, sign = true, sign_priority = 40, virtual_text = true}, code_lens_action = {enable = true, sign = true, sign_priority = 40, virtual_text = true},
@ -400,24 +400,24 @@ The plugin can be loaded lazily (packer `opt = true` ), And it will check if opt
The terminal will need to be able to output nerdfont and emoji correctly. I am using Kitty with nerdfont (Victor Mono). The terminal will need to be able to output nerdfont and emoji correctly. I am using Kitty with nerdfont (Victor Mono).
## Integration with lspinstall ## Integration with lsp_installer (williamboman/nvim-lsp-installer)
If you'd like to only use the lsp servers installed by lspinstall. Please set If you'd like to only use the lsp servers installed by lsp_installer. Please set
```lua ```lua
lspinstall = false lsp_installer = false
``` ```
In the config. In the config.
If you need to use the setup from navigator instead of default setup in lspinstall. Please setup If you need to use the setup from navigator instead of default setup in lsp_installer. Please setup
```lua ```lua
lspinstall = false -- lsp_installer = false -- default value is false
require'navigator'.setup({ require'navigator'.setup({
lsp = { lsp = {
tsserver = { cmd = {'your tsserver installed by lspinstall'} } tsserver = { cmd = {'your tsserver installed by lsp_installer'} }
} }
}) })

@ -60,7 +60,7 @@ _NgConfigValues = {
-- cmd = {'lua-language-server'} -- cmd = {'lua-language-server'}
} }
}, },
lspinstall = false, -- set to true if you would like use the lsp installed by lspinstall lsp_installer = false, -- set to true if you would like use the lsp installed by williamboman/nvim-lsp-installer
icons = { icons = {
icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon) icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon)
-- Code action -- Code action
@ -114,6 +114,10 @@ M.deprecated = function(cfg)
if cfg.lsp ~= nil and cfg.lsp.disable_format_ft ~= nil and cfg.lsp.disable_format_ft ~= {} then if cfg.lsp ~= nil and cfg.lsp.disable_format_ft ~= nil and cfg.lsp.disable_format_ft ~= {} then
warn('disable_format_ft renamed to disable_format_cap') warn('disable_format_ft renamed to disable_format_cap')
end end
if cfg.lspinstall ~= nil then
warn('lspinstall deprecated, please use lsp-installer instead')
end
end end
local extend_config = function(opts) local extend_config = function(opts)

@ -10,8 +10,8 @@ return {
["guihua.lua"] = "ray-x/guihua.lua" ["guihua.lua"] = "ray-x/guihua.lua"
} }
if _NgConfigValues.lspinstall == true then if _NgConfigValues.lsp_installer == true then
lazy_plugins["nvim-lspinstall"] = "kabouzeid/nvim-lspinstall" lazy_plugins["nvim-lsp-installer"] = "williamboman/nvim-lsp-installer"
end end
-- packer installed -- packer installed
@ -25,13 +25,13 @@ return {
end end
if _NgConfigValues.lspinstall == true then if _NgConfigValues.lsp_installer == true then
local has_lspinst, lspinst = pcall(require, "lspinstall") local has_lspinst, lspinst = pcall(require, "lsp_installer")
log('lspinstall', has_lspinst) log('lsp_installer', has_lspinst)
if has_lspinst then if has_lspinst then
lspinst.setup() lspinst.setup()
local configs = require "lspconfig/configs" local configs = require "lspconfig/configs"
local servers = require'lspinstall'.installed_servers() local servers = require'nvim-lsp-installer'.get_installed_servers()
for _, server in pairs(servers) do for _, server in pairs(servers) do
local cfg = require'navigator.lspclient.clients'.get_cfg(server) local cfg = require'navigator.lspclient.clients'.get_cfg(server)
local lsp_inst_cfg = configs[server] local lsp_inst_cfg = configs[server]

@ -156,8 +156,7 @@ local setups = {
}, },
rust_analyzer = { rust_analyzer = {
root_dir = function(fname) root_dir = function(fname)
return util.root_pattern("Cargo.toml", "rust-project.json", ".git")(fname) return util.root_pattern("Cargo.toml", "rust-project.json", ".git")(fname) or util.path.dirname(fname)
or util.path.dirname(fname)
end, end,
filetypes = {"rust"}, filetypes = {"rust"},
message_level = vim.lsp.protocol.MessageType.error, message_level = vim.lsp.protocol.MessageType.error,
@ -268,11 +267,11 @@ local servers = {
"r_language_server", "rust_analyzer", "terraformls", "svelte" "r_language_server", "rust_analyzer", "terraformls", "svelte"
} }
if config.lspinstall == true then if config.lsp_installer == true then
local has_lspinst, lspinst = pcall(require, "lspinstall") local has_lspinst, lspinst = pcall(require, "nvim-lsp-installer")
if has_lspinst then if has_lspinst then
local srvs = lspinst.installed_servers() local srvs = require'nvim-lsp-installer.servers'.get_installed_servers()
log('lspinstalled servers', srvs) log('lsp_installered servers', srvs)
if #srvs > 0 then if #srvs > 0 then
servers = srvs servers = srvs
end end

Loading…
Cancel
Save