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

Provide all format suggestions in AlternatFormat Code Action #2790

Merged
merged 10 commits into from
Mar 21, 2022

Conversation

drsooch
Copy link
Collaborator

@drsooch drsooch commented Mar 20, 2022

Closes #2772

Previously the alternate format plugin would only generate code actions based on enabled extensions. With this PR we now provide all formats as code actions and when necessary insert the required extension.

This PR also refactors a portion of the logic internal to the plugin so we can track the Extensions needed. Overall, functionality remains the same.

- Add new function that converts a NextPragmaInfo (identifies the
  location to insert a new Pragma) into an Insertion that will insert
  the new Extension

- Provide all format choices instead of only currently active extensions
Copy link
Collaborator

@pepeiborra pepeiborra left a comment

Choose a reason for hiding this comment

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

The ghcide changes look fine to me

@@ -2,4 +2,4 @@
module TIntDtoND where

convertMe :: Integer
convertMe = 125.345e3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you mean to change this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I updated the way Integers are converted into NumDecimal Format

@michaelpj
Copy link
Collaborator

Genuine test failure?

@drsooch
Copy link
Collaborator Author

drsooch commented Mar 21, 2022

No, I forgot that files with no explicit default-language defaults to GHC2021 which includes the extensions we are trying to add. The golden test expects the extension to be added.

@michaelpj
Copy link
Collaborator

Great, and thanks for updating the docs nicely!

@michaelpj michaelpj added the merge me Label to trigger pull request merge label Mar 21, 2022
@mergify mergify bot merged commit a832491 into haskell:master Mar 21, 2022
@drsooch drsooch deleted the alt-num-fmt-allow-all branch March 22, 2022 00:54
July541 pushed a commit to July541/haskell-language-server that referenced this pull request Mar 30, 2022
…#2790)

* Insert Language Extensions when required

- Add new function that converts a NextPragmaInfo (identifies the
  location to insert a new Pragma) into an Insertion that will insert
  the new Extension

- Provide all format choices instead of only currently active extensions

* Update Test Suite

* Update Documentation

* Miscellaneous Cleanup

* Push extraneous functions into where bindings

* Remove unneeded logging

* Add Haskell2010 pragma to fix 9.2 tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide All Alternate Number Formats regardless of Enabled Language Extensions
3 participants