aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2022-01-22 14:50:51 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-02-05 18:54:55 +0100
commit059fbc487c62a5e109143254b720a5dc33201a34 (patch)
tree24fac44f1ef8996b99b9323bcb0178ccca899aea /lua
parentindents(cpp): indent at field_initializer_list (diff)
downloadnvim-treesitter-059fbc487c62a5e109143254b720a5dc33201a34.tar
nvim-treesitter-059fbc487c62a5e109143254b720a5dc33201a34.tar.gz
nvim-treesitter-059fbc487c62a5e109143254b720a5dc33201a34.tar.bz2
nvim-treesitter-059fbc487c62a5e109143254b720a5dc33201a34.tar.lz
nvim-treesitter-059fbc487c62a5e109143254b720a5dc33201a34.tar.xz
nvim-treesitter-059fbc487c62a5e109143254b720a5dc33201a34.tar.zst
nvim-treesitter-059fbc487c62a5e109143254b720a5dc33201a34.zip
indents: allow aligned_indent for unfinished calls in C and Python
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/indent.lua3
1 files changed, 2 insertions, 1 deletions
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)