From cd75be867f2331b22905f47d28c0c270a69466aa Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Mon, 1 Jul 2024 13:58:55 -0400 Subject: feat(shfmt): add automatic indentation detection (#481) * feat(shfmt): automatically detect indentation * fix(markdown-toc): improve correctness of indentation size calculation * fix(djlint): improve correctness of indentation size calculation * feat: add effective `shiftwidth` to `conform.Context` this also refactors formatters that automatically set indentation level to use the new shiftwidth context --- lua/conform/formatters/djlint.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lua/conform/formatters/djlint.lua') diff --git a/lua/conform/formatters/djlint.lua b/lua/conform/formatters/djlint.lua index b7a177b..13c966d 100644 --- a/lua/conform/formatters/djlint.lua +++ b/lua/conform/formatters/djlint.lua @@ -7,8 +7,7 @@ return { }, command = "djlint", args = function(_, ctx) - local indent = vim.bo[ctx.buf].tabstop or 4 -- default is 4 - return { "--reformat", "--indent", indent, "-" } + return { "--reformat", "--indent", ctx.shiftwidth, "-" } end, cwd = util.root_file({ ".djlintrc", -- cgit v1.2.3-70-g09d2