mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-06 05:20:00 -04:00
deprecate get_node_range and is_in_node_range
This commit is contained in:
parent
148cf37572
commit
2c2430d42f
2 changed files with 17 additions and 50 deletions
|
|
@ -1,45 +1,5 @@
|
|||
local tsutils = require "nvim-treesitter.ts_utils"
|
||||
|
||||
describe("is_in_node_range", function()
|
||||
local function test_is_in_node_range(line, col)
|
||||
local node = {
|
||||
range = function()
|
||||
return unpack { 0, 3, 2, 5 }
|
||||
end,
|
||||
}
|
||||
return tsutils.is_in_node_range(node, line, col)
|
||||
end
|
||||
|
||||
it("returns false before node start", function()
|
||||
assert.is_false(test_is_in_node_range(0, 0))
|
||||
assert.is_false(test_is_in_node_range(0, 1))
|
||||
assert.is_false(test_is_in_node_range(0, 2))
|
||||
end)
|
||||
|
||||
it("returns true at node start", function()
|
||||
assert.is_true(test_is_in_node_range(0, 3))
|
||||
end)
|
||||
|
||||
it("returns true on first line of the node", function()
|
||||
assert.is_true(test_is_in_node_range(0, 4))
|
||||
end)
|
||||
|
||||
it("returns true between node lines", function()
|
||||
assert.is_true(test_is_in_node_range(1, 2))
|
||||
assert.is_true(test_is_in_node_range(1, 20))
|
||||
end)
|
||||
|
||||
it("returns false on node end", function()
|
||||
-- Ranges are end-exclusive
|
||||
assert.is_false(test_is_in_node_range(2, 5))
|
||||
end)
|
||||
|
||||
it("returns false after node end", function()
|
||||
assert.is_false(test_is_in_node_range(2, 6))
|
||||
assert.is_false(test_is_in_node_range(3, 0))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("update_selection", function()
|
||||
local function get_updated_selection(case)
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, case.lines)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue