Skip to content

feature request(djlint): respect editorconfig/local buffer tabstop #457

Description

@mangkoran

Did you check existing requests?

  • I have searched the existing issues

Describe the feature

djlint could format buffer with indent config based on editorconfig/local buffer tabstop

Provide background

I found that djlint supports indent config argument. It would be nice if this could be incorporated to conform config so that it could run djlint with config based on local buffer tabstop which is set based on editorconfig.

What is the significance of this feature?

nice to have

Additional details

I found a bit similar feature in markdown-toc config that could respect local buffer tabstop (although it's just check whether it's space or tab).

I would like to try to implement this feature so any guidance/suggestion is welcome.

Additionally, I think this feature could be implemented to all formatters that support indent config like this (however I have no idea what the formatters are).

Activity

  1. mangkoran commented on Jun 15, 2024

    @mangkoran
    ContributorAuthor

    I tried the following config (I use LazyVim) and it works.

      {
        "stevearc/conform.nvim",
        opts = {
          formatters_by_ft = {
            htmldjango = { "djlint" },
          },
          formatters = {
            djlint = {
              args = function(self, ctx)
                local indent = vim.bo[ctx.buf].tabstop or 4
                return { "-", "--reformat", "--indent", indent }
              end,
            },
          },
        },
      },
  2. stevearc commented on Jun 16, 2024

    @stevearc
    Owner

    This looks like it would make a reasonable pull request

  3. added
    P1May get worked on if I get free time. PRs welcome
    on Jun 16, 2024
  4. added 2 commits that reference this issue on Jun 23, 2024
    378573d
    722aacf
  5. added a commit that references this issue on Jun 28, 2024
    ac6e142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1May get worked on if I get free time. PRs welcomeenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions