fix(query): parse before access trees

fix `get_capture_matches_recursively` on new buffer
This commit is contained in:
Daniel Zhang 2025-06-08 22:01:10 +08:00 committed by GitHub
parent 42fc28ba91
commit 2235a17a7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -437,6 +437,7 @@ function M.get_capture_matches_recursively(bufnr, capture_or_fn, query_type)
local matches = {}
if parser then
parser:parse()
parser:for_each_tree(function(tree, lang_tree)
local lang = lang_tree:lang()
local capture, type_ = type_fn(lang, tree, lang_tree)