mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 11:36:54 -04:00
Make make-range! more relaxed (one of the arguments maybe nil)
This commit is contained in:
parent
7fa67b490f
commit
00d5408527
1 changed files with 2 additions and 2 deletions
|
|
@ -26,8 +26,8 @@ end
|
|||
|
||||
function TSRange.from_nodes(buf, start_node, end_node)
|
||||
TSRange.__index = TSRange
|
||||
local start_pos = {start_node:start()}
|
||||
local end_pos = {end_node:end_()}
|
||||
local start_pos = start_node and {start_node:start()} or {end_node:start()}
|
||||
local end_pos = end_node and {end_node:end_()} or {start_node:end_()}
|
||||
return setmetatable(
|
||||
{
|
||||
start_pos = {start_pos[1], start_pos[2], start_pos[3]},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue