Fork me on GitHub

Hi, I've recently started using calva and am really liking it! Am connected to a REPL running in docker and 'Goto Definition' etc doesn't work for me because it tries to find the file using the docker container paths. Is there an equivalent to cider-path-translations in Calva?


We don't have that. Issue welcome!


Sure, will file it!


Ooo mind posting the link to the issue here? I’d love to +1 it


A pretty old one...


Wanna have a go at a PR, @U01EB0V3H39 or @U07Q1DKB8? Whatever CIDER does is probably what we should do.


It'll be my first time for VSCode extension but it's something I can investigate. I added a comment about jump to definition using LSP, to the same issue:

partyparrot 1

Thanks. I also commented some now. Would be super valuable if someone with the actual problem takes it on. I have many, many setups here, but at some point it gets hard for me make sense of them all.


I was playing around with fulcro in the readme, it said clj -A:dev -J-Dtrace -J-Dguardrails.enabled=true to start a backend server. I can start repl using calva jack-in, but how can I add additional parameters like -J-Dtrace -J-Dguardrails.enabled=true


Hi! Calva does not have configuration for setting Java options directly. You can provide these via :jvm-opts on an alias in deps.edn, or via the environment variable JAVA_TOOL_OPTIONS. Something like this would be an equivalent command line invokation (assuming something Unix-like):

JAVA_TOOL_OPTIONS='-Dtrace -Dguardrails.enabled=true' clj -A:dev
You then can use the command Calva: Copy Jack-in Command Line to Clipboard, to get the REPL started in a Calva compliant way, then use Calva: Connect to a Running REPL in your Project, to connect to it. However, you can also still use Jack-in. Calva has a settings calva.jackInEnv, where you can provide this environment variable, and Jack-in should work. Yet another option, that is Jack-in compatible, is to add this in your deps.edn. Something like:
:aliases {:dev {:jvm-opts ["-Dtrace" "-Dguardrails.enabled=true"]}}
You could then specify the :dev alias at Calva Jack-in. I think I would go with the last one, as it makes the project config portable and easy for others to use.

❤️ 1

Okay, I will try these later! Thanks for your help as always~

🙏 1

You are most welcome, @U020WAVDMMK! If you have some little time, I have a favor to ask: We are trying to populate with content about Calva. So that it will be easier to google for it. This question you ask is pretty common, and would make excellent content. Would you consider asking this question there? Then I can write my answer there as well.


@U0ETXRFEW Sure. No Doubt. I'll do this in a minute and post the link here.

❤️ 1
Yehonathan Sharvit13:05:38

Is there a way to clear the REPL window (not the REPL history)?


There is no special command for it. I do Select all, then delete.


Might be possible to create a command for it using #joyride. Not sure about this, though.


Also: There are commands for showing the output window, and for showing the file for whatever current namespace the output window has. Those two commands are bound to the same keyboard shortcut: ctrl+alt+o o, and will ”do the right thing” depending on context.


If the output window is not in the namespace of the current file, you can make it so with the command Switch namespace of output window to current file (or something like that). Default keybinding ctrl+alt+c n

Yehonathan Sharvit13:05:19

I was already aware of ctrl+alt+o o


I tried to automate it with #joyride, using all these commands, but Calva is not fully prepared for it yet. It doesn't block on some key promises as it should.


Noting the non-working Joyride function down here, so that I can return to it later when I have fixed Calva:

(defn clear-output-window []
  (p/do (vscode/commands.executeCommand "calva.showOutputWindow")
        (vscode/commands.executeCommand "editor.action.selectAll")
        (vscode/commands.executeCommand "deleteLeft")
        (vscode/commands.executeCommand "calva.showFileForOutputWindowNS")))


Hey guys! First of all, thanks to all the contributors for this awesome extension. For the longest time, it was my impression that lisp programming can only be done properly in Emacs - well, not anymore! Now a question: I have some commands that take a long time to complete, but when I eval and send them to the REPL, there is no feedback, so it's hard to figure out what's happening sometimes. Also if I eval a command that runs forever, same kind of trouble. I stumbled upon this issue on Github and posted a suggestion there: But is there anything else I could do in the meantime to get better eval feedback?


