Skip to content

Project architecture to support plugins #164

Closed
@alanz

Description

@alanz

We have taken the same approach to plugins we had in haskell-ide-engine, with the same intention.

  1. We have a plugin descriptor which defines the operations provided by the plugin
  2. 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 that Main.hs, and thus the built hls 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 the hie-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 package fourmolu-hls could expose a plugin descriptor for fourmolou.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    old_type: metaPlaning and organizing other issuesstatus: in discussionNot actionable, because discussion is still ongoing or there's no decision yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions