This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-10
Channels
- # announcements (3)
- # asami (4)
- # babashka (21)
- # beginners (97)
- # calva (32)
- # cider (4)
- # clj-kondo (7)
- # cljdoc (1)
- # clojure (70)
- # clojure-europe (27)
- # clojure-nl (10)
- # clojure-norway (18)
- # clojure-uk (8)
- # clojure-ukraine (1)
- # clojurescript (5)
- # datalevin (7)
- # docker (1)
- # emacs (3)
- # fulcro (4)
- # girouette (4)
- # graalvm (2)
- # graphql (9)
- # gratitude (3)
- # honeysql (4)
- # hoplon (3)
- # hyperfiddle (7)
- # jobs (3)
- # kaocha (31)
- # lsp (23)
- # malli (7)
- # missionary (6)
- # nextjournal (9)
- # off-topic (6)
- # pathom (13)
- # polylith (13)
- # practicalli (3)
- # remote-jobs (3)
- # reveal (7)
- # schema (1)
- # sci (23)
- # shadow-cljs (31)
- # tools-deps (62)
- # xtdb (8)
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)
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.
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
See https://calva.io/pprint/ for how to configure those in Calva. But, they won't affect strings anyway.
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.
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?
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.
Hmmm, no, it seems we have ranges for inlays: https://code.visualstudio.com/api/references/vscode-api#InlayHintsProvider
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
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?
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.
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.
Notice how the hints don't show up until I scroll. But after that they show up immediately, which is good
I'll explore the more rich options now (e.g. adding a command, hover etc, truncating)
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...
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