Closed
Description
We have taken the same approach to plugins we had in haskell-ide-engine, with the same intention.
- We have a plugin descriptor which defines the operations provided by the plugin
- This descriptor is given a "label" when it is configured in
exe/Main.hs
, which serves to uniquely identify it within the particular set of plugins configured in thatMain.hs
, and thus the builthls
executable.
This allows us to contemplate the next step wrt plugins
I propose the we split hls
up
- a slimmed-down core, that basically corresponds to the plugins built into
ghcide
. - an API package that can be used by plugin authors to write plugins for use in
hls
. The corresponds to thehie-plugin-api
as originally envisaged. - a fat package that depends on the core, the api, and all known plugins at this time, and provides an exe depending on them.
The fat module is the equivalent of what hls
is today.
The intention is to facilitate two things, much the way LSP does for servers and clients
- tool authors can provide a module exposing an
hls
plugin API for their tool, built against the API module. e.g. a packagefourmolu-hls
could expose a plugin descriptor forfourmolou
. - users can choose which plugins they actually want to use, and not pay the compilation tax for ones they are not interested in.
To make this work cleanly, we could provide a utility that would take a descriptor file listing the plugin packages and the names to be used for them, and generate an appropriate exe/Main.hs
.
And of course the existing Main.hs
would have to be slimmed down to hosting a plugin config section and then invoking something in a library.