aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/nvim-treesitter/incremental_selection.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/incremental_selection.lua b/lua/nvim-treesitter/incremental_selection.lua
index 045e7db23..3e1b51b9b 100644
--- a/lua/nvim-treesitter/incremental_selection.lua
+++ b/lua/nvim-treesitter/incremental_selection.lua
@@ -55,13 +55,18 @@ local function select_incremental(get_parent)
local root = parsers.get_parser().tree:root()
local node = root:named_descendant_for_range(csrow, cscol, cerow, cecol)
ts_utils.update_selection(buf, node)
- selections[buf] = { [1] = node }
+ if nodes and #nodes > 0 then
+ table.insert(selections[buf], node)
+ else
+ selections[buf] = { [1] = node }
+ end
return
end
local node = get_parent(nodes[#nodes])
if not node then return end
+ table.insert(selections[buf], node)
if node ~= nodes[#nodes] then
table.insert(nodes, node)
end