mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Handle nested TS syntax, closes #271
This commit is contained in:
@@ -32,7 +32,20 @@ function M.is_hl_enabled(bufnr)
|
||||
end
|
||||
|
||||
function M.get_matches(bufnr)
|
||||
return queries.get_matches(bufnr, 'matchup')
|
||||
local parser = parsers.get_parser(bufnr)
|
||||
local matches = {}
|
||||
|
||||
if parser then
|
||||
parser:for_each_tree(function(tree, lang_tree)
|
||||
local lang = lang_tree:lang()
|
||||
|
||||
local group_results = queries.collect_group_results(
|
||||
bufnr, 'matchup', tree:root(), lang) or {}
|
||||
vim.list_extend(matches, group_results)
|
||||
end)
|
||||
end
|
||||
|
||||
return matches
|
||||
end
|
||||
|
||||
local function _time()
|
||||
@@ -349,9 +362,6 @@ function M.get_option(bufnr, opt_name)
|
||||
end
|
||||
|
||||
function M.attach(bufnr, lang)
|
||||
-- local parser = parsers.get_parser(bufnr, lang)
|
||||
-- local config = configs.get_module('matchup')
|
||||
|
||||
if M.get_option(bufnr, 'additional_vim_regex_highlighting')
|
||||
and api.nvim_buf_get_option(bufnr, 'syntax') == '' then
|
||||
api.nvim_buf_set_option(bufnr, 'syntax', 'ON')
|
||||
|
||||
Reference in New Issue
Block a user