calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
pez 2021-04-10T07:02:06.386600Z

Dear Calva-friends: v2.0.186 just out https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.186, see also #releases for an extract of the last two weeks of changes.

3
2021-04-10T11:18:57.387Z

Hello! How to get a ClojureScript REPL in Calva without using Figwheel or shadow-cljs?

2021-04-10T11:19:03.387200Z

I want to connect it to the hello-world project of ClojureScript's "Quick Start" guide (https://clojurescript.org/guides/quick-start).

2021-04-10T11:19:17.387400Z

I can't figure out how to get it working.

2021-04-10T11:23:25.388200Z

(In another project I have Calva with Figwheel working fine, but I would like to have this hello-world project with the minimum and simplest setup.)

pez 2021-04-10T11:49:44.391200Z

@xavi: This is a stupid omission in the default jack-in/connect sequences that should be fixed. Please feel invited to add an issue about it. However, all is not lost, you can define this as a custom sequence. It would look like so in .vscode/settings.json:

{
    "calva.replConnectSequences": [
        {
            "projectType": "deps.edn",
            "name": "plain cljs repl",
            "cljsType": {
                "dependsOn": "User provided",
                "connectCode": "(do (require 'cljs.repl.node) (cider.piggieback/cljs-repl (cljs.repl.node/repl-env)))"
            }
        }
    ]
}
Then jack in and select plain cljs repl as the Project type.

2021-04-10T12:20:17.393600Z

Great, thank you! I got the cljs꞉cljs.user꞉> prompt and it works.

2021-04-10T12:20:50.394300Z

I have another problem now, though it doesn't seem related to Calva...

pez 2021-04-10T12:22:08.395600Z

Ask it anyway 😃

2021-04-10T12:22:31.395800Z

That connect sequence doesn't open a web server, so I'm trying to start one from the command line using

clj -m cljs.main --serve
and i get...

2021-04-10T12:22:59.396500Z

WARNING: When invoking clojure.main, use -M
Serving HTTP on localhost port 9000
Exception in thread "Thread-1" java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Future.get()" because "fut" is null
...
Exception in thread "Thread-2" java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Future.get()" because "fut" is null

2021-04-10T12:23:46.397500Z

Any idea ? (this invocation also appears in https://clojurescript.org/guides/quick-start )

pez 2021-04-10T12:24:04.397900Z

The connect sequence doesn’t connect a browser repl either. But that is a later problem for when you have gotten the cljs app running in the browser. I’ll see if I have any idea….

pez 2021-04-10T12:29:34.399200Z

Actually, it seems to be a matter of starting a browser repl. Make the settings look like so

{
    "calva.replConnectSequences": [
        {
            "projectType": "deps.edn",
            "name": "plain cljs node repl",
            "cljsType": {
                "dependsOn": "User provided",
                "connectCode": "(do (require 'cljs.repl.node) (cider.piggieback/cljs-repl (cljs.repl.node/repl-env)))"
            }
        },
        {
            "projectType": "deps.edn",
            "name": "plain cljs browser repl",
            "cljsType": {
                "dependsOn": "User provided",
                "connectCode": "(do (require 'cljs.repl.browser) (cider.piggieback/cljs-repl (cljs.repl.browser/repl-env)))"
            }
        }
    ]
}
Then jack in again, choosing the browser project type.

2021-04-10T12:39:45.400800Z

Yes! That works for me... and I can get the cljs app running in the browser using "Calva: Load current file and dependencies" with the hello_world/core.cljs file

pez 2021-04-10T12:46:04.403400Z

Awesome.

2021-04-10T12:47:09.404200Z

In a full-stack clj/cljs app with its own web server, this setup would work too? Anyway, i'll try later today. I'll also open an issue to have this "plain cljs browser repl" connect sequence built-in

pez 2021-04-10T13:06:53.404500Z

Thanks!

2021-04-10T13:07:08.405100Z

Anyone know of any pretty-clojure-symbols for VS Code, like pretty-symbol for cursive?

alefeans 2021-04-11T16:23:41.431100Z

Hi ! I'm using this one: https://marketplace.visualstudio.com/items?itemName=siegebell.prettify-symbols-mode

alefeans 2021-04-11T16:24:55.431400Z

Nowadays, i'm only using this substitution:

"prettifySymbolsMode.substitutions": [
        {
            "language": "clojure",
            "prettifySymbolsMode.renderOn": "none",
            "prettifySymbolsMode.revealOn": "none",
            "prettifySymbolsMode.prettyCursor": "none",
            "prettifySymbolsMode.adjustCursorMovement": true,
            "substitutions": [
                {
                    "ugly": "fn",
                    "pretty": "λ",
                    "pre": "\\(",
                    "post": "\\s\\[",
                    "style": {
                        "color": "#B877DBE6"
                    }
                }
            ]
        }
    ]

2021-04-11T16:25:19.431600Z

thanks, i never found that one when I was looking!

alefeans 2021-04-11T16:25:26.431800Z

alefeans 2021-04-11T16:28:03.432200Z

U're welcome ! It's very easy to use 🙂

pez 2021-04-10T13:07:41.405500Z

What does pretty-symbol do?

2021-04-10T13:09:39.405900Z

it replaces some character combinations with single character, e.g.

2021-04-10T13:09:56.406400Z

that gate symbol is let, the f is defn

pez 2021-04-10T13:10:16.406500Z

Yes, full stack should just work. There is both a Clojure and ClojureScript REPL there. If you create a .clj file it will be using the Clojure REPL. And if you create a .cljc file you can toggle which REPL it should be connected to. There’s even a button in the status bar for this.

2021-04-10T13:10:33.406800Z

anonymouse functions look like this

2021-04-10T13:12:18.409200Z

fira code does some of it for me, but its general font stuff not clojure specific obviously

pez 2021-04-10T13:12:32.409500Z

Haha, how awful. 😃 There are fonts that do this. Like Tonsky’s FIRA Code. However, last time I checked it didn’t have a lambda symbol, and Tonsky didn’t plan to add it, because it is not wide enough.

2021-04-10T13:12:49.409700Z

😄

2021-04-10T13:13:03.410100Z

I find things that reduce the amnount of code I have to read makes understanding stuff easier for me

2021-04-10T13:13:26.410800Z

I think things like defn / let / fn / set add to the noise

pez 2021-04-10T13:13:36.411100Z

Yeah, that’s the rationale behind FIRA Code as well. I tried it. Got super confused and dropped it. 😃

pez 2021-04-10T13:14:24.411500Z

Let’s see if someone else knows what options there are for this.

👍 1
2021-04-10T13:20:59.413Z

@pez, i've switched to calva from cursive / ideaj and won't be going back! Calva really is wonderful. IdeaJ would crash and hang a lot, would struggle if a clojure file got over 1000 lines or so. Support for CLJS was annoying at times. Calva is just great, it all just works and getting repl evals to show inline in the editor, fantastic! Really great job dude, i love it

3
❤️ 3
pez 2021-04-10T13:24:47.414600Z

Thanks! Please consider filing a review. Link in the channel topic.

Janne Sauvala 2021-04-10T14:30:38.417100Z

Hello 👋:skin-tone-2: what is the correct way to configure clj-kondo/clojure-lsp linter with Calva? The clj-kondo and clojure-lsp docs differ a little bit. I want to ignore unused-public-var warning and I tried to place my config {:linters {:unused-public-var {:exclude #{prode.extension/reload}}}} under ./lsp/config.edn ./clj-kondo/config.edn but that didn’t seem to help

ericdallo 2021-04-10T14:31:20.417500Z

You should follow this section: https://clojure-lsp.github.io/clojure-lsp/settings/#diagnostics-linter

borkdude 2021-04-10T14:31:23.417900Z

@janne.sauvala That linter is not a clj-kondo thing, it's implemented by LSP

borkdude 2021-04-10T14:31:38.418Z

Damn, you are fast :)

😅 1
ericdallo 2021-04-10T14:33:02.418300Z

@janne.sauvala the unused-public-var is the only linter implmenented on clojure-lsp side, the rest is from clj-kondo, so you just need to change your .lsp/config.edn if you want to change its behaviour

Janne Sauvala 2021-04-10T14:33:12.418500Z

Thanks! Are you both just chilling here waiting for newbies to ask questions? 😄

ericdallo 2021-04-10T14:33:55.418700Z

hahaha I have configured my slack to warn about any metion to clojure-lsp or lsp 😄

ericdallo 2021-04-10T14:34:15.418900Z

probably borkdude did the same for clj-kondo haha

borkdude 2021-04-10T14:34:24.419100Z

you got me

🎯 1
Janne Sauvala 2021-04-10T14:35:46.419600Z

Great, this feels like some paid support service 🙂

✨ 1
borkdude 2021-04-10T14:36:19.419900Z

It makes you wonder, if clj-kondo is free and our support is free, you must be paying with something else...

😂 2
pez 2021-04-10T14:36:22.420100Z

And you pay with love. 😃

borkdude 2021-04-10T14:36:45.420400Z

Ah, that must be it then ;)

Janne Sauvala 2021-04-10T14:37:02.420600Z

okay I have my config in the .lsp/config.edn but I still see the linter warning… Does Calva automagically pick the config up or do I need to do something?

pez 2021-04-10T14:37:06.420800Z

John Lennon was right!

pez 2021-04-10T14:37:32.421Z

I think you need to reload the VS Code window.

☝️ 1
ericdallo 2021-04-10T14:38:08.421200Z

@janne.sauvala You need to restart clojure-lsp, closing/re-opening vscode will do that, not sure there is a command for that

pez 2021-04-10T14:38:47.421500Z

So, you don’t need to restart vscode, just FYI.

👍 1
Janne Sauvala 2021-04-10T14:38:55.421800Z

right! I reloaded the window and now the warning went away like it should 🙂

🚀 1
Janne Sauvala 2021-04-10T14:39:33.422100Z

thanks all 3 of you!

ericdallo 2021-04-10T14:39:43.422300Z

I have an idea to remove that need to restart clojure-lsp in the future :)

pez 2021-04-10T14:39:44.422500Z

You can pay with an issue on Calva to support reloading of clojure-lsp w/o reloading the vscode window. 😃

1
pez 2021-04-10T14:40:35.422700Z

Reloading clojure-lsp is quick though. It is losing your REPL session that is the too high price, imo.

👍 1
Janne Sauvala 2021-04-10T14:44:20.423300Z

Here you go: https://github.com/BetterThanTomorrow/calva/issues/1113 🙂

❤️ 2
2021-04-10T19:08:56.424200Z

Thank you!

pez 2021-04-10T20:13:48.424800Z

Oh, thanks for this issue. And super that you found that old issue. I pasted the node repl config there and closed it. (Since the reporter hasn’t been heard from in a while, we can’t really hope for a confirmation.)

pez 2021-04-10T21:01:01.427600Z

Dear Calva friends. I hope the new Calva version (2.0.186) is treating you well. Now it is time to help me test a new VSIX again. It adds built in jack-in/connect sequences for plain CLJS REPLs (Browser and Node). It makes it much easier to follow the steps in the https://clojurescript.org/guides/quick-start using Calva. • VSIX: https://12811-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.187-1114-add-vanilla-cljs-repl-sequences-3d416bdd.vsix • Issue addressed: https://github.com/BetterThanTomorrow/calva/issues/1114 • PR: https://github.com/BetterThanTomorrow/calva/pull/1115

🚀 4
2021-04-11T10:44:30.429700Z

Successfully tested the latest one (not the linked above), which changes "plain" with "built-in"...

2021-04-11T10:49:22.430100Z

(i don't like that macOS hides filename extensions... i couldn't install the .vsix at first because although i thought i changed the .zip extension to .vsix, VS Code wouldn't allow me to install it... until I realized that macOS was hiding the real extension and now I had a .vsix.zip . oh well )

pez 2021-04-11T10:49:22.430200Z

Awesome. Thanks!

2021-04-11T10:49:36.430500Z

np, thanks to you!

pez 2021-04-10T21:04:20.428100Z

Ping, @xavi, can you help test this for me?