-
Notifications
You must be signed in to change notification settings - Fork 20
Add support for filling holes using ghc-mod's auto command #174
Add support for filling holes using ghc-mod's auto command #174
Conversation
| return Promise.resolve [] unless buffer.getUri()? | ||
| crange = Util.tabShiftForRange(buffer, crange) | ||
| @queueCmd 'typeinfo', | ||
| interactive: @caps?.interactiveCaseSplit ? false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safe to use interactive: true here. interactiveCaseSplit is a workaround for a ghc-mod bug where case-split command crashed interactive mode, but I don't think it's the case with auto.
NB: sig-fill just crashed in most cases since ghc-mod-5.3, and was finally fixed in 5.6 IIRC, so the same workaround is applied there to avoid crashing interactive mode.
|
Thank you for your contribution! I have to ask though, Also, I think this functionality intersects with |
|
Oh yes, it would be good to merge the I actually didn't know about hole completions in autocomplete-haskell! I would actually prefer auto's output in the autocomplete list, rather than in a a :: Maybe Bool
a = _ghc-mod's auto suggests:
while autocomplete-haskell suggests:
In that case, auto had better suggestions, but auto seems to hang for other examples (e.g. https://gist.github.com/chrismwendt/59eff2b95e1f35b56c7d65907cd1057a) and doesn't even provide suggestions for some seemingly obvious cases (e.g. That case where ghc-mod seemingly hung scares me - I wouldn't want my editor to hang for that long. Maybe it's best to hold off merging this until that is addressed? |
Couldn't build/test your example. Lack of cabal file makes this unnecessarily hard ._.
Yes, ac-h works differently here, more in the vein of how Hoogle does it: it tries to not only match immediately obvious options, but also things like polymorphic functions etc by hole type. Of course this is pure heuristics, so it's not necessarily 'correct'. Also some Prelude identifiers are "strange", which includes primitive types, So anyway, I was thinking that maybe it'd be a better option to enhance ac-h output with Also while on topic, probably could leverage
I would argue that this should be solved with css (in a stylesheet!) rather than introducing new elements into tree. Something like |
|
Oh, of course I should have included the cabal and stack files, sorry about that! I updated https://gist.github.com/chrismwendt/59eff2b95e1f35b56c7d65907cd1057a with both as well as a screenshot of my system monitor during execution. I like the approach that autocomplete-haskell takes to figuring out what should go in a hole, and 👍 to enhancing its output with Ah, good call on using a stylesheet instead. I'm not particularly well versed in HTML/CSS design, and |
|
Closing in favor of #175, see if it makes sense to you. Also, it'll be easier for everyone if we have a shared branch, so I've added you as a collaborator. |
This adds support for filling holes using ghc-mod's
autocommand.