Fork me on GitHub
#calva
<
2021-10-21
>
fabrao01:10:40

java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.26.0""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"

fabrao01:10:47

WARNING: Implicit use of clojure.main with options is deprecated, use -M

fabrao01:10:24

what is this warning when running calva repl?

seancorfield01:10:16

@fabrao It's a warning from the CLI -- deps.clj is a Java version of the Clojure CLI -- and it is deprecated to use -m without -M now.

seancorfield01:10:21

(has been for ages)

seancorfield01:10:59

(! 1116)-> clojure -m simple.clj
WARNING: Implicit use of clojure.main with options is deprecated, use -M
☝️:skin-tone-2:

bringe04:10:36

@seancorfield I don’t really understand its usage completely. The documentation for it says -M[aliases] Use concatenated aliases to modify classpath or supply main opts, so it looks related to using aliases, but I see in the deps and CLI guide an example of it being used without aliases, like so: clj -M -m hello. I confirmed that adding -M before -m in Calva’s jack-in command (at least the one I copied from a simple project), doesn’t trigger the warning. Can you explain its usage?

pez05:10:46

For everyone's information we have deferred this fix on purpose as a way to be backwards compatible to older versions of the CLI tools. It's probably time to drop that, but anyway. See: https://github.com/BetterThanTomorrow/calva/issues/826

bringe17:10:02

I was looking for that issue! Thanks for linking.

seancorfield17:10:04

Yeah, it's definitely a tricky one if you're trying to support "ancient" CLI versions. Several of my projects have very clear minimum CLI versions listed on their README but I still field questions from folks trying to use much older versions. Given the way the CLI has evolved, there's no backward compatible way to support everything: -M on older versions did not respect :extra-deps or :extra-paths in aliases (only :main-opts), -A for running clojure.main stuff is deprecated and produces a warning (and will stop running clojure.main at some point and only start a REPL), using clojure.main implicitly (without -M) is deprecated and produces a warning (all will also stop working at some point because the default behavior is/will be the same as -A).

seancorfield17:10:01

It has been just over a year now since all that came in -- September 25, 2020 -- and then all the tooling stuff changed a bunch of stuff too (July 28, 2021). I think at some point you'll just have to draw a line in the sand and say "Requires Clojure CLI version x.y.z or higher" and just make it very clear.

seancorfield17:10:04

clojure -version would be the "obvious" thing to check, but that was only added in 1.10.2.790 (Feb 19, 2021) and prior to that it throws an exception 😞

seancorfield17:10:45

clojure -Sdescribe is pretty safe -- it's been there since day one, I think, but I think it returns unreadable data on Windows on older versions so you can't just EDN parse it but regex should work to isolate :version "x.y.z" in the output.

seancorfield17:10:13

Here's output from the July 17, 2020 version:

(! 716)-> /usr/local/Cellar/clojure\@1.10.1.561/1.10.1.561/bin/clojure -version
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
-version (No such file or directory)

Full report at:
/var/folders/p1/30gnjddx6p193frh670pl8nh0000gn/T/clojure-3122829368328296948.edn

