Skip to content

Update to ormolu 0.5.0 and simplify plugin #75

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

Merged
merged 4 commits into from
Apr 25, 2020

Conversation

fendor
Copy link
Collaborator

@fendor fendor commented Apr 25, 2020

Additionally:

  • Move makeDiffTextEdit from Haskell-IDE-Engine to PluginUtils.
  • Fix version constraing for ghc-check
  • Add version constraint for ormolu
  • update index-state and stack.yaml

Considerably simplifies the plugin, since they do the heavy lifting. See tweag/ormolu#516 for the upstream issue.
Ought to fix #48

fendor added 2 commits April 25, 2020 15:40
Move makeDiffTextEdit from Haskell-IDE-Engine to PluginUtils.
Comment on lines +82 to +91
diffText' :: Bool -> (Uri,T.Text) -> T.Text -> WithDeletions -> WorkspaceEdit
diffText' supports (f,fText) f2Text withDeletions =
if supports
then WorkspaceEdit Nothing (Just docChanges)
else WorkspaceEdit (Just h) Nothing
where
diff = diffTextEdit fText f2Text withDeletions
h = H.singleton f diff
docChanges = J.List [docEdit]
docEdit = J.TextDocumentEdit (J.VersionedTextDocumentIdentifier f (Just 0)) diff
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This indirection could be removed since diffText is pure anyways here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Which indirection? the ' on the name?

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, there is both diffText and diffText'

@fendor fendor requested review from alanz and jneira and removed request for alanz April 25, 2020 13:46
@@ -95,7 +97,7 @@ library
Ide.Plugin.Brittany

if impl(ghc >= 8.6)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For a potential future commit, for hls we always have GHC >= 8.6

Copy link
Collaborator

@alanz alanz left a comment

Choose a reason for hiding this comment

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

A couple of minor comments, but looks good.

I think it might be worthwhile moving the diff utilities into haskell-lsp.

@@ -51,18 +47,7 @@ descriptor plId = PluginDescriptor

provider :: FormattingProvider IO
#if __GLASGOW_HASKELL__ >= 806
Copy link
Collaborator

Choose a reason for hiding this comment

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

For future, we are not building below 8.6, can remove this. But should probably put a constraint on base in the main cabal file to enforce that.

@fendor fendor merged commit 3edfaeb into haskell:master Apr 25, 2020
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 plugin does not respect GHC options
2 participants