Fix TS query reload autocmds, fix #161

This commit is contained in:
Andy K. Massimino
2021-07-05 18:45:08 -04:00
parent 39e39b1338
commit 05f4962c64
2 changed files with 10 additions and 5 deletions

View File

@@ -367,9 +367,10 @@ function! s:treesitter_init_module() " {{{1
augroup matchup_filetype_query
au!
autocmd FileType query
\ autocmd! MatchupTreesitter BufWritePost <buffer>
\ call v:lua.require('nvim-treesitter.third-party.query')
\ .invalidate_query_file(expand('%:p'))
\ augroup MatchupTreesitter|augroup END
\|autocmd! MatchupTreesitter BufWritePost <buffer>
\ call v:lua.require('treesitter-matchup.third-party.query')
\.invalidate_query_file(expand('%:p'))
augroup END
endfunction

View File

@@ -197,10 +197,14 @@ end
function M.iter_group_results(bufnr, query_group, root, root_lang)
local buf_lang = parsers.get_buf_lang(bufnr)
if not buf_lang then return EMPTY_ITER end
if not buf_lang then
return EMPTY_ITER
end
local parser = parsers.get_parser(bufnr, buf_lang)
if not parser then return EMPTY_ITER end
if not parser then
return EMPTY_ITER
end
if not root then
local first_tree = parser:trees()[1]