(! 717)-> /usr/local/Cellar/clojure\@1.10.1.561/1.10.1.561/bin/clojure -Sdescribe
{:version "1.10.1.561"
 :config-files ["/usr/local/Cellar/[email protected]/1.10.1.561/deps.edn" "/Users/sean/.clojure/deps.edn" ]
...

seancorfield17:10:36

Dunno if that helps but happy to help explain/test anything you need on historical versions since I have pretty much every single version installed -- both prerelease and stable -- since 1.10.1.561.

jeffparker20:10:26

Since 1.10.1.672 introduces a new config attribute :repl-aliases (and the -M warning), it's been used as crude version test here: https://github.com/jacobobryant/biff/pull/84

pez21:10:15

Thanks for the offer to access your suite of clojure versions, @seancorfield! We don’t really have an ambition to support ancient versions, though. As you are known to have said: “There is no way jack-in can be made to work for all cases” (sorry if I am butchering the original quote). We just thought that @U05254DQM’s suggestion to hold off getting rid of the warning some time, while projects upgraded, was great. But now it’s time to move on and stop confusing our users with a warning they. should ignore.

seancorfield21:10:19

@U04VDTMKU I had to go look that up in the source code! TIL: -A is the shorthand for --repl-aliases 🙂

seancorfield21:10:15

["-R" "--resolve-aliases ALIASES" "Concatenated resolve-deps alias names" :parse-fn parse/parse-kws]
   ["-C" "--makecp-aliases ALIASES" "Concatenated make-classpath alias names" :parse-fn parse/parse-kws]
   ["-A" "--repl-aliases ALIASES" "Concatenated repl alias names" :parse-fn parse/parse-kws]
   ["-M" "--main-aliases ALIASES" "Concatenated main option alias names" :parse-fn parse/parse-kws]
   ["-X" "--exec-aliases ALIASES" "Concatenated exec alias names" :parse-fn parse/parse-kws]
   ["-T" "--tool-aliases ALIASES" "Concatenated tool alias names" :parse-fn parse/parse-kws]
(although the first two are deprecated)

jeffparker21:10:56

Ha yeah. Its existence offers a pretty clean version distinction then.

practicalli-john07:10:51

That's an old ticket I raised, feel free to close if you have a resolution that works for your users. If I remember correctly, the two challenges I had were 1) I couldn't specify the flags to use, i.e -M for repl stuff 2) user wide aliases were painful to use as extra config was needed per alias (and at the time it didn't like aliases with hyphens in the name) As someone who uses a lot of user level aliases, I always preferred to use calva connect. jack-in felt too limited for my needs. I appreciate I'm probably not the target audience for calva though, so please do what's best for your users.

pez07:10:12

I’ve only really considered the warning part of that ticket, @U05254DQM. You are welcome to raise separate tickets for the other concerns. We can do it ourselves, of course, but we might lose details in the translation. Specifically I don’t understand this one: > typing in `-M:alias-name` Where are you typing that in?

pez07:10:59

Generally, we do support changing options these days. We’ve added a command for copying the jack-in command and use that as a start for a workflow where you start the REPL yourself and then connect to it.

seancorfield04:10:10

-M = clojure.main, -m is an option to clojure.main

seancorfield04:10:20

-X = exec function

seancorfield04:10:59

-A = start a REPL -- for historical reasons this also currently runs :main-opts but it will stop doing that "soon".

seancorfield04:10:23

@brandon.ringe I gather you're not in #tools-deps?

bringe04:10:59

I am, but have not been following along there. 😄

bringe04:10:04

Thanks for the explanation.

seancorfield04:10:32

This is just "standard" Clojure CLI stuff and it's documented on http://clojure.org Pretty much all of this came in a year ago https://clojure.org/releases/tools#v1.10.1.697

seancorfield04:10:59

(and then https://clojure.org/releases/tools#v1.10.3.933 was the next big update with "tools" usage/support)

seancorfield04:10:14

It's a bit frustrating but it shows that somehow the core team haven't really managed to communicate a lot of what they've been doing for the last year or two 🙂

seancorfield04:10:48

I've been "Team CLI" since 2018 -- and haven't really touched lein since 2015 now (I was "Team Boot" for a while there) -- so it's hard to know what people don't know...

bringe04:10:07

Wow that’s interesting stuff. Yeah I’ve been team CLI for some time, but obviously my usage of it has been narrow. I knew it was getting upgrades though.

bringe04:10:49

I believe I listened to a podcast interview with you some time ago in which you mentioned using the CLI for all projects or switching all projects over to it at your job. If I wasn’t convinced by that time you may have played a role in convincing me I didn’t need lein. 😄

seancorfield04:10:01

The CLI/`deps.edn` is extremely capable, especially with tools.build now.

seancorfield04:10:32

Now, if only we could banish nREPL in favor of the built-in Socket REPL... 🙂

bringe15:10:47

This is something I’ve been interested in exploring more, at least from a tooling perspective, though to be fair, I don’t have much of a problem with nREPL. I think that some (maybe much) of the functionality has been pulled out into orchard, so maybe it can be easily used from socket REPLs. Anyway, comments like yours make me want to learn more about socket REPLs and the differences in capabilities and functionality between them and nREPL.

seancorfield16:10:57

My main issue is that I want to be able to connect my editor to a running process that has no specific dependencies but was started with a JVM option to tell Clojure to start a Socket REPL. I connect my editor to remote processes, so the editor has to be able to work without any server-side dependencies.

seancorfield16:10:59

Clover side-loads a small blob of code to enable unrepl (which has its own problems) and I'm willing to live with that compromise -- but I really would prefer it not inject code into my QA/production processes for obvious reasons!

seancorfield16:10:46

There's been talk for ages of nREPL being able to side-load itself over a bare Socket REPL but the amount of code in that equation definitely bothers me.

seancorfield16:10:37

The main issue, I think, with a bare Socket REPL (or even a pREPL) is that you can't interrupt evaluation, and it's a pure stream, so it interleaves stdout and results (pREPL solves that problem to some extent) and you get the entire result back -- so evaluating (range) locks things up.

seancorfield16:10:15

Again, unrepl has a "solution" to this but it causes its own problems -- @U3Y18N0UC has battled unrepl a lot during the history of Chlorine/Clover.

bringe17:10:12

I see. It will be interesting to see where things go with regards to REPL tooling.

seancorfield04:10:19

(simplicity...)

Yuner Bekir05:10:17

Is the ctrl+k a new command? It interferes with ctrl+k ctrl+c for commenting lines of code

pez07:10:35

Yes, it’s new. I didn’t know about ctrl+k ctrll+c and now I realize that a lot of cmd+k chords actually are ctrl+k on Windows… We’ll need to fix that. In the meantime, rebind the Kill Right command to some other shortcut (or remove the binding). And please file an issue about this.

👍 1
amar12:10:54

Hi @U0ETXRFEW I can work on it. What chord should it be bound to?

🙏 1
pez12:10:24

That’s the crazy thing, it should of course be ctrl+k the universal delete right. What on earth was going through the heads of the VS Code team hogging it for other things??? I think they are all Mac users and just goofed this one. 😃

pez12:10:17

We should do some research around default Windows VS Code bindings. But if ctrl+alt+k is free, maybe that. And then shift+ctrl+alt for Select Right, WDYT?

amar12:10:54

I'll defer to you. I use VS Spacecode so probably in the minority.

amar12:10:36

Will investigate what the defaults are on windows.

amar13:10:39

@U0ETXRFEW so ctrl+alt+k is free. ctrl+shift+alt+k is used for Calva Paredit: Drag Sexp Forward Up. so not sure how we can keep a similar mnemonic

pez14:10:24

Hahaha, I actually use that a lot!

pez14:10:48

I wonder if ctrl+e is bound to something interesting on Windows…

pez14:10:25

I now realize we should have this discussion on the issue: https://github.com/BetterThanTomorrow/calva/issues/1356

👍 1
pez07:10:20

Dear Calva friends: I’d like to promote the use of threads for discussions in this channel. Because a major use of it is support. Keeping several discussions and support questions out in the main flow adds risk that a particular support question is missed. It is also much easier to consume a particular support question and its follow-ups as a thread.

👍 14
1
knotschi16:10:46

I just can't get calva to run my tests 😥 Whatever I try it says always No tests found. :scream:, ns: 0, vars: 0 In my clojure-lsp.out I can find the line Automatically resolved source-paths from project.clj: #{"turbod/test" "turbod/src" "turbod/dev"} which are the correct source paths. Anyone any idea what I can do to debug this?

ericdallo16:10:52

Clojure-lsp has nothing related with repl, maybe you didn't eval the namespace?

knotschi16:10:15

I did eval the namespace. And I am not trying to run the tests from the repl, that actually works. I am trying to use calvas test runner (e.g. [Ctrl + Alt + C T]) (the lsp output I was just mentioning because it says here https://calva.io/test-runner/ that I may have to add source paths to .lsp/config.edn )

bringe16:10:05

Cider-nrepl is used to find and run tests. I’m guessing clojure-lsp is used somehow with the feature for switching between related test and source files. (I didn’t implement that feature.) Is this Clojure (not ClojureScript) code you are trying to run tests for? The test runner only works for Clojure.

bringe17:10:05

If you keep having issues, please create a GitHub issue and link to a repro with a project we can reproduce the issue with, and list your repro steps.

knotschi18:10:19

yes its clojure

knotschi18:10:53

yes thanks, trying to reproduce it on a fresh small dummy project would be my next step. If I find a simple way to reproduce it I will create an issue. I was just hoping that maybe anyone has any idea on how I could potentially debug the issue. Some logs or similar to see what is actually going on

ericdallo18:10:19

BTW clojure-lsp has no feature to switch between tests and source-path, yet :)

👍 1
pez20:10:25

Did you also load the test namespaces, @U06BCCQPL?

knotschi20:10:12

yes. I did the following: • opening the test namespace • being with the cursor on the actual test that I would like to run • [Ctrl + Alt + C Enter] to load the namespace • [Ctrl+Alt+C Ctrl+Alt+T] to run the current test Then I see in the REPL the message: No tests found. :scream:, ns: 0, vars: 0

knotschi20:10:36

Actually it says:

; Running test: test-encryption…
; No tests found. 😱, ns: 0, vars: 0

pez21:10:03

Yeah, I am a boomer who likes smileys 😃

pez21:10:10

What happens if you evaluate the test symbol?

pez21:10:27

(test-encryption)

pez21:10:10

In any case, if you can create a minimal repro, that would be awesome. We get quite a lot of reports about troubles running tests, so I suspect there is something we need to fix, but I never quite can reproduce the problems myself.

knotschi21:10:52

(test-encryption) ; => nil

bringe03:10:25

@U0ETXRFEW Do we know why .lsp/config.edn is mentioned in the docs here? https://calva.io/test-runner/#toggle-between-implementation-and-test-command-not-working-as-intended I don’t see where/how LSP might be used for that feature.

Marc O'Morain12:10:39

This can happen if the cider nrepl middleware is not loaded.

Marc O'Morain12:10:06

Calva never checks that the nrepl test middleware is loaded afaik.

pez12:10:04

That’s correct. We probably should start checking for it. 😃

pez13:10:56

@brandon.ringe At the top of my mind I have no idea. 😃

bringe15:10:02

@U06BCCQPL Did you start the repl via jack-in, or did you connect to a repl started without jack-in? @U0K592YDP and @U0ETXRFEW, is it possible for the middleware to not be loaded even when it’s specified in the command that starts the repl, and the repl starts successfully? I’m not sure if / saying that is the case here. I’m just wondering if it’s possible.

pez15:10:01

I think you should see a warning if there is something preventing the middleware from starting. But I am not sure.

fabrao16:10:58

@brandon.ringe Thank you for information, excuse me if I´m understand well, but is there any way to change the jack-in command in the manual way? Or do I have to wait Calva fix deploy?

pez16:10:21

It's just a warning. Everything works. 😀

bringe17:10:19

Yeah, as @U0ETXRFEW said, it’s just a warning. It’s not indicating that anything is broken.

fabrao20:10:38

but Is there any way to change that command line for starting it?

pez20:10:17

You can influence it in some ways: • Selecting different items in the various menus that the Jack-in process gives you • Create a custom connect sequence: https://calva.io/connect-sequences/ • Use the command Copy Jack-in command line (or some such) and modify that command as you wish and submit it on the command line. Then use Calva Connect to connect to the nRepl server (that your command is then responsible to have started). • Similar to the previous, you can craft your repl start command freely. Just make sure Calva’s requirements on the started nRepl server are met.

rohit_20:10:16

I am having trouble with debug breakpoints being hit when I run tests either within a namespace or under the cursor. Is there something I might have missed. When I call the function in the namespace execution stops at the line containing the #dbg.

pez20:10:21

How do you run the tests?

bringe03:10:23

This info may be helpful to you, if you haven’t seen it yet: https://calva.io/debugger/#my-breakpoint-in-a-test-isnt-being-hit