mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
treesitter: unknown predicates always match #12173
This commit is contained in:
parent
42b441738d
commit
e5022c61ed
@ -159,6 +159,9 @@ function Query:match_preds(match, pattern, bufnr)
|
|||||||
end
|
end
|
||||||
local regexes = self.regexes[pattern]
|
local regexes = self.regexes[pattern]
|
||||||
for i, pred in pairs(preds) do
|
for i, pred in pairs(preds) do
|
||||||
|
-- Here we only want to return if a predicate DOES NOT match, and
|
||||||
|
-- continue on the other case. This way unknown predicates will not be considered,
|
||||||
|
-- which allows some testing and easier user extensibility (#12173).
|
||||||
if pred[1] == "eq?" then
|
if pred[1] == "eq?" then
|
||||||
local node = match[pred[2]]
|
local node = match[pred[2]]
|
||||||
local node_text = get_node_text(node, bufnr)
|
local node_text = get_node_text(node, bufnr)
|
||||||
@ -184,9 +187,9 @@ function Query:match_preds(match, pattern, bufnr)
|
|||||||
if start_row ~= end_row then
|
if start_row ~= end_row then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return regexes[i]:match_line(bufnr, start_row, start_col, end_col)
|
if not regexes[i]:match_line(bufnr, start_row, start_col, end_col) then
|
||||||
else
|
return false
|
||||||
return false
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user