From ac6e142a10c8817762f55a35ed6cb9632671ec79 Mon Sep 17 00:00:00 2001 From: mangkoran Date: Tue, 25 Jun 2024 10:21:22 +0700 Subject: feat(djlint): use tabstop to set indentation (#467) Formatter now able to use local buffer tabstop config. One of the case is when the tabstop is set by editorconfig. Close #457 --- lua/conform/formatters/djlint.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lua/conform/formatters') diff --git a/lua/conform/formatters/djlint.lua b/lua/conform/formatters/djlint.lua index 03922bd..b7a177b 100644 --- a/lua/conform/formatters/djlint.lua +++ b/lua/conform/formatters/djlint.lua @@ -6,10 +6,10 @@ return { description = "✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang.", }, command = "djlint", - args = { - "--reformat", - "-", - }, + args = function(_, ctx) + local indent = vim.bo[ctx.buf].tabstop or 4 -- default is 4 + return { "--reformat", "--indent", indent, "-" } + end, cwd = util.root_file({ ".djlintrc", }), -- cgit v1.2.3-70-g09d2