-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
Conversation
Move makeDiffTextEdit from Haskell-IDE-Engine to PluginUtils.
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 |
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.
This indirection could be removed since diffText
is pure anyways here.
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.
Which indirection? the '
on the name?
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.
yeah, there is both diffText
and diffText'
@@ -95,7 +97,7 @@ library | |||
Ide.Plugin.Brittany | |||
|
|||
if impl(ghc >= 8.6) |
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.
For a potential future commit, for hls we always have GHC >= 8.6
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.
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 |
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.
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.
Additionally:
ghc-check
Considerably simplifies the plugin, since they do the heavy lifting. See tweag/ormolu#516 for the upstream issue.
Ought to fix #48