From 059fbc487c62a5e109143254b720a5dc33201a34 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 22 Jan 2022 14:50:51 +0100 Subject: indents: allow aligned_indent for unfinished calls in C and Python --- lua/nvim-treesitter/indent.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index a86b5baf5..55b341f34 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -122,7 +122,8 @@ function M.get_indent(lnum) is_processed = true end - if q.aligned_indent[node:id()] and srow ~= erow then + -- do not indent for nodes that starts-and-ends on same line and starts on target line (lnum) + if q.aligned_indent[node:id()] and srow ~= erow and (srow ~= lnum - 1) then local metadata = q.aligned_indent[node:id()] local opening_delimiter = metadata.delimiter:sub(1, 1) local o_delim_node, pos = get_matching_prev_sibling(node, { srow, #vim.fn.getline(srow + 1) - 1 }, function(n) -- cgit v1.2.3-70-g09d2