Clojure in VSCode, Calva messes with compile path? - visual-studio-code

So I setup a project with Lein, test and run, works fine. I open it in VSCode (where Calva is installed) and when running the same test: lein run test I get C:\Users\felix\AppData\Local\Temp\clojure-3239065182638120769.edn So there is something when I open the project in VSCode with Calva that makes Lein suddenly look for the .clj files in my Local Temp folder. How can I make it stop looking elsewhere, why could it run it fine before I opened it in VSCode?

lein test is the way to do it, here's a great write up on leiningen's test process: https://medium.com/helpshift-engineering/the-convoluted-magic-of-leiningen-test-selectors-2eb6c452dfcf
Another awesome thing is you can just run the tests in calva!
https://calva.io/test-runner/

Related

What settings do I have to change to make Visual Studio Code automatically run files in the right directory?

Coming from IDLE, I am used to be able to just left-click python files anywhere, it'll launch IDLE, and then pressing F5 just runs the script. In VSCode however, I have to open the terminal, cd into the right directory, and only then can I finally run my python script. Is there a way to change this behavior?
I was recommended to use the Code Runner extention and bound the Run Code (code-runner.run) command to my F5 key.
Then I noticed input() not being ran so I had to make sure code-runner.runInTerminal was on, but that re-started my problem from the beginning because the terminal was at the wrong working directory and then I finally found the code-runner.fileDirectoryAsCwd setting to run it from there.
I think this solution is similar to this one for the python extention, but I'm not sure if that would cause the whole wrong working directory issue again.
choose from menu file then click on auto save

Visual Studio Code only compiles when launched from project folder on Linux

I have Visual Studio Code installed in Ubuntu 20.04. I love how it works. I installed it from the tar ball. Same with the SDK. I just found that those appear to work better than installing from deb packages.
I created a desktop file so I could add Visual Studio Code to the dock and launch it that way, but what I've noticed is that projects won't compile. I get errors stating it can't find the project even though the errors are listing the folder where the items exist.
The only way I can get it to work is to:
Open a terminal.
Navigate to the folder where the project files reside.
Launch code from the command line.
Then it works. Otherwise, I get a pop-up error that says "The preLaunchTask 'build' terminated with exit code -2" and then the terminal window is filled with errors.
Here's the last of the error messages and then I opened up a terminal and it shows that I'm in the folder for the project and the csproj exists there:
This also happens if I install Visual Studio code from a repository. It seems launching it from the Unity desktop breaks something. But if I launch it from the command line in a terminal session from the folder where the project resides, then the problem goes away.
I can also reproduce this error from the command line if I launch Visual Studio Code from a different folder than the project I'm trying to compile.
Is this common? Just curious. I'm wondering if because when I launch it from the Unity desktop, it's launching under a different
I got it working under 20.04. I must have done something wrong so I did a wipe of the .NET Core install and reinstalled it all using the bash shell script and then was able to install Code via Software Installer tool. Not sure why it didn't work before, but it works now.

how to launch NetLogo from Terminal if there are extensions loaded

Before version 6 I was able to launch NetLogo from Terminal like this:
java -jar /Applications/NetLogo\ 6.0.4/Java/netlogo-mac-app.jar
and it worked fine even with extensions, but nowadays it seems that NL is unable to find even bundled extensions when launched from terminal...
is there something I am doing wrong?
cd /Applications/NetLogo\ 6.0.4
java -jar Java/netlogo-6.0.4.jar
now go to
File > Open...
and pick your model to start
that worked for me.
You have to run the jar from the same location as application starts from.

How to run cargo from Emacs

I'm writing tests in Rust with Emacs. Is it possible to run the cargo run command of my test file in Emacs itself, rather than switching to the terminal for every build?
From your Cargo.toml file (or the project root directory), run M-x compile and then enter cargo run and then hit RET. From that same directory you can run M-x recompile.
You could bind the above to short key bindings, but you should probably investigate cargo.el.
rustic mode provides an interface to a number of cargo commands. Among other things you can build, lint, and run tests at point. In the guide Configuring Emacs for Rust development I'm describing setup and usage in detail.

Reloading/Recompiling/Refreshing .beam files inside a terminal

I use Eclipse and Erlide to develop in Erlang. To run the software I enter the ebin/ directory with my terminal since I don't like the console Eclipse provides. However after each change I have to exit and re-enter erl in the terminal to reload the .beam files that have been changed. Eclipse automatically generates new .beam files into the ebin/ directory after every save.
I know I can manually compile it with the c(filename) command, but that would require me to move to the src/ directory, compile the files, and move them back to the ebin/ directory. This requires a lot more work that just exiting and entering the Erlang terminal.
I have heard of makefiles, but I don't know if they can be ran from within an Erlang terminal.
The reason I don't want to exit the terminal is because I will lose my history of previous commands. If I'm using modules:methods with long names this takes a lot of typing time for each change made.
Is there any method to reload the .beam files in the current directory while in an Erlang terminal? Or is there any way to load the previous command history of the Erlang terminal?
You can use the l(Module). command in the shell which loads, or reloads, a module from the current directory into Erlang.
I would suggest something like active or sync but straightforward approach with c/1, l/1 and nl/1 works too
[edited]
Run your application from eclipse and check the node name, the default is #. Shut that down.
Start a separate erlang node with the same name. Now when running the application from eclipse that node will get used and you can use the shell in the terminal, while erlide will be able to reload beam code automatically when saving files.