-
Notifications
You must be signed in to change notification settings - Fork 206
Conversation
This is initially based on the ghc-mod-core calls that HaRe is making.
- Add GhcMonad instance to IdeGhcM - Move cabalModuleGraphs into hie-plugin-api - No longer use ghc-mod-core MonadIO. It was a workaround for a problem with GHC from around 7.8 or so, no longer neede.
cc @mpickering |
[skip ci] [ci skip]
It looks like the only function which will need any additional effort on my branch is |
, HIE.LiftsToGhc(..) | ||
, HIE.HasGhcModuleCache(..) | ||
, HIE.cabalModuleGraphs | ||
, HIE.makeRevRedirMapFunc |
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.
Is this meant to be a one-stop import for all plugins? If so should this also export the withCachedModule
etc. functions and other helpers?
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.
@bubba the initial intention is to create as narrow as possible an API to support what HaRe needs, as a way to end up with a real world requirement on hie-bios.
And I think there possibly still needs to be a discussion about what the layers are for a plugin.
My mental model for an external tool XXX currently has it something like
- hie
- plugin within hie to intergrate XXX to hie/LSP
- XXX as a standalone tool
- part of hie exposed to interact with GHC etc, and allow the tool to be a good citizen in hie, but also to be able to run standalone.
So this file is currently aiming at the last of those, which is effectively the hie-bios. I think.
But this whole layering is something that needs discussion, I think.
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.
Perhaps we could view HIE as having two parts:
- A library for running long-lived sessions that provide access to processed information from GHC, in a relatively bulletproof fashion (i.e. using the hie-bios to work out how to talk to GHC)
- Plugins could code against this library, and it would then also provide a way to run those tools in a relatively robust way. But they wouldn't have to have a dependency on a LSP client.
- A Haskell LSP client which uses the session library and manages plugins.
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.
@michaelpj Do you mean LSP server in your comment above? The client is the IDE that talks to hie.
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.
Er yes, sorry 🤦♂️
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.
And the intended breakdown you describe is the driver behind having hie-plugin-api
which should play the role described in your first bullet point, and does so for HaRe using this branch and https://github.com/alanz/HaRe/tree/hie-plugin-api.
But I can also envisage another layer, where a third party could package something like HaRe for hie, which can then be simply included in the plugin list in app/MainHie.hs
and be usable.
So my original discussion point is whether we need to distinguish between the 'upper' and 'lower' APIs. Especially as I think there is likely to be some level of crossover in it.
It moved from the ghc-mod plugin to hie-plugin-api
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 looks good to me. setTypecheckedModule
was a very special function anyway, so moving out of the ghc-mod plugin makes sense in my eyes
Prepare
haskell-ide-engine
for a switch to the cominghie-bios
by creating aHaskell.Ide.Engine.PluginApi
module inhie-plugin-api
which provides all the features needed by a very demanding plugin (HaRe
).The API exposed by this PR is
None of these depend on
ghc-mod(-core)
directly, but the types related to the module graphs for each cabal component have been extracted fromghc-mod
into a newghc-project-types
module. That name is provisional, if someone has a better suggestion, we can do it.