-
Notifications
You must be signed in to change notification settings - Fork 81
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
Support a --compatible
flag
#1126
Comments
Not directly related to the workaround you are proposing, but if it is possible to run the HLS executable in VSCode, one can run
to see the Ormolu version. Also, there is the the following HLS config option:
This is also available in the VSCode extension. This way, VSCode HLS users can also use the CLI, and it is much easier to control the precise Ormolu version here as you point out. Just mentioning this in case this works for your use case, as it seems much simpler a priori compared to implementing this ticket and/or #1127. Let me know if that works for you! |
Thanks, but I'm not actually able to see the version, just the word
|
Ah, this seems to be a new-ish feature of HLS, it works starting with HLS 2.6: haskell/haskell-language-server#3903 FTR, I am seeing this with a local HLS 2.7: $ haskell-language-server --list-plugins | grep ormolu
ormolu:
Provides formatting of Haskell files via ormolu. Built with ormolu-0.7.4.0 |
@amesgen Thanks! Part of the issue is definitely that I don’t use VSCode myself, so it’s hard to help diagnose things. And then there are outside contributors who might not configure things the same way as employees, etc. I find that Not an Ormolu problem, but it’s slighly unfortunate that the VSCode plugin doesn’t allow for direct configuration of Ormolu (I don’t think). It just gets whichever one is used for building the HLS that is selected, at the time that the plugin is first activated. So VSCode users seem likely to end up with varied versions. I haven’t found anything in the docs, but it’d be helpful if there was some guidance in general on how to get consistent formatting across large/fluctuating sets of contributors. E.g.,
And finally, just thanks for Ormolu – if nothing else it has largely killed the leading-comma abomination 😆 |
Ah, yeah. I just discovered and came back to share the same thing, about HLS 2.6+ I see also that since HLS 2.1, you can see the ormolu version in the HLS log output, if the log level is set to debug; so that solves my problem. Sorry for polluting this thread about it. |
Relevant: haskell/haskell-language-server#411 |
It can be difficult to get all developers on a single release of Ormolu (e.g., users of VSCode apparently have no idea what version they’re using, and no way to change it).
Instead of forcing developers to be on the same version, support a
--compatible
flag, so thatormolu
is older than 0.5.2.0E.g., I forget which version introduced it, but formatting
myFun :: Functor f => f a -> f b
asmyFun :: (Functor f) => f a -> f b
is a backward compatible change, as no version (at least not >=0.5.2.0) will remove the parens from the constraint.But if 0.5.2.0 coverted
(x y)
to( x y )
, but then 0.7.0.0 converted( x y )
to(x y)
, runningormolu-0.7.0.0 --compatible 0.5.2.0
would’t remove spaces inside parens, to avoid cycles of changes.This effectively sets a lower bound on the version (and perhaps an upper-bound, as at some point it might be impractical to keep managing things that worked a dozen versions ago, so then you fail saying “0.5.2.0’s format is no longer supported”).
The text was updated successfully, but these errors were encountered: