Skip to content

.formatter.exs not used #421

Open
Open
@zizhengtai

Description

@zizhengtai

I'm having this weird problem where elixir-format doesn't respect the .formatter.exs file in my project's root directory when I follow the settings here.

How to reproduce:

  1. mix new a project and change the generated .formatter.exs to be
# Used by "mix format"
[
  inputs: []
]

which should not format anything. Assume the project is located at ~/Projects/test.

  1. Mess with the format of mix.exs in some way, and run mix format from the project root directory manually to confirm that mix.exs doesn't get formatted.

  2. Now open mix.exs with Emacs, enable projectile-mode, and run elixir-format. This time mix.exs does get formatted, although the value of elixir-format-arguments is shown to be ("--dot-formatter" "~/Projects/test/.formatter.exs").

My elixir-mode settings:

(use-package elixir-mode
  :ensure t
  :config
  (add-hook 'elixir-format-hook
            (lambda () (if (projectile-project-p)
                           (setq elixir-format-arguments
                                 (list "--dot-formatter"
                                       (concat (locate-dominating-file
                                                buffer-file-name
                                                ".formatter.exs")
                                               ".formatter.exs")))
                           (setq elixir-format-arguments nil)))))

No matter what I do, the file always gets formatted when I run elixir-format. I'm not sure whether I'm configuring things incorrectly or hitting a bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions