-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix Haskell ormolu
fixer
#4654
base: master
Are you sure you want to change the base?
Fix Haskell ormolu
fixer
#4654
Conversation
- Enable --stdin-input-file . option by default - Use same pattern as other Haskell fixers
autoload/ale/fixers/ormolu.vim
Outdated
\ 'command': l:executable | ||
\ . (empty(l:options) ? '' : ' ' . l:options) | ||
\ . ' --stdin-input-file ' | ||
\ . ale#Escape(@%), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@%
may not be the current file at the time the linter runs, as this code could be executed from a different buffer. Instead get the filename using the a:buffer
variable. ALE has a shorthand for this where you can use %s
in the command string. See :help ale-command-format-strings
.
Have a look at changelogs and make sure the --stdin-input-file
argument is available in old enough ormolu
versions. If it's not available in older versions, you can make this fixer function still compatible with older versions with the ale#semver
functions and a version check. You can grep the codebase for other fixers that run version checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being slow to respond but thanks for the feedback!
@% may not be the current file at the time the linter runs, as this code could be executed from a different buffer. Instead get the filename using the a:buffer variable. ALE has a shorthand for this where you can use %s in the command string. See :help ale-command-format-strings.
👍
Have a look at changelogs and make sure the --stdin-input-file argument is available in old enough ormolu versions. If it's not available in older versions, you can make this fixer function still compatible with older versions with the ale#semver functions and a version check. You can grep the codebase for other fixers that run version checks.
ormolu
is a Haskell program which uses Haskell PVP which AFAIU means the ale#semver
functions won't work. I couldn't find usage of PVP version checks in the codebase, but I guess one option would be to create a similar ale#pvp
module. Does that sound reasonable or do you know of a better way to solve this?
This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See |
ormolu
fixer doesn't work out of the box #4593 by enablingormolu
's--stdin-input-file
option by default.stack
. Note: I haven't been able to test this since I haven't found a way to makestack
work on my setup (NixOS
andcabal
).