Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fridewald
Copy link

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

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fridewald fridewald force-pushed the 4401/gracfully_handle_errors_for_unsupported_cable_version branch from c8db13a to 1116c31 Compare October 12, 2024 14:27
@fendor fendor changed the title 4401/gracfully handle errors for unsupported cable version 4401/gracfully handle errors for unsupported cabal version Oct 12, 2024
@fridewald fridewald changed the title 4401/gracfully handle errors for unsupported cabal version gracfully handle errors for unsupported cabal version Oct 12, 2024
@fridewald fridewald force-pushed the 4401/gracfully_handle_errors_for_unsupported_cable_version branch from 1116c31 to 9460d61 Compare October 13, 2024 09:57
@fridewald fridewald force-pushed the 4401/gracfully_handle_errors_for_unsupported_cable_version branch from 295dcb8 to 40173f4 Compare October 13, 2024 12:15
@fendor fendor changed the title gracfully handle errors for unsupported cabal version gracefully handle errors for unsupported cabal version Oct 13, 2024
Copy link
Collaborator

@fendor fendor left a 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."
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants