merge master

neovim_0.7
ray-x 2 years ago
commit 2e43b8ee0a

@ -33,7 +33,7 @@ _NgConfigValues = {
transparency = 50, -- 0 ~ 100 blur the main window, 100: fully transparent, 0: opaque, set to nil to disable it
lsp_signature_help = true, -- if you would like to hook ray-x/lsp_signature plugin in navigator
-- setup here. if it is nil, navigator will not init signature help
signature_help_cfg = { debug = false }, -- if you would like to init ray-x/lsp_signature plugin in navigator, pass in signature help
signature_help_cfg = {debug=false}, -- if you would like to init ray-x/lsp_signature plugin in navigator, pass in signature help
lsp = {
code_action = {
enable = true,
@ -136,10 +136,6 @@ M.deprecated = function(cfg)
if cfg.lspinstall ~= nil then
warn('lspinstall deprecated, please use lsp-installer instead or use "lspinstall" branch')
end
-- TODO: update the marker
if cfg.diagnostic_scrollbar_sign then
vim.notify('config deprecated, set lsp.diagnostic_scrollbar_sign instead', vim.lsp.log_levels.WARN)
end
end
local extend_config = function(opts)

@ -4,7 +4,6 @@ local trace = util.trace
local mk_handler = util.mk_handler
local api = vim.api
local references = {}
trace = log
_NG_hi_list = {}
_NG_current_symbol = ''
_NG_ref_hi_idx = 1

@ -2,43 +2,42 @@ return {
init = function()
local loader = nil
local packer_plugins = packer_plugins or nil -- suppress warnings
local log = require'navigator.util'.log
local log = require('navigator.util').log
-- packer only
if packer_plugins ~= nil then -- packer install
local lazy_plugins = {
["nvim-lspconfig"] = "neovim/nvim-lspconfig",
["guihua.lua"] = "ray-x/guihua.lua"
['nvim-lspconfig'] = 'neovim/nvim-lspconfig',
['guihua.lua'] = 'ray-x/guihua.lua',
}
if _NgConfigValues.lsp_installer == true then
lazy_plugins["nvim-lsp-installer"] = "williamboman/nvim-lsp-installer"
lazy_plugins['nvim-lsp-installer'] = 'williamboman/nvim-lsp-installer'
end
-- packer installed
loader = require"packer".loader
loader = require('packer').loader
for plugin, url in pairs(lazy_plugins) do
if not packer_plugins[url] or not packer_plugins[url].loaded then
-- log("loading ", plugin)
loader(plugin)
end
end
end
if _NgConfigValues.lsp_installer == true then
local has_lspinst, lspinst = pcall(require, "lsp_installer")
local has_lspinst, lspinst = pcall(require, 'lsp_installer')
log('lsp_installer installed', has_lspinst)
if has_lspinst then
lspinst.setup()
local configs = require "lspconfig/configs"
local servers = require'nvim-lsp-installer'.get_installed_servers()
local configs = require('lspconfig/configs')
local servers = require('nvim-lsp-installer').get_installed_servers()
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]
if lsp_inst_cfg and lsp_inst_cfg.document_config.default_config then
lsp_inst_cfg = lsp_inst_cfg.document_config.default_config
lsp_inst_cfg = vim.tbl_deep_extend('keep', lsp_inst_cfg, cfg)
require'lspconfig'[server].setup(lsp_inst_cfg)
require('lspconfig')[server].setup(lsp_inst_cfg)
end
end
end
@ -51,7 +50,7 @@ return {
if packer_plugins ~= nil then -- packer install
local lazy_plugins = {}
lazy_plugins[plugin_name] = path
loader = require"packer".loader
loader = require('packer').loader
for plugin, url in pairs(lazy_plugins) do
if packer_plugins[plugin] and packer_plugins[plugin].loaded == false then
-- log("loading ", plugin)
@ -59,6 +58,5 @@ return {
end
end
end
end
end,
}

@ -24,6 +24,9 @@ M.on_attach = function(client, bufnr)
trace(client)
-- add highlight for Lspxxx
require('navigator.lspclient.highlight').add_highlight()
require('navigator.lspclient.highlight').diagnositc_config_sign()
api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
require('navigator.lspclient.mapping').setup({
@ -31,6 +34,12 @@ M.on_attach = function(client, bufnr)
bufnr = bufnr,
})
if client.resolved_capabilities.document_highlight then
require('navigator.dochighlight').documentHighlight()
end
require('navigator.lspclient.lspkind').init()
local config = require('navigator').config_values()
trace(client.name, 'navigator on attach')
if config.on_attach ~= nil then

@ -8,6 +8,7 @@ local warn = util.warn
_NG_Loaded = {}
_LoadedFiletypes = {}
local loader = nil
packer_plugins = packer_plugins or nil -- suppress warnings
-- packer only
@ -441,7 +442,7 @@ local function lsp_startup(ft, retry, user_lsp_opts)
end
for _, lspclient in ipairs(servers) do
-- check should load lsp
trace('loading :', lspclient)
if type(lspclient) == 'table' then
if lspclient.name then
lspclient = lspclient.name
@ -473,8 +474,7 @@ local function lsp_startup(ft, retry, user_lsp_opts)
end
local default_config = {}
trace(lspclient)
log(lspclient)
if lspconfig[lspclient] == nil then
vim.notify(
'lspclient' .. vim.inspect(lspclient) .. 'no longer support by lspconfig, please submit an issue',
@ -510,7 +510,7 @@ local function lsp_startup(ft, retry, user_lsp_opts)
disable_fmt = true
end
local enable_fmt = not disable_fmt
local enable_fmt = not disable_fmt
if user_lsp_opts[lspclient] ~= nil then
-- log(lsp_opts[lspclient], cfg)
cfg = vim.tbl_deep_extend('force', cfg, user_lsp_opts[lspclient])

@ -177,6 +177,11 @@ local function set_mapping(user_opts)
del_keymap('n', fmtkey)
end
if user_opts.cap and user_opts.cap.document_range_formatting then
log('formatting enabled', user_opts.cap)
end
if not range_fmt and rfmtkey then
del_keymap('v', rfmtkey)
end

Loading…
Cancel
Save