cleanup logs, enable pyright format with black

neovim_0.6
ray-x 3 years ago
parent 69578d6a3c
commit 295b5e89ec

@ -10,11 +10,12 @@ local sign_name = "NavigatorLightBulb"
local diagnostic = vim.diagnostic or vim.lsp.diagnostic
code_action.code_action_handler = util.mk_handler(function(err, actions, ctx, cfg)
log(actions, ctx)
if actions == nil or vim.tbl_isempty(actions) or err then
print("No code actions available")
log("No code actions available")
return
end
log(actions, ctx)
local data = {"  Auto Fix <C-o> Apply <C-e> Exit"}
for i, action in ipairs(actions) do
local title = action.title:gsub("\r\n", "\\r\\n")
@ -57,11 +58,11 @@ code_action.code_action_handler = util.mk_handler(function(err, actions, ctx, cf
rawdata = true,
data = data,
on_confirm = function(pos)
log(pos)
trace(pos)
apply_action(pos)
end,
on_move = function(pos)
log(pos)
trace(pos)
return pos
end
}
@ -125,7 +126,6 @@ local need_check_diagnostic = {['python'] = true}
function code_action:render_action_virtual_text(line, diagnostics)
return function(err, actions, context)
log(err, line, diagnostics, actions, context)
if actions == nil or type(actions) ~= "table" or vim.tbl_isempty(actions) then
-- no actions cleanup
if config.code_action_prompt.virtual_text then
@ -135,6 +135,7 @@ function code_action:render_action_virtual_text(line, diagnostics)
_update_sign(nil)
end
else
log(err, line, diagnostics, actions, context)
if config.code_action_prompt.sign then
if need_check_diagnostic[vim.bo.filetype] then
if next(diagnostics) == nil then

@ -27,7 +27,7 @@ local get_current_winid = require('navigator.util').get_current_winid
local code_lens_action = {}
local function _update_sign(line)
log("update sign at line ", line)
trace("update sign at line ", line)
local winid = get_current_winid()
if code_lens_action[winid] == nil then
code_lens_action[winid] = {}
@ -46,7 +46,9 @@ end
local codelens_hdlr = mk_handler(function(err, result, ctx, cfg)
if err or result == nil then
log("lsp code lens", vim.inspect(err), ctx, cfg)
if err then
log("lsp code lens", vim.inspect(err), ctx, cfg)
end
return
end
trace("codelenes result", result)

@ -175,7 +175,9 @@ local diag_hdlr = mk_handler(function(err, result, ctx, config)
end
local client_id = ctx.client_id
log('diagnostic', #result.diagnostics, ctx, config)
if result.diagnostics ~= nil and result.diagnostics ~= {} then
log('diagnostic', result.diagnostics, ctx, config)
end
if util.nvim_0_6() then
trace(err, result, ctx, config)

@ -213,6 +213,7 @@ local setups = {
flags = {allow_incremental_sync = true, debounce_text_changes = 500},
settings = {
python = {
formatting = {provider = 'black'},
analysis = {
autoSearchPaths = true,
useLibraryCodeForTypes = true,

@ -99,7 +99,7 @@ function M.prepare_for_render(items, opts)
-- trace(items[i], items[i].filename, last_summary_idx, display_items[last_summary_idx].filename)
-- TODO refact display_filename generate part
if items[i].filename == fn then
space, trim = get_pads(opts.width, icon .. ' ' .. dfn, lspapi_display .. ' 14')
space, trim = get_pads(opts.width, icon .. ' ' .. dfn, lspapi_display .. ' 14 of 33 ')
if trim and opts.width > 50 and #dfn > opts.width - 20 then
local fn1 = string.sub(dfn, 1, opts.width - 50)
local fn2 = string.sub(dfn, #dfn - 10, #dfn)
@ -123,7 +123,7 @@ function M.prepare_for_render(items, opts)
item = clone(items[i])
space, trim = get_pads(opts.width, icon .. ' ' .. item.display_filename,
lspapi_display .. ' 12')
lspapi_display .. ' 12 of 33')
if trim and opts.width > 52 and #item.display_filename > opts.width - 20 then
item.display_filename = string.sub(item.display_filename, 1, opts.width - 52) .. ""
.. string.sub(item.display_filename,

Loading…
Cancel
Save