This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-20
Channels
- # announcements (33)
- # aws (1)
- # babashka (8)
- # beginners (100)
- # calva (59)
- # clara (4)
- # clj-kondo (33)
- # cljdoc (9)
- # cljs-dev (30)
- # cljsrn (1)
- # clojure (28)
- # clojure-australia (1)
- # clojure-boston (1)
- # clojure-dev (4)
- # clojure-europe (14)
- # clojure-france (5)
- # clojure-italy (7)
- # clojure-nl (1)
- # clojure-uk (36)
- # clojurescript (13)
- # clojureverse-ops (6)
- # conjure (2)
- # cursive (2)
- # datahike (11)
- # datalevin (1)
- # datomic (106)
- # graphql (3)
- # helix (10)
- # holy-lambda (24)
- # kaocha (2)
- # lambdaisland (3)
- # lsp (199)
- # malli (35)
- # off-topic (16)
- # pathom (7)
- # polylith (38)
- # portal (16)
- # quil (2)
- # re-frame (18)
- # reagent (57)
- # shadow-cljs (11)
- # testing (3)
- # xtdb (9)
Sweet feedback on this Youtube video: https://www.youtube.com/watch?v=O6GrXXhCzCc
Hi, I've had a really weird problem with Calva for better half of the day.
Symptoms: Editor works for a while but after first tab key press I cannot anymore delete text (backspace/del) nor use shortcuts (eg. ctrl-alt-c ctrl-alt-j
to jack-in etc).
Calva version 2.0.220
VSCode version 1.61.2
Fedora 34
I've tried rolling back to older version (.216) to no avail. After upgrading to latest Calva and VS Code I started to see this error also.
[Error - 16:29:50] Starting client failed
Launching server using command /home/jmo/.vscode/extensions/betterthantomorrow.calva-2.0.220/clojure-lsp_backup failed.
Any ideas? Is this combo dysfunctional everything being latest versions?Still, probably clojure-lsp download failed and there was no backup because new Calva version.
Yeah, I know I don't neec clojure-lsp locally, just wanted to say it to clarify my isntallation đ
Calva is utilizing cider-nrepl and clojure-lsp to create this VS Code experience.
nREPL dependencies configured:
nrepl: 0.8.3
cider-nrepl: 0.26.0
cider/piggieback: 0.5.2
clojure-lsp version configured: latest
If you are new to Calva, please consider starting with the command:
**Calva: Fire up the Getting Started REPL**
(See `showCalvaSaysOnStart` in Settings to control the auto-showing of this message panel.)
clojure-lsp version used: 2021.10.20-13.04.11
clj-kondo version used: 2021.10.19
It succeeds loading it most of the timeAs for the other error. A minimal repro would help. It is probably something with the text in the file that trips Calva up. If you can share the code, then I can help searching for the problem. Otherwise, try bisect it down.
Ok, will try. It's cljs
and I'm building a Vega spec (react-vega + fulcro) for a data visualisation
It seems to, if I'm formattin fulcro cljs code it works, when I try to format the vega spec it starts to act weird
(ns foo.vega
(:require
["react-vega" :refer [Vega]]
[com.fulcrologic.fulcro.algorithms.react-interop :as interop]
[com.fulcrologic.fulcro.components :as comp :refer [defsc]]
[com.fulcrologic.fulcro.dom :as dom]))
(def vega (interop/react-factory Vega))
(def vega-spec
{"$schema" ""
"description" "An example of treemap layout for hierarchical data."
"width" 660
"height" 500
"padding" 2.5
"autosize" "none"
"data" [{"name" "table"
"url" "/public.json"
"format" {"type" "json", "parse" "auto"}
"transform" [#_{"type" "stack"
"groupby" ["TravelEndDate"]
"sort" {"field" "type"}
"field" "fig01"}
{"type" "timeunit"
"field" "TravelEndDate"
"units" ["year" "month"]
"signal" "tbin"}
{"type" "aggregate"
"groupby" ["unit0" "type"]
"ops" ["sum" "count"]
"fields" ["fig01" "fig01"]
"as" ["fig01" "eventCount"]}
{"type" "stack"
"groupby" ["unit0"]
"sort" {"field" "type"}
"field" "fig01"}]}]
"title" "asdasd"
"scales" [{"name" "x"
"type" "band"
"range" "width"
"domain" {"signal" "timeSequence(tbin.unit, tbin.start, tbin.stop)"}
#_#_"domain" {"data" "table", "field" "unit0"}}
{"name" "y"
"type" "linear"
"range" "height"
"nice" true, "zero" true
"domain" {"data" "table", "field" "y1"}}
{"name" "color"
"type" "ordinal"
"range" "category"
"domain" {"data" "table", "field" "type"}}]
"axes" [{"orient" "bottom"
"scale" "x"
"zindex" 1
"title" "Time"
"titleAnchor" "middle"
"formatType" "time"
"format" {"signal" "timeUnitSpecifier(tbin.unit, {'year-month': '%Y-%m'})"}}
{"orient" "left",
"scale" "y",
"title" "fig01 in kg's"
"titleAngle" 90
"titleAnchor" "middle"
"format" "d"
"zindex" 1,
"tickCount" 10}]
"marks" [{"type" "rect"
"tooltip" "true"
"from" {"data" "table"}
"encode" {"update" {"x" {"scale" "x", "field" "unit0"}
"width" {"scale" "x", "band" 1, "offset" -1}
"y" {"scale" "y", "field" "y0"}
"y2" {"scale" "y", "field" "y1"}
"fill" {"scale" "color", "field" "type"}
"fillOpacity" {"value" 1}}
"hover" {"fillOpacity" {"value" 0.5}
"tooltip" {"signal" "{'Type': datum.type, 'Events': datum.eventCount, 'fig01': format(datum.fig01, 'r') + 'kg'}"}}}}]})
(defsc SomeChart [_this _props]
(dom/div {:style {:padding-left "30px"}}
(vega {:spec (clj->js vega-spec)})))
(def some-chart (comp/factory SomeChart))
Here's the file that causes the problems. When adding a new item to vega-spec
eg. after autosize
adding a "title" {"text" "title"}
and then indenting starts the funny stuffNow I canât reproduce it⊠Hmmm⊠What if it is related to clojure-lsp failing to start anyway⊠You said it load most of the time, can you see a pattern that this tab freezup happens when clojure-lsp loads and when it doesnât?
When it happens I get an error in the development console (available from the Help menu) about Calva consuming tons of the CPU for almost 5 secs. (Which is VS Codes way to tell you an extension has locked up.)
Yep, I see it too.
WARN UNRESPONSIVE extension host, 'betterthantomorrow.calva' took 78% of 6436.194ms, saved PROFILE here: 'file:///tmp/exthost-e72a36.cpuprofile'
0:
id: "betterthantomorrow.calva"
percentage: 78
total: 5000294
__proto__: Object
1:
id: "program"
percentage: 22
total: 1435137
__proto__: Object
length: 2
__proto__: Array(0)
Got this just now after pressing tab
to do formatting
Running the contributed command: 'calva-fmt.formatCurrentForm' failed.
Started running into this too now. Not even using the tab, but just paredit on somewhat large maps (tens of lines, six levels of nesting)
Can you make a minimal repro from it, @U8ZQ1J1RR?
To see it happen, go to the map that is the value in vega-spec/mark, and try to ctrl-alt-comma (and dot) to make the map larger or smaller, after one or three times, calva freezes
Here's the crazy thing: if I remove the defsc, or scales, or axes, or marks, or even the encode inside mark - legends, it won't do that anymore. Only if it's that big. I didn't try removing everything line by line, but anything "major" like that and the bug does not manifest
No idea what is important here. At my resolution that is a bit more than I can fit on screen at the same time. But yet, if I for example replace the "marks" value with a simpler map of just integer keys and values, large enough that it won't fit on the screen, it won't bug
I tested this by putting a file "vega.cljs" inside a folder "calva-repro", with that content, and strting with code calva-repro
. Nothing more in the folder; no deps.edn, nothing
Awesome hunting, @U8ZQ1J1RR!
Slurp forward is not happening at tab
, but something in that fix could have been in the token cursor code, and thatâs probably where we run into some infinite loop.
4,994.68ms
4,994.68ms
(anonymous)
../../.vscode/extensions/gruntfuggly.todo-tree-0.0.214/dist/extension.js:52
4,994.68ms
4,994.68ms
(anonymous)
../../.vscode/extensions/gruntfuggly.todo-tree-0.0.214/dist/extension.js:52
4,994.68ms
4,994.68ms
calva$fmt$util$re_pos_first
.shadow-cljs/builds/calva-lib/dev/out/cljs-runtime/calva.fmt.util.js:58
4,994.68ms
4,994.68ms
calva$fmt$formatter$index_for_tail_in_range
.shadow-cljs/builds/calva-lib/dev/out/cljs-runtime/calva.fmt.formatter.js:127
4,994.68ms
4,994.68ms
calva$fmt$formatter$format_text_at_idx
.shadow-cljs/builds/calva-lib/dev/out/cljs-runtime/calva.fmt.formatter.js:264
4,994.68ms
4,994.68ms
calva$fmt$formatter$format_text_at_idx_bridge
.shadow-cljs/builds/calva-lib/dev/out/cljs-runtime/calva.fmt.formatter.js:271
4,994.68ms
4,994.68ms
_formatIndex
src/calva-fmt/src/format.ts:129
4,994.68ms
4,994.68ms
formatPositionInfo
src/calva-fmt/src/format.ts:45
4,994.68ms
4,994.68ms
formatPosition
src/calva-fmt/src/format.ts:78
4,994.68ms
4,994.68ms
(anonymous)
src/doc-mirror/index.ts:38
4,994.68ms
4,994.68ms
runMicrotasks
4,994.68ms
4,994.68ms
processTicksAndRejections
<node_internals>/internal/process/task_queues.js:65
Argh! After being stuck for 20 minutes, and my looking through the code, it got unstuck! And cannot get stuck again!
In any case, I couldn't much make sense what could be stuck in that stack trace. Also checked the commits between 146 and 145, can't figure it out from there either
I guess I lack the necessary knowledge on developing vscode extensions to look at the right place
I don't even know what that other extension is doing in that stacktrace. Disabling it doesn't do anything, for what's it worth
Hm, in the normal calva (not running via the source code checkout) waiting does get it unstuck, but it gets stuck right after barfing more
I see a common workflow is to put some dev-time functions in a user.clj
file. In Calva however when you send something to the REPL it switches the namespace you're in, which means you're no longer in the user
namespace and can no longer (effortlessly) access those functions. Is there a convenient way around this or a different workflow?
I've never stayed in the user ns, not in calva nor previously. What I always do is to use fully qualified names for whatever is in there, so things like (user/start)
, (user/restart)
You can also make a custom REPL snippet that does something like (in-ns 'user)
and give it the key "u"
which will bind it to ctrl+space u
. I think that with the use of some atom you could bind ctrl+space -
to take you back to whatever namespace you came from. (Not sure, but it is Clojure after all so anything should be possible. đ)