diff options
author | mangkoran <afnazrie@gmail.com> | 2024-06-25 10:21:22 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 20:21:22 -0700 |
commit | ac6e142a10c8817762f55a35ed6cb9632671ec79 (patch) | |
tree | fd4370257bafa0fb412ff3a44f570c11a6d69b4f /lua/conform/formatters/djlint.lua | |
parent | 30e26998b59b614900b59299ee61b385c3c51212 (diff) |
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
Diffstat (limited to 'lua/conform/formatters/djlint.lua')
-rw-r--r-- | lua/conform/formatters/djlint.lua | 8 |
1 files changed, 4 insertions, 4 deletions
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", }), |