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

Passing the generated code through elm-format? #9

Open
qwfy opened this issue Aug 2, 2020 · 1 comment
Open

Passing the generated code through elm-format? #9

qwfy opened this issue Aug 2, 2020 · 1 comment

Comments

@qwfy
Copy link
Contributor

qwfy commented Aug 2, 2020

Some developers have their IDE/editors setup such that, when file is saved, elm-format is run to format the file. However, if there elm-coder-generator manipulates the file, the manipulated file would no longer be elm-format-valid, depending on whether or not the developer saves the file again or not, the manipulate file would have two possible formats:

  • elm-format-valid
  • not elm-format-valid

consider the following scenario:

  • the developer elm-coder-generator a file, don't save it in the IDE, commit the file to git
  • the developer changes the above file, but in a section outside of -- [generator-start] .. -- [generator-end]
  • the developer saves it in the IDE
  • the file got reformatted, including what's in -- [generator-start] .. -- [generator-end]
  • the developer try to commit the work, but found lots of formatting changes, which is noisy, both to commit and to the later code review

if we can pass the generated code through elm-format, the problem would be solved.

@janwirth
Copy link
Owner

janwirth commented Aug 3, 2020

That's great feedback. The elm-coder-generator It was developed without regard to elm-format.

I am planning to port a lot of the code to https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/ and also have a stable output when formatted.

However, as a more efficient solutioin, if you want to plug elm-format into the index.js a PR is very welcome. We don't even need a flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants