-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
gracefully handle errors for unsupported cabal version #4425
base: master
Are you sure you want to change the base?
gracefully handle errors for unsupported cabal version #4425
Conversation
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.
LGTM, thanks!
c8db13a
to
1116c31
Compare
Signed-off-by: Julian Kalema Lukwata <[email protected]>
1116c31
to
9460d61
Compare
295dcb8
to
40173f4
Compare
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.
One little improvement to the much appreciated error message!
Otherwise, LGTM and we can merge.
@@ -252,12 +252,13 @@ cabalRules recorder plId = do | |||
-- We don't support the cabal version, this should not be an error, as the | |||
-- user did not do anything wrong. Instead we cast it to a warning | |||
regex = "Unsupported cabal-version [0-9]+.[0-9]*" | |||
unsupportedCabalHelpText = "\nThe used cabal version is not fully supported by hls. This means that some functionallity might not work as expected.\nIf you face any issues try to downgrade to a supported cabal version." |
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.
We can get the set of supported versions from https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Completion/Data.hs#L33 and display it here for the best UX.
You can pull out the lower bound into its own dedicated variable, e.g.
lowestSupportedCabalVersion = CabalSpecV2_2
and then use that. Or pull out the list of supported cabal versions... Either way is fine.
This PR makes sure that line number 0 returned from cabal is handled correctly.
This caused the marking of the whole cabal file if the cabal version is not supported as described in #4401