Fork me on GitHub
Shan Rauf01:11:34

Is there a way to increase the timeout limit for long running functions in the REPL? When I use the js-debugger, run a long Datascript query, etc, the REPL eventually says The previously used runtime disappeared. Will attempt to pick a new one when available but your state might be gone. Honestly can't tell if it's a Calva thing, a shadow-cljs thing, or what though...


What’s your runtime environment for your JS/CLJS? If it’s the browser, for example, any time the browser is refreshed, the runtime will “disappear” I believe, because your code was running in that environment that was refreshed.


The message sounds like it is coming from shadow-cljs.

Shan Rauf03:11:03

Looks like you were right, thank you for the help


Today I can’t get any results from the calva REPL on Mac. I’ve tried it on both my machine and a colleges. Typing directly into the REPL-window works, but sending forms only show the form, but no result.


Sounds very worrying. What does sending forms mean here?


Sorry sorry! I confused “send” with “eval” facepalm


Not strange. I think that in some other IDEs it is done by sending the form to the REPL.


Have you tried it with a different project?


That is I was running Calva: Send Current Form to Output/REPL Windowbut was expecting Calva: Evaluate Current Form (or selection, if any)


I’m coming from Cursive, so maybe I got it from there


But using the correct option (eval) everything works as expected


Ah, so you are all good now?


I’m all good! Sorry for the noise and thank you for Calva! (and quick reply!)


No problem, it is actually good to know that this can confuse. And you are welcome!


I can find one error in the Log (extension host) output_

[2021-11-25 12:40:33.732] [exthost] [error] [betterthantomorrow.calva] provider FAILED
[2021-11-25 12:40:33.732] [exthost] [error] Canceled: Canceled
	at x.makeCancelError (/Users/thomo/.vscode/extensions/betterthantomorrow.calva-2.0.225/out/extension.js:2:1104201)
	at x.handleFailedRequest (/Users/thomo/.vscode/extensions/betterthantomorrow.calva-2.0.225/out/extension.js:2:1104052)
	at /Users/thomo/.vscode/extensions/betterthantomorrow.calva-2.0.225/out/extension.js:2:1069014
	at async s.provideDocumentSymbols (/Applications/Visual Studio )


I’ve tried this in a fresh session code --user-data-dir tmp --extensions-dir tmp and then only installed calva


starting to experiment and i’m noticing that click to definition can take a long time


its a particularly large codebase, which might be the cause


but i was wondering if there were any known footguns/things to configure


clojure-lsp version used: 2021.11.16-16.52.14
clj-kondo version used: 2021.10.20-SNAPSHOT
^ in case this helps


How much is a longer time? I'm not sure calva always use clojure-lsp to find-definitions or if when repl is connected it uses cider to find the definition


The lsp one usually is really fast (max 1sec AFAIK)


It can range from really fast to never finishing


That's odd, could you try with repl disconnected?


calva reports no repl


Anything on clojure-lsp logs? There is a command "Calva open clojure-lsp logs"


running that doesn’t seem to do anything. restarting vs code

👍 1

first error is this

