fable-compiler / repl-legacy

http://fable.io/repl
MIT License
14 stars 10 forks source link

Add tooltips #22

Closed alfonsogarciacaro closed 6 years ago

alfonsogarciacaro commented 6 years ago

This is the first step to add tooltips to the REPL. In Fable, I just exposed the getToolTipAtLocation function @ncave added some time ago, and here I'm just registering the hover provider. However, the only result I get from FableREPL.GetToolTipText is:

internal error: empty list Parameter name: l

So I'm afraid I'll need some @ncave magic again here, any ideas?

Happy New Year btw :wink:

ncave commented 6 years ago

@alfonsogarciacaro Happy New Year to you too! I think you need to pass the identifier on which you're hovering, like here. Perhaps Monaco can provide the identifier, instead of using the lexer lookup from FSAC, but I have not looked if that's readily available. Also, there seems to be some tooltip caching in GetToolTipText (key here), so if that doesn't perform well or is eating too much memory it can be reworked.

alfonsogarciacaro commented 6 years ago

Awesome, tooltips are working now! :tada: :tada: Thanks a lot @ncave! :clap: :clap:

This is ready to merge 😄

alfonsogarciacaro commented 6 years ago

@MangelMaxime The only thing that's missing now to replace the old REPL should be putting the F# code in the URL so people can share it, right? I guess we need to do the same with the HTML code.

alfonsogarciacaro commented 6 years ago

@MangelMaxime Also, I'm getting this error in the Browser console always when loading the REPL. I think it comes from Thot:

Decode.fs:288 Uncaught Error: Expecting an object with a field named `type` but instead got:
{
    "source": "react-devtools-detector",
    "reactBuildType": "development"
}
    at andThen (Decode.fs:288)
    at Mouse.fs:43
    at args3 (Generator.fs:22)
    at curriedFn (Generator.fs:11)
    at Mouse.fs:62
MangelMaxime commented 6 years ago

Yes that's right. We need to use the urlParser for that.