From 3966b8808b36ce263111c7e177b4364d32e67a2d Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Mon, 4 Sep 2023 16:19:33 +0900 Subject: fix!: indents now rely on treesitter highlight - Apply suggestions from Lewis to only parse visible lines - Fix failed tests --- tests/query/injection_spec.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/query/injection_spec.lua') diff --git a/tests/query/injection_spec.lua b/tests/query/injection_spec.lua index 91096fee4..e90925e20 100644 --- a/tests/query/injection_spec.lua +++ b/tests/query/injection_spec.lua @@ -26,7 +26,6 @@ local function check_assertions(file) ) local parser = ts.get_parser(buf, lang) - local self = parser local top_level_root = parser:parse(true)[1]:root() for _, assertion in ipairs(assertions) do @@ -37,7 +36,7 @@ local function check_assertions(file) assertion.expected_capture_name = neg_assert and assertion.expected_capture_name:sub(2) or assertion.expected_capture_name local found = false - self:for_each_tree(function(tstree, tree) + parser:for_each_tree(function(tstree, tree) if not tstree then return end @@ -50,11 +49,11 @@ local function check_assertions(file) if assertion.expected_capture_name == tree:lang() then found = true end - end, true) + end) if neg_assert then assert.False( found, - 'Error in at ' + 'Error in ' .. file .. ':' .. (row + 1) @@ -67,7 +66,7 @@ local function check_assertions(file) else assert.True( found, - 'Error in at ' + 'Error in ' .. file .. ':' .. (row + 1) -- cgit v1.2.3-70-g09d2