summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorJędrzej Boczar <yendreij@gmail.com>2021-01-07 22:29:57 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2021-01-14 13:54:43 +0100
commit42bc217a54591a75d71ad8708ac7eca309276b1b (patch)
tree258a406d0039a100c81bc85efd5cc0ee5240b9d1 /lua
parent4538a876b4a7ae289e48135ae82b3ea6b59a59dc (diff)
indent: fix wrong line number passed to descendant_for_range
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/indent.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua
index 1f49cc26..88406c68 100644
--- a/lua/nvim-treesitter/indent.lua
+++ b/lua/nvim-treesitter/indent.lua
@@ -60,7 +60,7 @@ function M.get_indent(lnum)
-- and if the node is an indent node, we should set the indent level as the indent_size
-- and we set the node as the first child of this wrapper node or the wrapper itself
if not node then
- local wrapper = root:descendant_for_range(lnum, 0, lnum, -1)
+ local wrapper = root:descendant_for_range(lnum-1, 0, lnum-1, -1)
node = wrapper:child(0) or wrapper
if indents[node_fmt(wrapper)] ~= nil and wrapper ~= root then
indent = indent_size