diff --git a/lua/navigator/treesitter.lua b/lua/navigator/treesitter.lua index 39eedaf..6630693 100644 --- a/lua/navigator/treesitter.lua +++ b/lua/navigator/treesitter.lua @@ -767,6 +767,9 @@ end function M.buf_ts() local all_nodes, width = M.all_ts_nodes() + if vim.fn.empty(all_nodes) == 1 then + return vim.notify('no treesitter node found') + end local bufnr = api.nvim_get_current_buf() local ft = vim.api.nvim_buf_get_option(bufnr, 'ft') local listview = gui.new_list_view({ @@ -776,7 +779,7 @@ function M.buf_ts() rawdata = true, height = 0.62, preview_height = 0.12, - width = width + 10, + width = (width or 80) + 10, api = _NgConfigValues.icons.treesitter_defult, }) return listview, all_nodes, width diff --git a/lua/navigator/util.lua b/lua/navigator/util.lua index 9aac780..34d51cf 100644 --- a/lua/navigator/util.lua +++ b/lua/navigator/util.lua @@ -175,28 +175,19 @@ end M.log = function(...) return { ... } end -M.info = function(...) - return { ... } -end M.trace = function(...) return { ... } end -M.warn = function(...) - return { ... } -end -M.error = function(...) - print(...) -end -local level = 'error' +local level = 'info' function M.setup() if _NgConfigValues.debug == true then - level = 'info' + level = 'debug' elseif _NgConfigValues.debug == 'trace' then level = 'trace' end - local default_config = { use_console = false, use_file = true, level = level } + local default_config = { use_console = false, use_file = true, level = level, plugin = 'navigator' } if _NgConfigValues.debug_console_output then default_config.use_console = true default_config.use_file = false @@ -287,7 +278,6 @@ end function table.pack(...) return { n = select('#', ...), ... } end - function M.show(...) local string = '' @@ -543,7 +533,6 @@ function M.range_inside(outer, inner) end function M.dirname(pathname) - local path_sep = require('navigator.util').path_sep() local strip_dir_pat = path_sep .. '([^' .. path_sep .. ']+)$' local strip_sep_pat = path_sep .. '$' if not pathname or #pathname == 0 then