perhaps this should be named hls-render-commands-plugin as the purpose is to expose user-defined commands (in the lsp paralance)?
This is a great suggestion, I think having some word that implies “command” or “action” in the plugin name would go a long way to making it more obvious what it’s for.
it may also be useful to allow the set of allowable commands to be restricted by name via a pragma of some sort
Interesting idea, I’m curious what exactly you’re thinking this would look like?
– i.e. just because the type matches, it doesn’t mean a particular action is semantically valid for a given definition.
We’re Haskell developers; if it typechecks, it should work, right?
additionally, what does editor integration for these commands look like? e.g. in emacs, I’d want the ability to trigger elisp from these commands and I’m not that sure what it’d look like – presumably, I’d want to register hooks for new commands I’ve defined. maybe I just attach a new handler for the command to the lsp client?
I’m not very familiar with using the LSP in emacs, at the moment the commands show up as code-lenses.
lastly, how do imports work for this extra module? can I rely on definitions from in-scope cabal packages? could someone publish a standard set of extensible commands to hackage?
This is exactly right, you can import modules from any package that’s available in the current project, so a package with a common set of commands would be a great idea.
I think I’d like to get to the point where you can configure the plugin with extra packages that aren’t available in the current project: it seems like a shame that you’d need to add a dependency to your project just to get extra IDE functionality, but I think I’m a ways away from working on that