Fork me on GitHub
#calva
<
2020-03-10
>
MatD01:03:21

@pez here is my project (https://github.com/matdurand/shadow-cljs-firebase) When I jack in using Calva, I start both functions and functions-tests , I can see the functions-tests terminal re-running the tests when I change something like you said. Then I connect to the functions repl using calva, and load the mypackage.core namespace into the repl, but then any attempt to run a function (like mypackage.core/hey) result in the "No application has connected to the REPL server message." After googling a little, I think this messages comes from shadow-cljs.

pez05:03:46

Yes, it's a shadow message. There needs to be a REPL server running for Calva to connect to. Because reasons Calva can't detect off this really is the case with shadow projects, so it pretends. You need to run your app in node, because that's where the REPL server lives.

pez12:03:20

@mathieu.durand looked at the project quickly now. I think you will need some app that uses your :node-library and then start that app. While that app is running you should be able to connect to its REPL. The best place to ask about this is in #shadow-cljs , I think.

pez12:03:56

Sorry for being mute on your questions, @conan! I totally missed that you had replied...

pez12:03:08

It is both cljs and ts, anyway. And I have concluded that the PR was quite close from getting something usable in place. In my branch there I have it working, and it is pretty sweet. Please try this VSIX package: https://4522-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.81-wip-cljfmt-config-09a6affa.vsix

pez12:03:16

The only stopping issue I know about is that now you can't put any new lines into the REPL window. No idea if that will be hard or easy to fix. If you are like me and do not use that window much, then it is not much of a bother, of course.

thumbsup_all 1
conan21:03:02

I will try it! The funny thing is, I’m mostly a cursive user, so I don’t use a REPL at all I’m VSC - this is for my team

pez05:03:10

Have someone in your team test then. 😀 I fixed that bug in the latest VSIX i posted. It should actually just work now.

pez08:03:11

I've found a bug now. The align elements command doesn't work right now. I doubt it is a big deal for anyone, but anyway. Will fix.

pez16:03:37

So, if some of you Calva friends could take this VSIX for a spin. https://4527-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.81-wip-cljfmt-config-bd150f7d.vsix It has the fun new feature that I think @conan asked for: Configurable formatting. Docs here: https://github.com/BetterThanTomorrow/calva/blob/wip/cljfmt-config/docs/readthedocs/source/formatting.md I'd say it's pretty cool! And mostly the work @nbardiuk , btw. ❤️

conan11:03:32

this looks like it can do exactly what i'm after! is there any chance you could help me get it working? i've created a .cljfmt.edn file and added calva.fmt.configPath to my settings.json in vs code, but it's not picking the file up. is there something else i need to do?

pez11:03:10

Did you figure out how to use the VSIX file?

pez11:03:50

If you have time for a Zoom, I can help you that way.

conan11:03:06

the docs mention a lein-cljfmt plugin, which implies that i need to set up a leiningen project?

pez11:03:19

Or, maybe I can't help you, but at least we can figure out what's wrong together. 😃

conan11:03:31

ok one sec, that would be great

pez11:03:37

No need for leiningen here.

pez11:03:21

Invite me!

pez11:03:03

Good that you mentioned that leiningen thing. I should add that to the docs.

conan12:03:34

ah, i made a mistake, i don't think the absolute path is working for .cljfmt.edn

pez12:03:13

You made a mistake in your testing?

pez12:03:47

Test it like so: Open two VS Code windows. (Open one, then do File -&gt; New Window). In one window open that project folder. In the other open the folder containing the out-of-project config file. Set Config Path in User Settings to the absolute path of that out-of-project config file. Edit the config file in the VS Code window where you have its root directory. Check if the settings are active in both VS Code windows.

pez12:03:59

I hope I got that right and that it makes sense. 😃

pez12:03:08

So, I think I know what is going on. When the file is outside of the project, VS Code does not pick up changes to it. But it reads it when the project folder is opened. For config files inside the project the hot reload seems to work.

conan12:03:58

yes, this is the behaviour i've seen

conan12:03:14

which is fine, it changes rarely

pez12:03:02

I solved it by updating the docs. 😃

pez12:03:48

It's released BTW. Ask your colleagues to update Calva, please. And holler my way if anyone runs into problems. (Shouldn't happen, of course, but hey...)

conan13:03:49

amazing, thank you!

pez13:03:44

You're welcome!

conan17:03:26

We've been playing with this functionality and it allows us to achieve what we need (yay!). However it seems that cljfmt doesn't work with namespaced keywords: https://github.com/weavejester/cljfmt/issues/106 Unfortunately in a world of clojure.spec that's all of them. Is it likely that Calva will support an alternative formatter to cljfmt in the near future?

pez20:03:15

It is a bit deeper than cjfmt. Most formatters has this problem, b/c they are all using rewrite-clj. There are initiatives started to fix this, but right now...

pez20:03:45

In theory the experimental Calva indent engine should not have this problem. But it is not a full formatter, it only will indent things as you type. Look for it in the settings if you think it could help in any way.

pez19:03:20

To peek your interest in testing out that format config VSIX, I cooked this GIF. Isn't it pretty cool being able to use the config file as the test file for the config? 😃

❤️ 3
👍 1