Thanks. That change with when we print the code to the output window should be fairly quick to implement. If you wanna PR it, that would be great.


In the meantime... You can experiment with some different themes. Calva does highlight the code being evaluated. Only all too subtle. Maybe some themes will make it more or less visible than others.


Would love to open a PR, will do that now.

🙏 1

For the highlighting, is it the same as the regular selected text highlighting? Like when you select text with the mouse


Not the same. But quite similar. It is more ”the same” as the highlighting when the code has been evaluated.

👍 1

Awesome. Thanks! Review in. 😃


Cool, will add the changelog entry in a sec


Added now - hopefully I did that right 😄


Merged! 🎉

brazil-parrot 1
🎉 1

Anyone has jump to java source working? I saw it successful once, and I want to see it one more time. 😉


I haven't gotten it to work for a long while. This needs to be fixed soon.


Dear Calva friends: @edward.partenie helped himself and all us other Calva users get a bit better feedback about when long running evaluations has really started. A new Calva version with this change is now out: • Addressing: Thanks, @edward.partenie! 🙏 calva ❤️


Thanks for the quick release! Also, whoops, I messed up the ID number of the referenced issue 😞


Haha, yeah, Sloppy review as well! What is it Rich Hickey says is common for all bugs in production now again? 😃


Now fixed. Don't know if Slack caches it though:

🙏 1

How does calva locate the java installation, and is it configurable? I didn’t find anything in the settings/docs. I’m trying to use a specific version of java.


For Calva Jack-in this is the Java that you reach from the environment that VS Code runs in. I use sdk-man to set a new default Java before Jack-in, if I need something special. Or I use the command Copy Jack-in command line to clipboard and run it from the terminal where I have set whatever Java as the current one. Then connect Calva to the REPL started.


Any tips on how I can figure out what VS Code is seeing for paths? When I open a VS Code Terminal and run java -version` , I see the same version as I do from an external terminal. But when I Jack-In, the java process reports a much newer java version. Also, I started VS Code in my project directory from the same terminal which shows the correct java version: code .


so I would have thought the VS Code process would find the same java version as I see from the command line


nevermind, user error. :face_palm:

alias code='JAVA_HOME=$JAVA_16_HOME code'

😂 1

It is still strange that you see different Java versions from an internal terminal and from Jack-in when VS Code is started from a terminal...


From what I can tell, it looks like the internal terminal runs my bash_profile, which does set JAVA_HOME to an older version.


But if you start code form a terminal where you have that profile, I thought that would be the environment that Jack-in has. (Jack-in is spawning a nodejs child_process, if that tells you anything.)


except the alias above is in bash_profile. so only for code is java set differently


Maybe now is when I should also mention that there is a setting calva.jackInEnv, where you can set JAVA_HOME. That should let you control the java version as well.

👍 1

i think i did that because lsp requires some minimum java version


Then the jackInEnv setting might come in extra handy. One JAVA_HOME for clojure-lsp, the other for the REPL.


how do I specify them separately?


oh, did you mean: • specify Java 16 in my alias as before, which will apply to lsp • but then to specify older Java version in jackInEnv for my repl


Yes. I think that should work. Maybe name the alias something else, in case you forget again what's happening. 😃


haha, yeah good call


The latest Joyride posts remind me to ask: has there been any progress on exposing an API from Calva that can be manipulated from Joyride, e.g., allowing for Joyride scripts to send code to the current editor's connected REPL for evaluation and getting the result back (as a string or better as Clojure data)?


Not much progress there yet. But we should be able to create that particular API pretty quickly. Not sure about Clojure data, but it would be in the same form as Calva itself gets it. That's a string, I guess, not sure if we have clojure.edn/read-string in Joyride, do we, @U04V15CAJ?


but not all evaluation results are valid edn of course


A brief intro to Joyride, dear Calva friends: Come'on join the #joyride! joyride