Fork me on GitHub
#calva
<
2022-09-06
>
Alan Birchenough15:09:33

I am having trouble using Reveal with Calva. Steps I followed:Set up a deps.edn as instructed here: https://calva.io/reveal/; create a new clj file in the same directory; jack in using the reveal-nrepl-middleware alias; evaluate anything in the new CLJ file buffer. Expected result: Evaluation result shows up in Reveal: Actual result: Evaluation result only shown in Calva. Suggestions?

pez20:09:09

Do you see the reveal window open when you jack in?

Alan Birchenough20:09:45

I think I can tap to the Reveal window - haven’t tried recently - but it does not echo REPL evals.

pez20:09:27

When I try this with a minimal deps.edn project, it works as advertised. Have you tried that? Thinking it could be something in your project preventing the middleware from doing its thing.

Alan Birchenough20:09:45

I tried it with a project with one deps.edn exactly as described in the instructions - nothing else present - and one CLJ file in VS Code, which was empty except for the ns macro and a single eval, which did not then go to the Reveal window.

pez20:09:46

Strange. You can try with removing Calva from the picture. In one terminal do:

% clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -A:reveal-nrepl-middleware
And then when the nREPL server is started, in another terminal:
% clojure -Sdeps '{:deps {reply/reply {:mvn/version "0.5.1"}}}' -M -m reply.main --attach `< .nrepl-port
` You should get a user=> Clojure prompt. Anything I evaluate there goes to the Reveal window.

Alan Birchenough20:09:48

Thanks. I like the “divide and conquer” suggestion. However, I won’t be able to try it until a bit later. I’ll let you know what happens. Again, I appreciate the help so far.

pez20:09:23

I'm using the latest Reveal, the one mentioned in the Calva docs is pretty ancient.

:reveal-nrepl-middleware
  {:extra-deps {vlaaad/reveal {:mvn/version "1.3.275"}}
   :jvm-opts ["--add-opens" "javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED"]
   :main-opts  ["-m" "nrepl.cmdline"
                "--middleware" "[vlaaad.reveal.nrepl/middleware,cider.nrepl/cider-middleware]"]}

pez20:09:41

(I need the jvm-opts because I'm using Java > 11.)

Alan Birchenough20:09:23

OK - my Reveal version could be part of the problem. Thanks. Being a relative noob I tend to follow instructions literally, unfortunately.

Alan Birchenough20:09:30

But I will try this and report back.

pez20:09:56

I'll update the docs so that there is no version there to copy/paste 😃

pez21:09:04

Docs updated. I also created a minimal example project with a README suggesting the terminal-only approach to test that things work: https://github.com/BetterThanTomorrow/calva/tree/published/test-data/projects/minimal-reveal

Alan Birchenough21:09:52

Excellent. Thanks.

Alan Birchenough20:09:10

@U0ETXRFEW I still hope to apply your recommendations soon, but things have taken me away from this activity for a day or two. I will make sure to let you know if it worked once I get the chance. Thanks again.

🙏 1
Alan Birchenough17:09:58

@U0ETXRFEW My experiment was mostly unsuccessful. When I tried the two terminal trick, it worked. The results of anything I evaluated at the REPL prompt was repeated in the Reveal window. I then created a tiny project with just your :reveal-nrepl-middleware alias in it and one source file with a couple of lines, and I jacked into it using Calva. This did not work. Evaluation results were shown in the source file and the Calva output window, but not in the Reveal window. Thinking I might have missed something stupid, I cloned the whole of Calva from Github, navigated down into test-data/projects/minimal-reveal, and jacked in from hello.clj. Once again I was unsuccessful. Results were shown in the source file and the Calva output window, but not in the Reveal window. Do you have any suggestions for next steps I might attempt, either diagnostic or even - hopefully - curative? Many thanks for the help so far. I still have hope that, with perseverance, this can be resolved eventually.

pez19:09:40

Oh, wow, super surprised here that it didn't work in Calva while it worked using the the terminals. That sort of makes me doubt what I thought I know about how these things work. 😃 I'm a bit out of ideas now... Maybe if you describe the steps you take, and paste what you see in the jack-in window and such we can find some clue. Also, what OS are you on?

Alan Birchenough19:09:59

I am on macOS Catalina 10.15.7.

Alan Birchenough19:09:42

My JDK is OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12).

pez19:09:25

