change log level

neovim_0_5
ray-x 3 years ago
parent 09e5196049
commit e2bf480d22

@ -4,6 +4,7 @@ local TextView = require "guihua.textview"
local View = require "guihua.view" local View = require "guihua.view"
local util = require "navigator.util" local util = require "navigator.util"
local log = require "navigator.util".log local log = require "navigator.util".log
local verbose = require "navigator.util".verbose
function M.new_preview(opts) function M.new_preview(opts)
return TextView:new( return TextView:new(
@ -44,10 +45,9 @@ function M._preview_location(location, width, pos_x, pos_y)
syntax = api.nvim_buf_get_option(bufnr, "ft") syntax = api.nvim_buf_get_option(bufnr, "ft")
end end
log(syntax, contents) verbose(syntax, contents)
local opts = {syntax = syntax, width = width, pos_x = pos_x or 0, pos_y = pos_y or 10} local opts = {syntax = syntax, width = width, pos_x = pos_x or 0, pos_y = pos_y or 10}
opts.items = contents opts.items = contents
log("syntax", opts.syntax)
return M.new_preview(opts) return M.new_preview(opts)
end end
@ -58,7 +58,7 @@ end
-- --
function M.preview_file(filename, width, line, col, offset_x, offset_y) function M.preview_file(filename, width, line, col, offset_x, offset_y)
log("file", filename, line, offset_x, offset_y) verbose("file", filename, line, offset_x, offset_y)
if line >= 2 then if line >= 2 then
line = line - 2 line = line - 2
end end
@ -70,7 +70,7 @@ function M.preview_file(filename, width, line, col, offset_x, offset_y)
end end
function M.preview_uri(uri, width, line, col, offset_x, offset_y) function M.preview_uri(uri, width, line, col, offset_x, offset_y)
log("uri", uri, line, offset_x, offset_y) verbose("uri", uri, line, offset_x, offset_y)
if line >= 2 then if line >= 2 then
line = line - 2 line = line - 2
end end
@ -133,7 +133,7 @@ function M.new_list_view(opts)
pos = 1 pos = 1
end end
local l = data[pos] local l = data[pos]
log("on move", pos, l.text or l, l.uri, l.filename) verbose("on move", pos, l.text or l, l.uri, l.filename)
-- todo fix -- todo fix
if l.uri ~= nil then if l.uri ~= nil then
return M.preview_uri(l.uri, width, l.lnum, l.col, 0, offset_y) return M.preview_uri(l.uri, width, l.lnum, l.col, 0, offset_y)

@ -1,7 +1,7 @@
local util = require "navigator.util" local util = require "navigator.util"
local lsphelper = require "navigator.lspwrapper" local lsphelper = require "navigator.lspwrapper"
local gui = require "navigator.gui" local gui = require "navigator.gui"
local log = require "navigator.util".log local verbose = require "navigator.util".verbose
-- local log = util.log -- local log = util.log
-- local partial = util.partial -- local partial = util.partial
-- local cwd = vim.fn.getcwd(0) -- local cwd = vim.fn.getcwd(0)
@ -24,7 +24,7 @@ local function ref_hdlr(arg1, api, locations, num, bufnr)
print "References not found" print "References not found"
return return
end end
log(locations) verbose(locations)
local items = locations_to_items(locations) local items = locations_to_items(locations)
gui.new_list_view({items = items, api = 'Reference'}) gui.new_list_view({items = items, api = 'Reference'})
end end

@ -96,7 +96,7 @@ local default_config = {
level = "info" level = "info"
} }
M._log = require('guihua.log').new({level='debug'}, true) M._log = require('guihua.log').new({level='info'}, true)
-- add log to you lsp.log -- add log to you lsp.log
M.log = M._log.info M.log = M._log.info

Loading…
Cancel
Save