Ghcide: FormattingProvider

Created on 23 Jan 2020  路  16Comments  路  Source: haskell/ghcide

enhancement

Most helpful comment

Ghcide has a much simpler plugin model, directly mirroring LSP. We're all getting together this weekend to try and converge on one IDE.

All 16 comments

The idea was that things like Hoogle, HLint and Ormolu could be ghcide plugins. They don't need to be in the core, but could easily be layered on top. However, no one has done any plugins yet. It's definitely planned to write them.

Cool. I think as soon there is the first implementation (tested and documented), it can serve as a blueprint for more plugins and it'll be quite easy to adapt and integrate more linters/formatters.

Do you have any thoughts on what the plugin architecture would be? Or is it really a case of using ghcide as a library and adding some extra nodes into the build graph (and some new providers)?

runLanguageServer has as its second argument a PartialHandler. You can compose PartialHandler values with a monoid, so the idea would be each plugin providers a partial handler and you just join those all up. We actually structure the library like this internally, see https://github.com/digital-asset/ghcide/blob/c122ebdc4fbe406d8a8d4da3b46706b49e80557c/src/Development/IDE/LSP/LanguageServer.hs#L99-L106 which is 10 partial handlers joined together.

Right, so the idea is to build your own custom ghcide, a bit like how you would compose your own xmonad binary?

@ocharles originally, yes. However, I'm not 100% convinced, it might be that there's ghcide-core, ghcide which has all the "standard" tools, and then if you want liquid haskell or similar you compose your own.

Got it, thanks! Sorry for taking this off topic :)

It seems like a shame to duplicate effort on plugins for both hie and ghcide.
Hie already has lots of plugins and may soon use ghcide (https://github.com/haskell/haskell-ide-engine/issues/1416#issuecomment-570090407).

Ghcide has a much simpler plugin model, directly mirroring LSP. We're all getting together this weekend to try and converge on one IDE.

FYI the required infrastructure should materialise as a result of https://github.com/haskell/ide/issues/30

Looking forward to it

See https://github.com/digital-asset/ghcide/issues/104#issuecomment-595881587 for workaround to use brittany with ghcide with a language client like CoC.

FYI the branch at https://github.com/haskell/haskell-language-server/pull/45 has both floskell and ormolu integrated, selectable as in hie.

And I am hoping to clean it up and get it landed fairly soon, the concept looks good (to me)

hls already supports several formatters as plugins and ghcide will not include them so closing

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bubba picture bubba  路  4Comments

meditans picture meditans  路  6Comments

domenkozar picture domenkozar  路  3Comments

sshine picture sshine  路  8Comments

decapo01 picture decapo01  路  4Comments