And which version of VS Code and Calva?

Alan Birchenough19:09:31

VS Code 1.71.1 (Universal)

Alan Birchenough19:09:50

Calva [2.0.300] - 2022-09-11

pez19:09:45

Thanks. I seriously doubt it has anything to do with the version of anything, and all those look cool to me.

Alan Birchenough19:09:02

I will go ahead with the copy/paste idea. I know we haven’t worked together, but if it helps eventually, I would be open to a quick Zoom call or something.

pez19:09:37

I can do a huddle or zoom right now.

Alan Birchenough19:09:00

I’m at work - let me check my calendar.

Alan Birchenough19:09:10

OK I can do that.

Alan Birchenough19:09:28

Here is my nRepl log:

Alan Birchenough19:09:29

-> sent { id: ‘17’, op: ‘eval’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, code: “(in-ns ’calvrev)“, pprint: false } <- received { id: ‘17’, ns: ‘calvrev’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, value: ‘#namespace[calvrev]’ } <- received { id: ‘17’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘done’ ] } <- received { ‘changed-namespaces’: {}, id: ‘17’, ‘repl-type’: ‘clj’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘state’ ] } -> sent { op: ‘load-file’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, file: ‘(ns calvrev)\n\n1’, id: ‘18’, ‘file-name’: ‘calvrev.clj’, ‘file-path’: ‘/Users/alanbirchenough/clojure/calvrev/calvrev.clj’ } <- received { id: ‘18’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, value: ‘1’ } <- received { id: ‘18’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘done’ ] } <- received { ‘changed-namespaces’: {}, id: ‘18’, ‘repl-type’: ‘clj’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘state’ ] } -> sent { op: ‘debug-instrumented-defs’, id: ‘19’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’ } <- received { id: ‘19’, list: [], session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘done’ ] } -> sent { id: ‘20’, op: ‘eval’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, code: ‘1’, file: ‘/Users/alanbirchenough/clojure/calvrev/calvrev.clj’, line: 3, column: 1, stdout: [Function: stdout], stderr: [Function: stderr], pprint: false } <- received { id: ‘20’, ns: ‘calvrev’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, value: ‘1’ } <- received { id: ‘20’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘done’ ] } <- received { ‘changed-namespaces’: {}, id: ‘20’, ‘repl-type’: ‘clj’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘state’ ] } -> sent { op: ‘debug-instrumented-defs’, id: ‘21’, session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’ } <- received { id: ‘21’, list: [], session: ‘87518300-30b3-4e51-a715-13a4e0c1345b’, status: [ ‘done’ ] }

pez20:09:44

A thing to try, that mimics the reply experiment a bit closer, is to use the REPL Window to evaluate 42, without loading any file.

Alan Birchenough20:09:12

OK - will try that.

pez20:09:08

Checking the REPL-y README I get reminded that that is what Leiningen is using. I still think it's a valid data point to check with lein repl :connect, but anyway. 😃

Alan Birchenough20:09:10

Right - thanks for clarification. I went there and saw the same thing, but will keep the test in the plan anyway.

pez20:09:47

I notice that REPL-y is using nREPL 0.8.3. So a thing to try is with the Calva Connect scenario and edit the command line to use that version.

pez20:09:08

Still we also have the data point that things work on my machine, with the nREPL 1.0, but, turning every stone and all that...

Alan Birchenough20:09:13

I hope to get back to you before the end of the week with results. (Fingers crossed.)

Alan Birchenough20:09:10

First result: Evaluating 42 in the REPL window does not result in output appearing within the Reveal window.

🙏 1
pez20:09:13

@U47G49KHQ, we have a super strange issue here with using Reveal together with Calva. When I follow the information found here https://calva.io/reveal/ things work. When @U039K02M4UB follows the same information it does not work. The extra strange thing is that it almost works. When loading a Clojure file in the Calva REPL, the result of evaluating the file is echoed in the Reveal window. But a ”plain” evaluation of some expression does not get echoed. Also, if Alan just uses a terminal nREPL client (REPL-y), things work. We're a bit out of ideas on what to try. Do you have any ideas?

Alan Birchenough20:09:29

@U0ETXRFEW I can confirm that REPL-y works, and lein repl :connect also works (as we expected).

pez06:09:18

It is almost unimaginable the timing here. This just out in #announcements https://clojurians.slack.com/archives/C06MAR553/p1663308071949609

Alan Birchenough12:09:56

I'll be sure to take a look.

Alan Birchenough12:09:02

@U0ETXRFEW I will compile everything we know so far using the different scenarios, and including the logs provided by the Lambda Island tool.

Alan Birchenough12:09:33

Thanks for bringing it to my attention.

🙏 1
pez14:09:19

It wasn't such a magical timing thing as I thought. It was my question in that ^ issue that got @U051BLM8F to ask @U07FP7QJ0 to make a proper release of this proxy tool. It has existed for a year or so. 😃 (Iiuc).

Alan Birchenough14:09:41

Well it still is magical in the sense that the community is generously and intelligently doing its thing, but I guess it’s a less spooky kind of magic than we might have initially thought.

Alan Birchenough14:09:42

@U0ETXRFEW I hope to make progress in compiling the scenario information over the next few hours.

pez14:09:12

The Clojure tool smith community is fantastic. I am so happy and proud to be part of it. Don't know if you've seen my #clojured 2021 talk? It has this tool smith community as its main theme. https://www.youtube.com/watch?v=NIk5hVzA_fY

Alan Birchenough14:09:54

Not yet. I look forward to seeing it this weekend.

Alan Birchenough00:09:14

@U0ETXRFEW You’re not going to believe this, but I have fixed this issue using the dumbest approach imaginable. I just deleted my Application Support folders and my ~/.vscode folder and started over with a clean setup of VSCode, installed Calva, ran the minimal project and … it worked!

Alan Birchenough00:09:12

Before that I spent most of this afternoon logging nREPL messages using the Lambda Island library, which is pretty nifty, but unfortunately did not uncover anything useful in this particular case.

Alan Birchenough00:09:31

I am sorry to have taken up so much of your time on this matter, but at least I:

Alan Birchenough00:09:58

• Got to make your acquaintance in person - very cool; AND

Alan Birchenough00:09:30

• Learned a whole bunch about nREPL.

Alan Birchenough00:09:18

I’ll probably head over to Amazon and get a premium Calva T-shirt to mark the occasion. Thanks again for your patience!

pez07:09:54

How very, very odd! But great that it now works. And with great side effects. It was a pleasure trying to be of help here, as well as meeting, getting a face (almost). Enjoy that Calva t-shirt! calva

Alan Birchenough16:09:32

@U0ETXRFEW I agree about the “side effects”, and thanks again for meeting with me. The T-shirt is due to arrive today! Best wishes, A.

pez16:09:25

What a lovely review, @U039K02M4UB! 🙏 ❤️ calva

👍 1
Alan Birchenough17:09:59

Overall, the Calva experience is just excellent, and to say I am grateful for it would be an understatement. But I would so like to get this one little piece of it to work. 🙏

🧵 2
popeye18:09:47

In VS code clicking on a function redirects to file from resource and bin files, it is painful for me to debug! any idea how to avoid it? i do not want to go to the function which is in resource and bin folder

pez20:09:26

I early recognize this... @U9A1RLFNV do you recall if we have seen this before?

bringe22:09:55

I seem to remember something about this and it may have been related to clojure-lsp. I don’t remember the solution. @U01J3DB39R6 Is this happening when you have a repl connected?

popeye14:09:40

not connected with repl

ericdallo00:09:05

Clojure-lsp ignores target and resources folder by default, check :source-paths-ignore-regex https://clojure-lsp.io/settings/, if that is not working, check server logs and/or serverInfo to check the config clojure-lsp is loading and if classpath/source-paths are correct

popeye07:09:45

@UKFSJSM38 I do not have those info anywhere mentioned

ericdallo12:09:50

Could you paste the server logs? or serverinfo output

popeye12:09:03

Which location it will be present? I refereed this https://calva.io/clojure-lsp/#opening-the-server-log-file also I am running figwheel_Server.log

ericdallo12:09:15

It should be opened on calva itself, as a new buffer

popeye12:09:36

is my setting

popeye12:09:39

may be I am giving wrong infos, I just installed calva in my vs code and using it, nothing more than that

pez15:09:16

There is a Calva command Calva Diagnostics: Open Clojure-lsp Log File, when you have issued it, Calva should open the file in a separate editor (tab).

pez15:09:56

You can also reach this command using the clojure-lsp statusbar button. You'll find the command for showing the lsp server info there as well.