aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/inspect_tree_spec.lua
diff options
context:
space:
mode:
authoraltermo <107814000+altermo@users.noreply.github.com>2024-02-06 21:51:53 +0100
committerGitHub <noreply@github.com>2024-02-06 14:51:53 -0600
commitc0b99bb1de8de967d82fc29780996ed4060516c1 (patch)
treece7d547282a95ffbe428871c93bbfb21611eaf5a /test/functional/treesitter/inspect_tree_spec.lua
parentc4417ae70c03815c2fb64edb479017e79d223cf7 (diff)
downloadrneovim-c0b99bb1de8de967d82fc29780996ed4060516c1.tar.gz
rneovim-c0b99bb1de8de967d82fc29780996ed4060516c1.tar.bz2
rneovim-c0b99bb1de8de967d82fc29780996ed4060516c1.zip
feat(treesitter): show root nodes in :InspectTree (#26944)
Co-authored-by: altermo <> Co-authored-by: Jongwook Choi <wookayin@gmail.com>
Diffstat (limited to 'test/functional/treesitter/inspect_tree_spec.lua')
-rw-r--r--test/functional/treesitter/inspect_tree_spec.lua62
1 files changed, 34 insertions, 28 deletions
diff --git a/test/functional/treesitter/inspect_tree_spec.lua b/test/functional/treesitter/inspect_tree_spec.lua
index 0102838b82..a3d44ff906 100644
--- a/test/functional/treesitter/inspect_tree_spec.lua
+++ b/test/functional/treesitter/inspect_tree_spec.lua
@@ -26,9 +26,10 @@ describe('vim.treesitter.inspect_tree', function()
]])
expect_tree [[
- (function_call ; [0, 0] - [0, 7]
- name: (identifier) ; [0, 0] - [0, 5]
- arguments: (arguments)) ; [0, 5] - [0, 7]
+ (chunk ; [0, 0] - [2, 0]
+ (function_call ; [0, 0] - [0, 7]
+ name: (identifier) ; [0, 0] - [0, 5]
+ arguments: (arguments))) ; [0, 5] - [0, 7]
]]
end)
@@ -44,11 +45,12 @@ describe('vim.treesitter.inspect_tree', function()
feed('a')
expect_tree [[
- (function_call ; [0, 0] - [0, 7]
- name: (identifier) ; [0, 0] - [0, 5]
- arguments: (arguments ; [0, 5] - [0, 7]
- "(" ; [0, 5] - [0, 6]
- ")")) ; [0, 6] - [0, 7]
+ (chunk ; [0, 0] - [2, 0]
+ (function_call ; [0, 0] - [0, 7]
+ name: (identifier) ; [0, 0] - [0, 5]
+ arguments: (arguments ; [0, 5] - [0, 7]
+ "(" ; [0, 5] - [0, 6]
+ ")"))) ; [0, 6] - [0, 7]
]]
end)
@@ -66,16 +68,18 @@ describe('vim.treesitter.inspect_tree', function()
]])
expect_tree [[
- (section ; [0, 0] - [4, 0]
- (fenced_code_block ; [0, 0] - [3, 0]
- (fenced_code_block_delimiter) ; [0, 0] - [0, 3]
- (info_string ; [0, 3] - [0, 6]
- (language)) ; [0, 3] - [0, 6]
- (block_continuation) ; [1, 0] - [1, 0]
- (code_fence_content ; [1, 0] - [2, 0]
- (return_statement) ; [1, 0] - [1, 6]
- (block_continuation)) ; [2, 0] - [2, 0]
- (fenced_code_block_delimiter))) ; [2, 0] - [2, 3]
+ (document ; [0, 0] - [4, 0]
+ (section ; [0, 0] - [4, 0]
+ (fenced_code_block ; [0, 0] - [3, 0]
+ (fenced_code_block_delimiter) ; [0, 0] - [0, 3]
+ (info_string ; [0, 3] - [0, 6]
+ (language)) ; [0, 3] - [0, 6]
+ (block_continuation) ; [1, 0] - [1, 0]
+ (code_fence_content ; [1, 0] - [2, 0]
+ (chunk ; [1, 0] - [2, 0]
+ (return_statement)) ; [1, 0] - [1, 6]
+ (block_continuation)) ; [2, 0] - [2, 0]
+ (fenced_code_block_delimiter)))) ; [2, 0] - [2, 3]
]]
end)
@@ -94,16 +98,18 @@ describe('vim.treesitter.inspect_tree', function()
feed('I')
expect_tree [[
- (section ; [0, 0] - [4, 0] markdown
- (fenced_code_block ; [0, 0] - [3, 0] markdown
- (fenced_code_block_delimiter) ; [0, 0] - [0, 3] markdown
- (info_string ; [0, 3] - [0, 6] markdown
- (language)) ; [0, 3] - [0, 6] markdown
- (block_continuation) ; [1, 0] - [1, 0] markdown
- (code_fence_content ; [1, 0] - [2, 0] markdown
- (return_statement) ; [1, 0] - [1, 6] lua
- (block_continuation)) ; [2, 0] - [2, 0] markdown
- (fenced_code_block_delimiter))) ; [2, 0] - [2, 3] markdown
+ (document ; [0, 0] - [4, 0] markdown
+ (section ; [0, 0] - [4, 0] markdown
+ (fenced_code_block ; [0, 0] - [3, 0] markdown
+ (fenced_code_block_delimiter) ; [0, 0] - [0, 3] markdown
+ (info_string ; [0, 3] - [0, 6] markdown
+ (language)) ; [0, 3] - [0, 6] markdown
+ (block_continuation) ; [1, 0] - [1, 0] markdown
+ (code_fence_content ; [1, 0] - [2, 0] markdown
+ (chunk ; [1, 0] - [2, 0] lua
+ (return_statement)) ; [1, 0] - [1, 6] lua
+ (block_continuation)) ; [2, 0] - [2, 0] markdown
+ (fenced_code_block_delimiter)))) ; [2, 0] - [2, 3] markdown
]]
end)
end)