-
-
Notifications
You must be signed in to change notification settings - Fork 387
Wingman: Using the completion system for case analysis #2437
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
Comments
You could create key bindings to trigger code lenses, depending on your editor, if that's what bothers you. But I agree that having a Wingman powered completion provider would be awesome. |
Would you be interested in contributing a PR? I'm sure @isovector could provide some starting tips |
@pepeiborra I do have some time over the Christmas break, but I have no Idea about where to start. I'm pretty familiar to Haskell, but new to both the HLS code-base and to LSP. |
This sounds like a great idea. It looks like we can use the |
It seems like there is an example setup (sadly, not using the _comand option) use in plugins/hls-pragmas-plugin/src/Ide/Plugin/Pragmas.hs:L212 which might be usefull? |
The ideal way would be to actually return the text to be inserted as part of the completion item edit, since then you could indeed send it as a snippet, which would potentially give a nicer UX. I guess computing the edit is expensive, but since we'd presumably only do this completion after an |
This is exactly something I think would be really useful. Also I think we could expand it to also work for |
Is your feature request related to a problem? Please describe.
When I write code I often write it like this:
Right now I have to,
Describe the solution you'd like
It would be really nice if we could somehow "TAB" (pun intended) into the lsp completion/snippet system,
and when I have written the
of
I can tap complete and be presented with acase
expansion,(and possibly a 'hylo'-morphic case expansion and a monadic case expansion):
This suggestion is only for the case analysis part, it might however also work for refinements. If you
are on a "_" and press tab, it could suggest a refined solution if it finds one in less than 0.x seconds, suggest it, otherwise it might suggest one of the other transformations.
Describe alternatives you've considered
Wingman works great as is, but this would really be a "killer" feature.
Additional context
There seem to be some kind of support for snippets in the LSP protocol, but I don't know how well it is integrated in the different editors (and in the haskell-language-server).
The text was updated successfully, but these errors were encountered: