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

Ormolu flags #246

Merged
merged 3 commits into from
Jul 31, 2020
Merged

Ormolu flags #246

merged 3 commits into from
Jul 31, 2020

Conversation

pepeiborra
Copy link
Collaborator

There's two independent changes here:

  1. Fix the rendering of the CPP extension as a flag; there might be a better way to fix this.
  2. Do not process LANGUAGE and OPTIONS pragmas for Ormolu, since I believe Ormolu is going to process those anyway. @mrkkrp is that right?

Fixes #245

ms_hspp_opts contains the LANGUAGE and OPTIONS pragmas

what we want here is the cabal/stack options instead
Because why not?
@@ -36,24 +43,24 @@ descriptor plId = (defaultPluginDescriptor plId)
-- ---------------------------------------------------------------------

provider :: FormattingProvider IO
provider _lf ideState typ contents fp _ = do
provider lf ideState typ contents fp _ = withIndefiniteProgress lf title Cancellable $ do
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we should have these for all formatting providers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In many other plugins too, specially in the Eval plugin

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.

Awesome, thanks!

@mrkkrp
Copy link

mrkkrp commented Jul 28, 2020

@pepeiborra Depends on what you mean by "process".

@pepeiborra
Copy link
Collaborator Author

@pepeiborra Depends on what you mean by "process".

Does Ormolu use ghc to parse source files? If yes, then ghc will see the language and options pragmas and act accordingly

@mrkkrp
Copy link

mrkkrp commented Jul 28, 2020

@pepeiborra In that sense, yes, we use functions from GHC to read pragmas before we run the parser.

@fendor
Copy link
Collaborator

fendor commented Jul 29, 2020

So, this is ready for merge, right?

@lukel97 lukel97 mentioned this pull request Jul 31, 2020
@fendor fendor merged commit 530ccb0 into haskell:master Jul 31, 2020
pepeiborra pushed a commit that referenced this pull request Dec 27, 2020
Hover and goto definition only work on the function name in the first clause of
a function being defined with multiple equation clauses.

Here are some tests that document this.
pepeiborra pushed a commit that referenced this pull request Dec 27, 2020
* Fix #246

`getTypeLHsBind` returned a single span corresponding to the overall function
binding. The fix drills down into the individual matches and returns a span for
each of them.

Fixes #246.

* Make it work on GHC 8.8

* Cosmetics
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.

Ormolu formatting fails with CPP pragma
4 participants