Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ways to determine Elm version #2

Open
lassik opened this issue Oct 7, 2018 · 2 comments
Open

Ways to determine Elm version #2

lassik opened this issue Oct 7, 2018 · 2 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@lassik
Copy link

lassik commented Oct 7, 2018

Currently elm-format supports two mutually incompatible versions of Elm and needs to know which version code is written for.

elm-format can do this by:

  1. Getting an explicit --elm-version command line option
  2. Looking for elm.json or elm-package.json in the current directory (the policy of which directories to look in may change in the next version of elm-format, see auto-detect elm version per file, instead of based on cwd avh4/elm-format#561)

There is no syntax in the Elm language to declare the Elm version directly within a source file itself.

Notably, Unibeautify needs to support formatting unnamed blobs of code that are not saved into any file. For this, the only option would be --elm-version. We need to add an equivalent option to the Unibeautify configuration file. @Glavin001 @stevenzeck Opinions on where and how to do this?

(Ping @avh4 in case you are interested. Unibeautify may be the most complex/generic real world use case for elm-format since Unibeautify is very generic itself.)

@Glavin001 Glavin001 added help wanted Extra attention is needed question Further information is requested labels Oct 7, 2018
@Glavin001
Copy link
Member

Language version may become a first class feature for Unibeautify. Prettier's Trailing Commas option has an es5 option: https://prettier.io/docs/en/options.html#trailing-commas
Whereas Unibeautify's End With Comma option is boolean (only true or false): https://unibeautify.com/docs/option-end-with-comma.html?language=javascript

I would like to be able to specify the language version (like es5 versus es6 for JavaScript, Python 2 or 3, Elm version, etc) and without an options changing (such as end-with-comma) it will adapt appropriately.

cc @stevenzeck thoughts?

@lassik
Copy link
Author

lassik commented Oct 7, 2018

A generic language version option would be a great way to solve this Elm issue IMHO 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants