mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix!: indents now rely on treesitter highlight
- Apply suggestions from Lewis to only parse visible lines - Fix failed tests
This commit is contained in:
parent
abcbe65b6e
commit
3966b8808b
2 changed files with 27 additions and 45 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue