elm-format (0.4.0-alpha)

152 views
Skip to first unread message

Aaron VonderHaar

unread,
Jul 3, 2016, 4:15:55 PM7/3/16
to elm...@googlegroups.com

elm-format-0.4.0-alpha is now available: https://github.com/avh4/elm-format#installation-

There are three significant syntax changes from 0.3.*-alpha:

  • multiline expressions with long infix operators now indent in a more appropriate way
  • The <| operator is now handled specially and is placed at the end of the preceding line
  • line breaks are now allowed before the first arguments to functions

Other changes:

  • #186 console output is less verbose
  • #199 files are not touched if they are already formatted
  • #191 elm-format binaries are smaller
  • #184 qualified type constructors in pattern match arguments are now handled correctly w/r to elm-compiler 0.17

What's next:

  • correctly handle -- comments at the end of lines
  • allow blank lines in lists and records
  • release a beta version and announce to elm-discuss

Thanks this release to a new contributor, @gyzerok, who helped update the CLI, including a feature that makes elm-format usable in JetBrains IDEs (#199).

That's it for the release! I have also started writing some guidelines for "elm-format approved" plugins and IDEs. If you are interested in that, read on:

"elm-format approved" plugins

This is a draft of guidelines for IDEs and IDE plugins that want to officially integrate with elm-format.

Discussion is here: https://github.com/avh4/elm-format/issues/104

The goal of elm-format is to make it as easy as possible to follow a standard, consistent style so that everyone can get the benefit of code that is easier to write, easier to read, and easier to maintain.

An "elm-format approved" plugin does the following:

  • Formatting
    • When formatting a file, if the in-memory version of the file and the on-disk version of the file differ, then the plugin should format the in-memory version of the file. (Saving the file before formatting is also acceptable.)
    • When formatting a file, the cursor position and scroll position should be maintained.
      • Currently recommended: save the cursor index into the buffer before formatting, and set the cursor to the same index after formatting
      • Future: elm-format will provide additional information for translating cursor positions (see#149)
  • Format on save
    • The default behavior should be to format any *.elm files on save when working on an Elm project if elm-format is found.
    • If linting or compilation is also triggered on save, elm-format should be run before linting or compiling.
  • Configuration

    • If the path to elm-format has not be explicitly specified by the user, the plugin should automatically find elm-format if it is located on the $PATH or in /usr/local/bin/.

      Is there an equivalent of /usr/local/bin/ for Windows?

    • If elm-format is not found, a message should be shown including a link to the elm-format installation instructions ( https://github.com/avh4/elm-format#installation- ). The message will be shown on the plugin settings screen if such a screen exists, and any time the user explicitly tries to format a file. The message may also be shown when the plugin is first installed or when saving an elm file.
  • Error handling

An "elm-format approved" IDE comes with an "elm-format approved" plugin installed and enabled, or otherwise provides all the features of an "elm-format approved" plugin.

Reply all
Reply to author
Forward
0 new messages