emacs-format-all-the-code icon indicating copy to clipboard operation
emacs-format-all-the-code copied to clipboard

[Feature Request] Support mint-lang.

Open zw963 opened this issue 3 years ago • 4 comments
trafficstars

https://mint-lang.com/guide/getting-started/tools

Following is a usage example:

 ╰─ $ 1  mint format source/Main.mint 
Mint - Formatting files
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All files are formatted!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All done in 299μs!

Thank you.

zw963 avatar Jun 29 '22 17:06 zw963

Looks doable. If someone sends a PR, I'll merge it.

  • You'll have to use --stdin.
  • You may or may not have to use --env so that it finds its configuration file. format-all--locate-file can help.
$ mint format --help
Usage:
  mint format [flags...] <pattern> [arg...]

Formats source files

Flags:
  --check    # Checks that formatting code produces no changes
  --env, -e  # Loads the given .env file
  --help     # Displays help for the current command.
  --stdin    # Formats Mint code from STDIN

Arguments:
  pattern    # The pattern which determines which files to format

lassik avatar Jul 01 '22 06:07 lassik

Another issue is, mint format will return code 1 if current file formatted by this command.

i consider this probably a design error, mint format --check exactly do this things, instead, i consider the correct process is, if mint format run successful, whatever formatted file no no any changes made, it should always return code 0.

if need do some extra step for this?

zw963 avatar Jul 01 '22 11:07 zw963

Thanks for investigating it.

Indeed, almost all other formatters use exit code 0 even when they did not make any changes to the code.

format-all--buffer-hard can work around it, but it would be better to fix the upstream mint format. Can you ask in their issue tracker?

lassik avatar Jul 01 '22 12:07 lassik

Thanks for investigating it.

Indeed, almost all other formatters use exit code 0 even when they did not make any changes to the code.

format-all--buffer-hard can work around it, but it would be better to fix the upstream mint format. Can you ask in their issue tracker?

Maybe i am wrong, if use like this, cat source/Main.mint |mint format --stdin, it seem like always return 0 whatever if content was changed.

zw963 avatar Jul 01 '22 12:07 zw963