Fork me on GitHub
#calva
<
2022-03-10
>
Jacob Rosenzweig04:03:35

Is there a way to enforce a char limit on evaluations? I keep accidentally printing a huge json file to the REPL and it completely owns VSCode (hangs and stops)

pez05:03:07

A huge JSON would be a string, right? Then I don’t think there's a way to limit it. Please file a feature request for it.

pavlosmelissinos07:03:40

FYI, to limit the printed characters of clojure data structures you can set *print-length* and/or *print-level* in your REPL but I don't think these have any effect on strings. https://clojuredocs.org/clojure.core/print-length https://clojuredocs.org/clojure.core/print-level

pez08:03:11

See https://calva.io/pprint/ for how to configure those in Calva. But, they won't affect strings anyway.

orestis07:03:43

The new VSCode release has an interesting feature, called Inlay Hints: https://code.visualstudio.com/raw/images/1_65/inlay-hints.png > The API is built around the InlayHintsProvider. It provides InlayHint objects, which have a couple of interesting features: > • An inlay hint can have a tooltip and a command. > • The label of a hint can be composed of multiple parts, which again can have a tooltip and command. > • The label parts can also have an associated source location that enables language features such as Go To Definition for this part.

👀 3
pez07:03:30

Very cool. I must take a good look at that!

orestis07:03:32

I'm thinking that it could be a good candidate for inline evaluation results? As in, when evaluating something, add an Inlay Hint with the result (up to debate how big/long should that be), a source location pointing to the calva.output window, and then a command to show the hover or something else?

pez07:03:05

There also seems to be something called OverlayHints, which is about ranges. (Where inlays are about a position in the document.) Might be more suitable as we are always evaluating a range of code. However, I haven't found a good description of the API (which doesn't seem entirely new) yet so don't know how interchangeable they are.

orestis14:03:36

I'm hacking this!

calva 1
gratitude 1
orestis14:03:32

Can I ask for some help - I'm in evaluate.ts and looking to find the proper editor location to show the hint -- essentially the place where the current inline => ... is shown but I'm struggling

orestis14:03:36

The selection is the cursor, and the resultLocation is increaasing by a few lines on every invocation, so that's probably the output window result location?

orestis14:03:59

Ah, selection.end is the place 🙂

orestis14:03:27

This looks promising but I can't find a way to force VSCode to recalculate hints.

pez15:03:35

When the provider starts providing something different, I think the hints will update. I haven't looked at the API much though, so I might be wrong.

pez15:03:30

It doesn't sound right to show the hint at the cursor though. It should be shown at the end of whatever has been evaluated.

pez15:03:49

Maybe we should have a chat about how we want it to behave? 😃

orestis16:03:02

I'm just exploring the API right now 🙂

orestis16:03:31

Here's what I have

🎉 1
orestis16:03:52

Notice how the hints don't show up until I scroll. But after that they show up immediately, which is good

orestis16:03:18

I'll explore the more rich options now (e.g. adding a command, hover etc, truncating)

orestis16:03:50

Is a PR useful at this stage?

orestis16:03:10

I have visitors now, but I will try to hack on this over the weekend if I find time.

pez16:03:03

Yes, PR is great. Set it in draft mode for now.

pez17:03:50

Video looks wonderful.

orestis07:03:14

Unfortunately I think this is a dead-end. Opening a PR for archival purposes.

orestis07:03:33

The other nice feature for calva is the Language status items , which adds items to the status bar but with a document selector - so e.g. the pprint, paredit, repl... status bar icons can be hidden on non-clojure files...

👀 1
pez07:03:07

We should utilize this. Please file a feature request about it on Github.

👍 1
Lukas Domagala17:03:48

https://code.visualstudio.com/updates/v1_65#_drag-and-drop-problems-and-search-results will help when dealing with stacktraces. now I can hopefully drag the location from the repl into the actual editor group

bringe03:03:54

It supports dragging from a file? Seems like it only supports Problems, Search, and Reference results.

Lukas Domagala10:03:42

damn, wishful thinking on my part 😞

😞 1