bugfix treesitter typo, clap buf_input disable

neovim_0_5
ray-x 3 years ago
parent f9794ab058
commit b23c31735c

@ -2,6 +2,8 @@
Easy code navigation through LSP and 🌲🏡Treesitter symbols, diagnostic errors.
![document symbol](https://github.com/ray-x/files/blob/master/img/navigator/doc_symbol.gif?raw=true)
# Features:
- LSP easy setup. Support the most commonly used lsp clients setup. Dynamic lsp activation based on buffer type.
@ -133,7 +135,7 @@ colorscheme: [aurora](https://github.com/ray-x/aurora)
# Current symbol highlight and jump backword/forward between symbols
Document highlight provided by LSP.
Jump between symbols between symbols with treesitter
Jump between symbols between symbols with treesitter (with `]r` and `[r`)
![doc jump](https://github.com/ray-x/files/blob/master/img/navigator/doc_hl_jump.gif?raw=true)
### Diagnostic

@ -252,7 +252,8 @@ local function load_cfg(ft, client, cfg, loaded)
-- need to verify the lsp server is up
end
local function wait_lsp_startup(ft)
local function wait_lsp_startup(ft, retry)
retry = retry or false
local clients = vim.lsp.get_active_clients() or {}
local loaded = {}
for i = 1, 2 do
@ -265,6 +266,9 @@ local function wait_lsp_startup(ft)
local cfg = setups[lspclient] or default_cfg
load_cfg(ft, lspclient, cfg, loaded)
end
if not retry or ft == nil then
return
end
--
local timer = vim.loop.new_timer()
local i = 0
@ -273,7 +277,7 @@ local function wait_lsp_startup(ft)
function()
clients = vim.lsp.get_active_clients() or {}
i = i + 1
if i > 10 or #clients > 0 then
if i > 5 or #clients > 0 then
timer:close() -- Always close handles to avoid leaks.
log("active", #clients, i)
_Loading = false
@ -286,32 +290,51 @@ local function wait_lsp_startup(ft)
end
end
vim.cmd([[autocmd filetype * lua require'navigator.lspclient.clients'.setup()]]) -- BufWinEnter BufNewFile,BufRead ?
vim.cmd([[autocmd FileType * lua require'navigator.lspclient.clients'.setup()]]) -- BufWinEnter BufNewFile,BufRead ?
local function setup(user_opts)
verbose(debug.traceback())
if _Loading == true then
return
end
if lspconfig == nil then
error("lsp-config need installed and enabled")
return
end
highlight.diagnositc_config_sign()
highlight.add_highlight()
local ft = vim.bo.filetype
if ft == nil then
ft = vim.api.nvim_buf_get_option(0, "filetype")
end
if ft == nil or ft == "" then
log("nil filetype")
return
end
log("loading for ft ", ft)
local retry = true
local disable_ft = {
"NvimTree",
"guihua",
"clap_input",
"clap_spinner",
"vista",
"TelescopePrompt",
"csv",
"txt",
"markdown",
"defx"
}
for i = 1, #disable_ft do
if ft == disable_ft[i] then
retry = false
end
end
if lspconfig == nil then
error("lsp-config need installed and enabled")
return
end
highlight.diagnositc_config_sign()
highlight.add_highlight()
_Loading = true
wait_lsp_startup(ft)
wait_lsp_startup(ft, retry)
_Loading = false
end
return {setup = setup, cap = cap}

@ -172,7 +172,7 @@ local function get_all_nodes(bufnr)
item.kind = node.kind
item.node_scope = get_smallest_context(item.tsdata)
local start_line_node, _, _ = item.tsdata:start()
item.node_text = ts_utils.get_node_tex(item.tsdata, bufnr)[1]
item.node_text = ts_utils.get_node_text(item.tsdata, bufnr)[1]
if item.node_text == "_" then
goto continue
end

@ -95,7 +95,7 @@ local default_config = {
plugin = "navigator",
use_console = false,
use_file = true,
level = "info"
level = "debug"
}
M._log = require("guihua.log").new({level = default_config.level}, true)

Loading…
Cancel
Save