fix(formatter): increase match limit

Problem: Some very long patterns were not formatted correctly.

Solution: Increase the match limit when iterating to 1024.
This commit is contained in:
Christian Clason 2025-03-12 09:44:33 +01:00
parent 6fe0032640
commit 12e0246e4f
5 changed files with 55 additions and 54 deletions

View file

@ -446,7 +446,7 @@ local function format(bufnr, queries)
}
local root = ts.get_parser(bufnr, 'query'):parse(true)[1]:root()
local query = ts.query.parse('query', queries)
for id, node, metadata in query:iter_captures(root, bufnr) do
for id, node, metadata in query:iter_captures(root, bufnr, nil, nil, { match_limit = 1024 }) do
if query.captures[id]:sub(1, 1) ~= '_' then
map[query.captures[id]][node:id()] = metadata and (metadata[id] and metadata[id] or metadata)
or {}