logs cleanup. enable formatting hook only when cap formatting

neovim_0.6
ray-x 3 years ago
parent 5e500bef98
commit a2ddb1ff4b

@ -100,7 +100,6 @@ local extend_config = function(opts)
if next(opts) == nil then
return
end
M.deprecated(opts)
for key, value in pairs(opts) do
-- if _NgConfigValues[key] == nil then
-- error(string.format("[] Key %s not valid", key))
@ -124,6 +123,8 @@ local extend_config = function(opts)
if _NgConfigValues.sumneko_root_path or _NgConfigValues.sumneko_binary then
vim.notify("Please put sumneko setup in lsp['sumneko_lua']", vim.log.levels.WARN)
end
M.deprecated(opts)
end
M.config_values = function()

@ -60,7 +60,7 @@ local function error_marker(result, ctx, config)
end
trace('schedule callback', result, ctx, config)
log('total diag ', #result.diagnostics, bufnr)
trace('total diag ', #result.diagnostics, bufnr)
if result == nil or result.diagnostics == nil or #result.diagnostics == 0 then
local diag_cnt = get_count(bufnr, [[Error]]) + get_count(bufnr, [[Warning]])
@ -176,7 +176,7 @@ local diag_hdlr = mk_handler(function(err, result, ctx, config)
local client_id = ctx.client_id
if result.diagnostics ~= nil and result.diagnostics ~= {} then
log('diagnostic', result.diagnostics, ctx, config)
trace('diagnostic', result.diagnostics, ctx, config)
end
if util.nvim_0_6() then

@ -347,7 +347,7 @@ local function wait_lsp_startup(ft, retry, user_lsp_opts)
end
end
if vim.tbl_contains(config.lsp.disable_lsp or {}, lspclient) then
log("disable lsp", lspconfig)
log("disable lsp", lspclient)
goto continue
end

@ -37,7 +37,6 @@ function M.diagnositc_config_sign()
{text = h, texthl = 'DiagnosticHint', linehl = '', numhl = ''})
t = vim.fn.sign_getdefined('DiagnosticSignWarn')
log('*** t ', t, "diagnostic add sign")
end
else
local t = vim.fn.sign_getdefined('LspDiagnosticSignWarn')

@ -217,6 +217,8 @@ function M.setup(user_opts)
set_event_handler(user_opts)
local cap = user_opts.cap or vim.lsp.protocol.make_client_capabilities()
log('lsp cap:', cap)
if cap.call_hierarchy or cap.callHierarchy then
vim.lsp.handlers["callHierarchy/incomingCalls"] =
require"navigator.hierarchy".incoming_calls_handler
@ -260,7 +262,10 @@ function M.setup(user_opts)
end
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {border = single})
vim.lsp.handlers["textDocument/formatting"] = require"navigator.formatting".format_hdl
if cap.document_formatting then
log("formatting hdl")
vim.lsp.handlers["textDocument/formatting"] = require"navigator.formatting".format_hdl
end
end

@ -142,11 +142,10 @@ end
local level = "error"
if _NgConfigValues.debug == true then
level = "debug"
level = "info"
elseif _NgConfigValues.debug == "trace" then
level = "trace"
end
local default_config = {use_console = false, use_file = true, level = level}
if _NgConfigValues.debug_console_output then
default_config.use_console = true

Loading…
Cancel
Save