Skip to content

I was looking for a pattern that contains ".mint" files, such as "source/**/*.mint", Got "...." when running mint format. #549

@zw963

Description

@zw963

I am try to fixing format buffer feature use mint format in the emacs-mint-mode issue.

After some debug, i get following error message instead.

Mint - Formatting files[
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
I was looking for a pattern that contains ".mint" files,
such as "source/**/*.mint". Got "/home/common/Study/Mint/test_formatter/source/Main.mint" instead.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 3.502ms!

It wired, because, because sure i can run command successful in my konsole.

 ╭─ 21:07  zw963 ⮀ ~/Study/Mint/test_formatter ⮀ ⭠ (30f376c) master *%  ➦ ruby-3.1.0 
 ╰─ $ mint format  /home/common/Study/Mint/test_formatter/source/Main.mint
Mint - Formatting files
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Formatted: /home/common/Study/Mint/test_formatter/source/Main.mint
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 314μs!
 ╰─ $ 1  pwd
/home/zw963/Study/Mint/test_formatter

The above issue will happen if current PWD directory is not the project root

 ╰─ $ cd ~

 ╭─ 21:10  zw963 ⮀ ~ ⮀ ➦ ruby-3.1.0  0 
 ╰─ $ mint format  /home/common/Study/Mint/test_formatter/source/Main.mint
Mint - Formatting files
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
I was looking for a pattern that contains ".mint" files,
such as "source/**/*.mint". Got "/home/common/Study/Mint/test_formatter/source/Main.mint" instead.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 3.554ms!

In this case, mint format never format file.

So, the really issue is, we need a way to told formatter, where is the project root.

Following is some solution:

  1. like crystal tool format, i can run any file outside project root.
  2. mint format provided a command line option for specify the path of mint.json, then, when formatter do format,
    can pass this argument, for my case, format can do like this:
    mint format --config /home/common/Study/Mint/test_formatter/ /home/common/Study/Mint/test_formatter/source/Main.mint
  3. Or support set a environment variable, where project root is, mint format can read it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions