From 42bc217a54591a75d71ad8708ac7eca309276b1b Mon Sep 17 00:00:00 2001 From: Jędrzej Boczar Date: Thu, 7 Jan 2021 22:29:57 +0100 Subject: indent: fix wrong line number passed to descendant_for_range --- lua/nvim-treesitter/indent.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index 1f49cc26b..88406c688 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 -- cgit v1.2.3-70-g09d2