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

Using linter with Elm format can make warnings flicker and not show #81

Closed
7sharp9 opened this issue Aug 23, 2016 · 10 comments
Closed

Using linter with Elm format can make warnings flicker and not show #81

7sharp9 opened this issue Aug 23, 2016 · 10 comments

Comments

@7sharp9
Copy link

7sharp9 commented Aug 23, 2016

I installed elm format with this plugin and its default settings are to format on save, this seems to make the lint warnings flicker and not show up until you have saves 3 or 4 times in a row.

I can turn off format on save to get around this but it would be nice if there were a solution where format on save in elm format could be used.

@7sharp9
Copy link
Author

7sharp9 commented Aug 23, 2016

flicker warnings

This shows removing an annotation then saving, you can see the flicker when I save, then on the third save the warning shows.

@halohalospecial
Copy link
Collaborator

Hi @7sharp9! Thanks for the report. I think this is what happened in the screenshot:

  • When the file was saved, the elm-format(triforkse) Atom package ran an external elm-format(avh4) process.
  • The text in the editor was then replaced by the result from the elm-format(avh4) process.
  • There was a flicker because Atom needed to process the new text for syntax highlighting. There will be a flicker even if linter-elm-make is not installed. The flicker was noticeable because the whole buffer was replaced (instead of just parts of the buffer), therefore Atom needed to compute from scratch (this is just a guess). The flicker will also be more evident in bigger files.
  • I think the reason why you needed to save multiple times for the warning to appear is because of this bug: The 2nd time you run elm-make on a file that has warnings, the warnings will not be returned anymore.. unless the module is named Main elm-lang/elm-make#114. In summary, if the file only contains warnings and not errors, running elm-make the 2nd time (with --report=json) will not return the warnings anymore. After you manually saved the file, the elm-format(triforkse) Atom package "saved" it again when it received the results from the elm-format(avh4) process.

Right now, I'm not sure if we need to modify the behavior of the elm-format Atom package, or if there's a workaround we can do on the linter-elm-make side. Still have to think about it :)

P.S. I wonder how other editor plugins handle this.

@halohalospecial
Copy link
Collaborator

You can also try to turn on Lint On The Fly to have better results. If it is enabled, a 2nd lint will happen when elm-format saves the file again, which will show the warning.

@halohalospecial
Copy link
Collaborator

halohalospecial commented Aug 23, 2016

Also, you should only encounter these issues for warnings. If there are errors in your code, linter-elm-make + elm-format should behave properly.

@7sharp9
Copy link
Author

7sharp9 commented Aug 23, 2016

It wasn't so much the flicker, it was the fact the warning never appeared until the 3rd save. Its no big issue really as I turned of format on save. I like to choose when to format.

@halohalospecial
Copy link
Collaborator

Alrighty. I wish the elm-make bug gets fixed to prevent issues like this 😄

@halohalospecial
Copy link
Collaborator

Hi @7sharp9, I submitted a PR to elm-format to fix these issues humio/atom-elm-format#14 :-)

@7sharp9
Copy link
Author

7sharp9 commented Aug 25, 2016

Cool, @halohalospecial thanks for looping me in :-)

@halohalospecial
Copy link
Collaborator

halohalospecial commented Sep 1, 2016

Hi @7sharp9, they already published the new version of the Atom elm-format package. Maybe you can try that out?

@feldman4
Copy link

feldman4 commented Feb 11, 2017

I'm still getting this bug after updating linter-elm-make and elm-format. With Lint On The Fly, sometimes the warning sticks, sometimes not. Is this fixed?

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

3 participants