Closed radbasa closed 2 months ago
ts_root <- function(source_text) { ts_parser <- treesitter::parser(treesitter.r::language()) parsed_tree <- treesitter::parser_parse(ts_parser, source_text) treesitter::tree_root_node(parsed_tree) } code <- " box::use( stringr, tidyr, )" ts_tree <- ts_root(code) start <- treesitter::node_start_point(ts_tree) end <- treesitter::node_end_point(ts_tree)
With treesitter.r 1.0.1:
(program [(3, 0), (6, 1)] (call [(3, 0), (6, 1)] ... ) ) <tree_sitter_point> Row: 3 Column: 0 <tree_sitter_point> Row: 6 Column: 1
Take note of the program node. Starts at row 3. It should be row 0. The call node is correct at row 3.
With treesitter.r 1.1.0:
(program [(0, 0), (6, 1)] (call [(3, 0), (6, 1)] ... ) ) <tree_sitter_point> Row: 0 Column: 0 <tree_sitter_point> Row: 6 Column: 1
The program node now starts at row 0.
With treesitter.r 1.0.1:
Take note of the program node. Starts at row 3. It should be row 0. The call node is correct at row 3.
With treesitter.r 1.1.0:
The program node now starts at row 0.