Closed justanotherdot closed 7 years ago
Actioned the change noted in the first summary. Happy to make any further changes. :slightly_smiling_face:
Thanks for the PR! Taking it as is and will publish a minor rev.
Excuse the code quality, when I wrote this I was quite the Haskell newbie (and still am to a degree).
Since there's been some activity on this repository lately I'll see about making some time to clean things up a bit. Especially relevant to :Neoformat
is that I choose to return a non-zero exit code if there are any changes that need to be made. That useful for CI but :Neoformat
expects a zero exit code unless the formatter crashed. Doing return (Reformat input (reformattedSource result) result)
sort-of works around this and will exit with zero unless there were suggestions from hlint. Then it will fail and :Neoformat
will probably complain. Tracking in #19
This hopes to resolve issue #17.
I basically copied what WriteSources was doing after trying to grok the desired behaviour for about an hour. This actually allows
:Neoformat hfmt
to apply it's reformatted changes.However, I'm relatively certain (due to the code duplication) that I'm doing something wrong here. It would be ideal to know the distinction between PrintSources and WriteSources. My change basically does
writeSource
but forcing theinput
to always beInputFromStdIn
so that we'll print the passed result.I'm assuming the ideal implementation should look something like this, instead:
Actions.hs