merge master

neovim_0.7
ray-x 2 years ago
parent c7872c83a8
commit f0c5610a1f

@ -354,14 +354,14 @@ together. If you have multiple similar LSP installed and have trouble with the p
Above servers covered a small part neovim lspconfig support, You can still use lspconfig to add and config servers not
in the list. If you would like to add a server not in the list, you can check this PR https://github.com/ray-x/navigator.lua/pull/107
Also, an option in setup:
Alternatively, update following option in setup(if you do not want a PR):
```lua
require'navigator'setup{lsp={servers={'cmake', 'lexls'}}}
```
Above example add cmake and lexls to the default server list
Above option add cmake and lexls to the default server list
### Disable a lsp client loading from navigator
@ -764,3 +764,5 @@ end
- Check console output
- Check `LspInfo` and treesitter status with `checkhealth`
- Turn on log and attach the log to your issue if possible you can remove any personal/company info in the log
- Submit Issue with minium vimrc. Please check playground/init.lua as a vimrc template. !!!Please DONOT use a packer vimrc
that installs everything to default folder!!! Also check this repo [navigator bug report](https://github.com/fky2015/navigator.nvim-bug-report)

@ -8,7 +8,6 @@ local warn = util.warn
_NG_Loaded = {}
_LoadedFiletypes = {}
local loader = nil
packer_plugins = packer_plugins or nil -- suppress warnings
-- packer only
@ -407,10 +406,7 @@ local function load_cfg(ft, client, cfg, loaded)
-- need to verify the lsp server is up
end
-- run setup for lsp clients
local function lsp_startup(ft, retry, user_lsp_opts)
retry = retry or false
local clients = vim.lsp.get_active_clients() or {}
local function update_capabilities()
trace(ft, 'lsp startup')
local loaded = {}
@ -426,6 +422,17 @@ local function lsp_startup(ft, retry, user_lsp_opts)
properties = { 'documentation', 'detail', 'additionalTextEdits' },
}
capabilities.workspace.configuration = true
return capabilities
end
-- run setup for lsp clients
local function lsp_startup(ft, retry, user_lsp_opts)
retry = retry or false
local clients = vim.lsp.get_active_clients() or {}
local loaded = {}
local capabilities = update_capabilities()
for _, client in ipairs(clients) do
if client ~= nil then
@ -493,24 +500,24 @@ local function lsp_startup(ft, retry, user_lsp_opts)
goto continue
end
local disable_fmt = false
-- if user provides override values
cfg.capabilities = capabilities
log(lspclient, config.lsp.disable_format_cap)
if vim.tbl_contains(config.lsp.disable_format_cap or {}, lspclient) then
log('fileformat disabled for ', lspclient)
disable_fmt = true
end
local enable_fmt = not disable_fmt
if user_lsp_opts[lspclient] ~= nil then
-- log(lsp_opts[lspclient], cfg)
local disable_fmt = false
log(lspclient, config.lsp.disable_format_cap)
if vim.tbl_contains(config.lsp.disable_format_cap or {}, lspclient) then
log('fileformat disabled for ', lspclient)
disable_fmt = true
end
cfg = vim.tbl_deep_extend('force', cfg, user_lsp_opts[lspclient])
if config.combined_attach == nil then
cfg.on_attach = function(client, bufnr)
on_attach(client, bufnr)
if disable_fmt then
client.resolved_capabilities.document_formatting = false
end
client.resolved_capabilities.document_formatting = enable_fmt
end
end
if config.combined_attach == 'mine' then
@ -519,9 +526,7 @@ local function lsp_startup(ft, retry, user_lsp_opts)
end
cfg.on_attach = function(client, bufnr)
config.on_attach(client, bufnr)
if disable_fmt then
client.resolved_capabilities.document_formatting = false
end
client.resolved_capabilities.document_formatting = enable_fmt
end
end
if config.combined_attach == 'both' then
@ -534,9 +539,7 @@ local function lsp_startup(ft, retry, user_lsp_opts)
else
on_attach(client, bufnr)
end
if disable_fmt then
client.resolved_capabilities.document_formatting = false
end
client.resolved_capabilities.document_formatting = enable_fmt
end
end
cfg.on_init = function(client)
@ -548,6 +551,13 @@ local function lsp_startup(ft, retry, user_lsp_opts)
)
end
end
else
if disable_fmt then
cfg.on_attach = function(client, bufnr)
on_attach(client, bufnr)
client.resolved_capabilities.document_formatting = enable_fmt
end
end
end
log('loading', lspclient, 'name', lspconfig[lspclient].name, 'has lspinst', has_lspinst)
@ -717,12 +727,12 @@ local function setup(user_opts)
end
-- append lsps to servers
function add_servers(lsps)
local function add_servers(lsps)
vim.validate({ lsps = { lsps, 't' } })
vim.list_extend(servers, lsps)
end
function on_filetype()
local function on_filetype()
local bufnr = vim.api.nvim_get_current_buf()
local uri = vim.uri_from_bufnr(bufnr)

Loading…
Cancel
Save