Skip to content
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

Explore inlay hints for REPL results #1594

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

orestis
Copy link

@orestis orestis commented Mar 13, 2022

What has Changed?

  • I have added an InlayHintsProvider to try and show inline REPL results in a nicer way
  • Unfortunately, it doesn't seem that this API is flexible enough for this
  • Opening a PR just for archival purposes

@orestis
Copy link
Author

orestis commented Mar 13, 2022

Perhaps the inlay hints API could be useful for something else, but it seems to be very narrowly oriented towards type hints. I couldn't get the tooltip to show up, neither the command to execute, as both seem to be related to a position in the code that actually has a symbol.

@orestis
Copy link
Author

orestis commented Mar 13, 2022

I used this as a guide since the API is very sparsely documented.

@PEZ
Copy link
Collaborator

PEZ commented Mar 13, 2022

Thanks for providing this! Even if it turns out to be a dead end, it can save others from entering. 😄

The other use for this that I am thinking about, is to place a button after the current form and current top level form that evaluates the respective form. Maybe that's not possible either for the same reasons?

@orestis
Copy link
Author

orestis commented Mar 13, 2022

I couldn’t get the commands executed. Perhaps I used the wrong syntax though, not sure. To try things out just eval things and if the hints don’t show up immediately then scroll a bit or go to a different file and back again. (The lack of control for making hints show up is another factor against using this for interactive stuff)

@orestis
Copy link
Author

orestis commented Mar 13, 2022

An addendum: The hovers didn't show up because I have turned off hovers 🤦

It'd be interesting if someone with a more standard VScode setup could try this branch.

@PEZ
Copy link
Collaborator

PEZ commented Mar 13, 2022

Tried it now. I can reproduce the ”need to scroll to wake the hints up” problem.

However, I get the tooltips and I can execute the commands. (cmd-click)

We'll need to clear previous hints, but regardless I'd say this is success. 😄

image

@Cyrik
Copy link
Member

Cyrik commented Mar 13, 2022

This does look fun, I'll have a look as well.

The other use for this that I am thinking about, is to place a button after the current form and current top level form that evaluates the respective form. Maybe that's not possible either for the same reasons?

I've also been thinking about how to expose more eval commands as GUI elements so that they are easier to discover for beginners.
The other three options I thought about are CodeLenses, similar to pyhton:
run codelsens
Adding test arrows to top-level forms:
Screen Shot 2022-03-13 at 12 41 48 PM
Add some of the eval commands to the "ctrl+." CodeActions provider (probably the ones that have more complex hotekyes, like "eval to tap>")

I like the CodeAction and CodeLense versions the best, but the inlay-hints screenshot does look interesting.

@riotrah
Copy link
Member

riotrah commented Apr 13, 2022

Oh wow I'd love to implement all the above and make it configurable or something !!!

In general yes, more "vscode-native"-ish and GUI-integrated the commands are, the better imo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants