Open michaelpj opened 1 year ago
This would help the user in e.g. https://github.com/haskell/haskell-language-server/issues/3618 to know what's going on.
It would also be nice to know whether a plugin is enabled or not. We could imagine having something like:
#if stylish-haskell
StylishHaskell.plugin
#else
disabledPlugin "stylish-haskell" "Say something about why here?"
#endif
Then --list-plugins
could also show that plugins are disabled.
I think that this could let us push much more conditional logic into the plugin packages, which might be nice.
For example, we could have something like this in hls-stylish-haskell-plugin.cabal
:
flag hls-stylish-haskell-enabled
library
...
if flag(hls-stylish-haskell-enabled)
build-depends: stylish-haskell
cpp-options: -Dhls_stylishHaskell
exposed-modules: StylishHaskell4Real
and then in StylishHaskell.hs
:
#if hls_stylishHaskell
import StylishHaskell4Real as Real
#endif
descriptor :: PluginDescriptor
descriptor = PluginDescriptor {
description = "Plugin that provides formatting with stylish-haskell"
#if hls_stylishHaskell
, pluginHandlers = Real.pluginHandlers
, status = Enabled
#else
, pluginHandlers = mempty
, status = Disabled "Plugin is disabled"
#endif
}
Then in the main HLS executable we can unconditionally depend on the stylish-haskell plugin, and we'll either get the real plugin or a placeholder "disabled" plugin, depending.
Thinking a bit, what information should have for a specific plugin?
Besides ormolu
and fourmolu
, every formatter is bundled with only one ghc version...
And other plugins seems don't have any words to say...
Brainstorming:
VERSION_pkgname
)Some of this we already know, but might need more annotation in order to let us show it to the user in a readable way.
Before making a decision here, should we add a log while formatters are activated to describe its version?
At the moment we know a little bit about plugins, but mostly their names. It would be nice if plugins could provide us with some extra information: a description, perhaps some optional version information about what key libraries it was built against (e.g. ormolu).
We could then at least log this information when we startup.