-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Project architecture to support plugins #164
Comments
I wanted the same thing when I was working on my retrie plugin. One thought: since plugins need to access the ghcide internals as well, hls-core should probably reexport those. Slimming down |
https://github.com/digital-asset/ghcide/issues/478, I think. |
Afaiu, after #379 the part that would remain would be
|
I think a validating step would be to make a PR on an upstream such as one of the formatters, to include the plugin descriptor in it. This will help us to fine tune the API for the |
Issues related to complete the architecture:
|
I've started a POC to enable the inclusion of plugins at compile time (we dont have other alternative, right?) using cabal flags and CPP conditions: https://github.com/haskell/haskell-language-server/compare/master...jneira:cpplugins?expand=1 To assemble the desired hls version you could do:
The plan would be change the install script to take in account plugins and:
|
@jneira That can work. We have to balance having an "it just works" experience (downloading the right exe) with being able to customize things. If we download a fat exe, then compile time and deps are not the problem, but tweaking which features are visible is. So at least we need some way to have a list of enabled/disabled plugins in a config file. Perhaps we could consider doing something like https://erlang-ls.github.io/configuration/ to tweak this. Configuring the compiled-in plugins via flags controls the "official" list, and is a step in the right direction. I still think we should be able to end up with a config file that generates the part of the Main.hs that gets compiled, probably wrapped in a local cabal project to build it. ( haskell-language-server/exe/Main.hs Lines 49 to 66 in 488fd46
The config could be as simple as a list of haskell packages and the string to install them under. |
mmm, I see, I had thought in to add a common config options for all plugins to be able to enable or disable at runtime, via the config provided by the client. [{ id: "hlint",
enabled: true,
config: { prop1: val1,}},
,
] would fit that with your idea? |
Yes, provided it is idiomatic json. I would expect eventual JSON "paths" something like |
As a user, this doesn't sound very appealing to me. I'd much rather just build it with cabal, setting some flags if necessary. A potentially very evil suggestion... have we thought about doing actual dynamic object loading? i.e. have separately distributable artifacts for plugins (object files) which the main exectuable can load dynamically at runtime provided they're in some discoverable location? I've never done this with Haskell, but if it was possible it might be a nice UX. |
I foresee a future where there are a lot of plugins, and it becomes the norm for user organisations to have custom ones, providing specific features local to their environment. Packing all of this into a master cabal file will not work. And I think the dynamic module approach brings even bigger problems than it solves. And the installed plugins at a given site will not change often. What could make the process smooth would be if the config builder had a ui like in |
Issues related to complete the architecture:
All the checks are done so i think the plugin architectura,in its actual desig, is complete |
We have taken the same approach to plugins we had in haskell-ide-engine, with the same intention.
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
upghcide
.hls
. The corresponds to thehie-plugin-api
as originally envisaged.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
hls
plugin API for their tool, built against the API module. e.g. a packagefourmolu-hls
could expose a plugin descriptor forfourmolou
.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.The text was updated successfully, but these errors were encountered: