Skip to content

Commit 0dc4bc2

Browse files
committed
fix: skip use top of file indent when have treesitter
1 parent 6211f93 commit 0dc4bc2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lua/indentmini/init.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ local function make_snapshot(lnum)
8787
local parent = node:parent()
8888
if parent then
8989
local p_srow = parent:range()
90-
indent = get_indent_lnum(p_srow + 1)
91-
indent = indent + context.step
90+
-- usually top of file does not have indent so skiped
91+
if p_srow > 0 then
92+
indent = get_indent_lnum(p_srow + 1)
93+
indent = indent + context.step
94+
end
9295
end
9396
end
9497
local packed = pack_snapshot(true, indent, indent)

0 commit comments

Comments
 (0)