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

Better REPL feedback while waiting for evaluation #1543

Open
jacobemcken opened this issue Feb 19, 2022 · 16 comments
Open

Better REPL feedback while waiting for evaluation #1543

jacobemcken opened this issue Feb 19, 2022 · 16 comments

Comments

@jacobemcken
Copy link

jacobemcken commented Feb 19, 2022

I can't figure out how to distinguish when I forgot to evaluate a form and when I'm just waiting for something slow (maybe even hanging). I noticed this mostly when using something like criterium to benchmark things (or other things that doesn't yield a result instantly) and I find myself thinking: Did I evaluate the form?

@PEZ
Copy link
Collaborator

PEZ commented Feb 19, 2022

Thanks for this feedback! The evaluated form is actually decorated with transparent white while evaluating, but obviously not clearly enough. This might also depend a bit on which theme is used.

Some things spring to my mind about how to solve this:

  1. Change the decoration to be less subtle (very few characters in the code need change for this 😄).
  2. Add a setting for this decoration, in similar ways to how Calva Highlight can be configured.
  3. Make the decoration theme aware.
  4. Use the gutters to indicate something being evaluated

The last point there reminds me of that CIDER has a gutter indicator showing that something is evaluated. This is super useful and probably food for a separate issue, but I am now also guessing that CIDER probably uses this indicator to signal that something is being evaluated as well.

@jacobemcken
Copy link
Author

jacobemcken commented Feb 19, 2022

Not all evaluations are triggered from within the actual REPL.

I often use a comment block in my code on the left, while having the REPL open on the right:

(defn a []
  (Thread/sleep 5000)
  [1 2 (rand-int 5)])

(comment
  (a) ; put cursor here and press Alt+x
)

Evaluating the (a) form multiple times makes it impossible to distinguish the difference between:

  1. showing the old result (not evaluating)
  2. waiting on the new result (evaluating)

@Cyrik
Copy link
Member

Cyrik commented Feb 19, 2022

@PEZ what do you mean by "cider gutters"? Googling that gives "unexpected" results ;)

@jacobemcken
Copy link
Author

@Cyrik A gutter is the blank space between the content and the border of the content area.

https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_gutter-indicators

@PEZ
Copy link
Collaborator

PEZ commented Feb 19, 2022

For the record I am only really talking about evaluating things in the regular files. At the REPL prompt we don't decorate anything during or after evaluating.

@PEZ
Copy link
Collaborator

PEZ commented Feb 19, 2022

An example of gutter indicators in VS Code are the small buttons that let you run tests. Available in Calva since @marcomorain added it a while ago. See https://www.youtube.com/watch?v=bUBrmvczAwg

CIDER shows indicators in the gutters to show that something is evaluated. Very, very nifty. I don't understand why I can't find a screenshot (but maybe because I don't dare make the obvious Google search now. 😄 )

@bpringe
Copy link
Member

bpringe commented Feb 22, 2022

Gutter indicators seem like a good idea for this. Another option is to change the text of the inline annotation from the previous result (or no existing annotation), to something like => evaluating..., but really I think I like the gutter idea better.

@PEZ
Copy link
Collaborator

PEZ commented Feb 23, 2022

Please help upvote this issue: microsoft/vscode#143774

@bpringe
Copy link
Member

bpringe commented Mar 10, 2022

While pairing with a co-worker via screen sharing, I noticed his CIDER/Emacs had an indicator in the bottom right that was an animation showing the REPL was busy. This made me think maybe we could/should use a status bar animation to show when something is being evaluated.

It's not as direct as a gutter icon next to the line being evaluated, but it might be a good addition to that, since the gutter icons require the line of code being evaluated to be in view in the editor for you to see them, but the status bar is always visible. Even if you change files in view or scroll away from the code you started evaluating, you can still see if something is being evaluated.

@PEZ
Copy link
Collaborator

PEZ commented Mar 10, 2022

I like this. We could also bring the command to interrupt the evaluation to that button.

@bpringe
Copy link
Member

bpringe commented Apr 28, 2022

I just got an idea 🤔 ... is it possible to use custom icons in the status bar? If we did go with the status bar route for showing a pending evaluation, using some animation, it would be cool to have a version of the Calva logo animated as the glass filling up with calvados. It could just be 3 - 4 frames and repeat from empty to full while the evaluation is pending.

@pbwolf
Copy link

pbwolf commented Apr 29, 2022

A status bar animation has the advantage that you can "mislay" the source-code tab or panel and still know whether something is happening and how to stop it.

@PEZ
Copy link
Collaborator

PEZ commented Apr 29, 2022

I think I've seen an implementation of a custom animated icon. However, I'm not sure we want the calva symbol associated with waiting. Of course, most often it would be a quick eval and the ”right” associations. Just that I've stared at animated Slack icons waiting for something that takes forever quite a few times. It says slowness. 😄

@bpringe
Copy link
Member

bpringe commented Apr 30, 2022

@PEZ Fair enough... we don't want a negative association with the Calva icon. 😃

@zakkor
Copy link
Contributor

zakkor commented May 18, 2022

Another option that springs to mind: Calva already has a setting to display evaluated code in the REPL
image

but unfortunately, it only prints the evaluated form in the REPL after the command has been completed.
If it could be changed to print the form before, that would be pretty decent feedback that your command has started running.

I also like the => evaluating... suggestion from above - these two changes paired together would be ideal for me

@mrkam2
Copy link
Contributor

mrkam2 commented Dec 6, 2023

Also discussed in https://clojurians.slack.com/archives/CBE668G4R/p1701622706801439. Really resonates with my usage experience.

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

No branches or pull requests

7 participants