2021-11-25T23:15:52.145Z  INFO [clojure-lsp.server:435] - Starting server...
2021-11-25T23:15:52.163Z  DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2021-11-25T23:15:52.164Z  ERROR [taoensso.timbre:796] - Uncaught exception on thread: main
 [37mclojure_lsp.main.main[m  [32m             [m
                   [37m...[m  [32m             [m
[33mclojure-lsp.main/[1;33m-main[m  [32mmain.clj: 159[m
[33mclojure-lsp.main/[1;33m-main[m  [32mmain.clj: 161[m
 [33mclojure-lsp.main/[1;33mexit[m  [32mmain.clj: 118[m
                   [37m...[m  [32m             [m
[1;31mjava.lang.NullPointerException[m: [3m[m


and then

1-11-25T23:17:25.143Z  INFO [clojure-lsp.crawler:?] - Project only paths analyzed, took 87.13 secs
2021-11-25T23:17:49.783Z  DEBUG [clojure-lsp.server:?] - :initialize 117606ms
2021-11-25T23:17:49.847Z  INFO [clojure-lsp.server:361] - Initialized!
2021-11-25T23:17:49.848Z  DEBUG [clojure-lsp.server:?] - :initialized 0ms
2021-11-25T23:17:49.848Z  WARN [clojure-lsp.server:261] - {}
2021-11-25T23:17:50.318Z  DEBUG [clojure-lsp.server:?] - :didOpen 469ms
2021-11-25T23:17:50.324Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 3ms
2021-11-25T23:17:50.518Z  DEBUG [clojure-lsp.server:?] - :codeAction 196ms
2021-11-25T23:17:50.905Z  DEBUG [clojure-lsp.server:?] - :codeAction 219ms
2021-11-25T23:17:53.558Z  DEBUG [clojure-lsp.server:?] - :definition 75ms
2021-11-25T23:17:57.936Z  DEBUG [clojure-lsp.server:?] - :didOpen 4330ms
2021-11-25T23:17:57.937Z  DEBUG [clojure-lsp.server:?] - :didClose 0ms
2021-11-25T23:17:57.938Z  DEBUG [clojure-lsp.server:?] - :hover 1ms
2021-11-25T23:17:57.938Z  DEBUG [clojure-lsp.server:?] - :definition 1ms
2021-11-25T23:17:57.938Z  DEBUG [clojure-lsp.server:?] - :documentHighlight 1ms
2021-11-25T23:17:58.646Z  DEBUG [clojure-lsp.server:?] - :hover 708ms
2021-11-25T23:17:58.689Z  DEBUG [clojure-lsp.server:?] - :hover 751ms
2021-11-25T23:17:58.689Z  DEBUG [clojure-lsp.server:?] - :definition 751ms
2021-11-25T23:17:58.933Z  DEBUG [clojure-lsp.server:?] - :definition 995ms
2021-11-25T23:17:58.942Z  DEBUG [clojure-lsp.server:?] - :hover 700ms
2021-11-25T23:17:58.947Z  DEBUG [clojure-lsp.server:?] - :definition 705ms
2021-11-25T23:17:58.987Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 0ms
2021-11-25T23:17:59.012Z  DEBUG [clojure-lsp.server:?] - :definition 80ms
2021-11-25T23:17:59.041Z  DEBUG [clojure-lsp.server:?] - :codeAction 1103ms
2021-11-25T23:18:04.806Z  DEBUG [clojure-lsp.server:?] - :didOpen 5628ms
2021-11-25T23:18:04.810Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 2ms
2021-11-25T23:18:04.846Z  DEBUG [clojure-lsp.server:?] - :codeAction 38ms
2021-11-25T23:18:09.334Z  DEBUG [clojure-lsp.server:?] - :didOpen 4525ms
2021-11-25T23:18:09.335Z  DEBUG [clojure-lsp.server:?] - :didClose 0ms
2021-11-25T23:18:09.336Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 0ms
2021-11-25T23:18:09.336Z  DEBUG [clojure-lsp.server:?] - :documentHighlight 0ms
2021-11-25T23:18:09.336Z  DEBUG [clojure-lsp.server:?] - :definition 0ms
2021-11-25T23:18:09.337Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 1ms
2021-11-25T23:18:09.346Z  DEBUG [clojure-lsp.server:?] - :codeAction 9ms
2021-11-25T23:18:09.776Z  DEBUG [clojure-lsp.server:?] - :codeAction 440ms
2021-11-25T23:18:09.785Z  DEBUG [clojure-lsp.server:?] - :codeAction 450ms
2021-11-25T23:18:12.028Z  DEBUG [clojure-lsp.server:?] - :didClose 0ms
2021-11-25T23:18:12.029Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 1ms


so far its working. im going to keep switching files until it hangs again


and yep, now its hanging again and also calva wont open the log file again


let me make sure i keep that window up while hopping around


okay confirmed nothing interesting looking in the log when it hangs

2021-11-25T23:25:44.493Z  DEBUG [clojure-lsp.server:?] - :codeAction 10ms
2021-11-25T23:25:45.080Z  DEBUG [clojure-lsp.server:?] - :codeAction 388ms
2021-11-25T23:25:45.830Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 1ms
2021-11-25T23:25:48.452Z  DEBUG [clojure-lsp.server:?] - :didOpen 2571ms
2021-11-25T23:25:48.483Z  DEBUG [clojure-lsp.server:?] - :definition 0ms
2021-11-25T23:25:48.483Z  DEBUG [clojure-lsp.server:?] - :hover 0ms
2021-11-25T23:25:48.483Z  DEBUG [clojure-lsp.server:?] - :documentSymbol 0ms
2021-11-25T23:25:48.490Z  DEBUG [clojure-lsp.server:?] - :codeAction 7ms
2021-11-25T23:25:48.586Z  DEBUG [clojure-lsp.server:?] - :definition 0ms
2021-11-25T23:25:48.736Z  DEBUG [clojure-lsp.server:?] - :hover 0ms
2021-11-25T23:25:48.848Z  DEBUG [clojure-lsp.server:?] - :codeAction 7ms
2021-11-25T23:25:49.092Z  DEBUG [clojure-lsp.server:?] - :documentHighlight 0ms
2021-11-25T23:25:49.195Z  DEBUG [clojure-lsp.server:?] - :definition 0ms
2021-11-25T23:25:49.532Z  DEBUG [clojure-lsp.server:?] - :references 328ms
2021-11-25T23:25:49.601Z  DEBUG [clojure-lsp.server:?] - :codeAction 12ms
2021-11-25T23:25:49.614Z  DEBUG [clojure-lsp.server:?] - :codeAction 293ms
2021-11-25T23:25:50.199Z  DEBUG [clojure-lsp.server:?] - :codeAction 361ms
2021-11-25T23:25:52.747Z  DEBUG [clojure-lsp.server:?] - :definition 105ms


except maybe that definition 0ms - that could be an exception or something


That first exception is just trash, I need to suppress that to fix it. That definition taking 0ms is weird but there is no error indeed


Is it possible to you make a simple repro repo where it happens the issue? So I can test it


that is a good question


i have no doubt that if i make an empty deps.edn project it will work just fine


i do have a leftover project.clj file that we are using just to run our sass builds

(defproject ic "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.10.1"]]
  :uberjar-name "ic-standalone.jar"

  :plugins [[deraen/lein-sass4clj "0.3.1"]]

  :sass {:target-path  "resources/public/css"
         :output-style :compressed
         :source-map   false
         :source-paths ["resources/sass"]})


so maybe thats it?


Na, I don't think so, so the definition works or doesn't, there is no time when the definition takes more than X seconds but loads successfully?


it seems to work itself out kinda if i leave the editor on long enough