tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
954 stars 83 forks source link

Provide a way to determine which version of ormolu is formatting a document? #1127

Open aryairani opened 3 months ago

aryairani commented 3 months ago

Is your feature request related to a problem? Please describe.

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).

When running ormolu from the command line, I can run ormolu --version to find out what version I'm using. But if I just have the ormolu library, built into HLS, managed by a VSCode extension, I don't know how to find out what version of ormolu my document is being formatted with.

Describe the solution you'd like

Add another magic comment: {- ORMOLU_VERSION -} be replaced by the version string in some capacity

e.g. {- ORMOLU_VERSION -} becomes {- ORMOLU_VERSION 0.7.6.0 -}

or something like that.

Describe alternatives you've considered

Not sure if {- ORMOLU_VERSION 0.7.6.0 -} should be changed, if it's being formatted by a different version of ormolu, or not.

Additional context

amesgen commented 3 months ago

Also see https://github.com/tweag/ormolu/issues/1126#issuecomment-2204522326 which might address the underlying problem that the "integrated" HLS Ormolu support is not optimal.