Fork me on GitHub
#calva
<
2019-06-05
>
slipset05:06:44

Re the CLJS/TS thingy. If I had time to contribute, I would probably be more likely to contribute to something CLJS rather than something TS. I’m fighting TS enough as it is at work.

slipset05:06:20

Having said that, I see value in trying to make some architectural decision around this. It might make sense to implement whatever is Clojure specific in CLJS, and use TS for the stuff that’s VSCode specific.

slipset05:06:44

To elaborate. A lot of what is Orchard today was first implemented in Emacslisp, but has later been rewritten in Clojure.

slipset05:06:23

So that could also be used as a guide. Stuff that could be useful for the broader Clojure community should probably be implemented in Clojure.

pez05:06:40

I was more determined to push all ”business logic” into cljs and only keep vscode integration stuff in TS before, but lately I've been seeing other lines along which things can be divided. There is definitely a use for cljs to bring in Clojure libraries.

pez06:06:12

> So that could also be used as a guide. Stuff that could be useful for the broader Clojure community should probably be implemented in Clojure. This can also point us in the direction of TS, depending on what it is we're building. Like with the repl-indicator: https://github.com/BetterThanTomorrow/repl-interactor#why-typescript

pez06:06:29

I am considering making today the release day of Calva 2. Here's the build that would be released if so: https://github.com/BetterThanTomorrow/calva/blob/dev/alpha-build/clojure4vscode-2.0.0-SNAPSHOT.vsix I find it much easier to use and more productive than the current marketplace version, which sort of speaks for release, right? There will be new bugs and stuff, of course, but it seems the fastest way to get to know about those is to publish the new version.

Sasho07:06:52

Please, go for it 🙂

metal 1
Sasho07:06:34

Has someone ran into the following issue: sometimes VS Code blocks the standard input of new terminal windows:

Sasho07:06:20

The only way to “unblock” it is to restart VS code:

Sasho07:06:26

Could that be related to Calva? Even if I exit the repl, the problem persists and I need to fully restart VS Code, so this hints, that it’s more of a VS Code issue, than Calva, but I just wonder if anyone else has had this problem before.

pez07:06:36

@sasho.popov, yes, there are issues reported on the Calva repo about this. I have never experienced it though, despite crystal clear reproduction steps. It is one of the reasons why Calva 2 does not use the integrated terminals for the repls. (Not that I know if Calva 2 will improve on this issue, but staying away from terminals seem like a good idea, anyway.)

pez07:06:40

Do you know if Calva 2 improves it?

Sasho07:06:10

But that’s the strange thing - I’m also not using the integrated terminal. I start a repl in iTerm2, then go to VS Code and click the connect button, which opens a dialog with localhost:12345 with the correct port already pre-filled. That’s how I connect to the repl.

Sasho07:06:53

I don’t know about Calva 2, but I’m keen on testing this out. The thing is, I don’t know how to reproduce the problem.

Sasho07:06:05

So have you decided if you’re going to release Calva 2 today?

pez07:06:42

Calva 1 also opens terminals for you, check the dropdown in the terminal tab. 😃

pez07:06:42

I don't understand why that would hang bash globally, but maybe it could...

Sasho07:06:00

Hm, I see now, yes.

Sasho07:06:07

So is there a way to disable this?

pez07:06:30

I'll release today if I find a time slot big enough. Unless some new information drops in that speaks against it.

Sasho07:06:15

O.K., so are there anywhere instructions how to use the unreleased version? I mean this: https://github.com/BetterThanTomorrow/calva/blob/dev/alpha-build/clojure4vscode-2.0.0-SNAPSHOT.vsix

pez07:06:07

There's a readme in that branch.

Sasho07:06:20

Cool. So I’ll try out Calva 2 🙂

aw_yeah 1
Sasho07:06:28

Do I first need to uninstall the currently installed version of Calva from the Marketplace?

pez07:06:53

No, install it from the extensions pane, ”Install from VSIX”.

pez07:06:18

You'll need to uninstall Calva Formatter and Calva Paredit, but it will tell you that. 😃

Sasho07:06:15

Coool, I’ve installed it 🙂

pez07:06:52

Wonderful. I look forward to feedback!

Sasho08:06:24

O.K., so now I cannot connect to a sunning repl :thinking_face:: > Hooking up nREPL sessions... > Connected session: clj > Failed connecting. (Calva needs a REPL started before it can connect.) Will try jack-in now…

Sasho08:06:29

Jack-in works.

pez08:06:45

So, why did connect fail...

pez08:06:12

What kind of project is it?

Sasho08:06:18

WOW, the new syntax highlighting is so cool - I especially like the different braces colors… 🙂

Sasho08:06:32

It’s a leiningen project.

pez08:06:13

How was that REPL started? Could Calva 1 connect to it?

Sasho08:06:47

Steps: 1. Go to iTerm to and run lein repl. Wait for the repl to start. 2. Go to VS Code and click on nREPL at the bottom. 3. Enter localhost:12345 Yes, Calva 1 could connect to the repl.

Sasho08:06:16

Let me restart VS code and iTerm and try again.

kstehn08:06:15

You need to make sure that you use the right dependencies when you start the repl

Sasho08:06:30

Started the repl in iTerm via lein repl:

Sasho08:06:44

Now let’s try to connect…

Sasho08:06:13

I’m not in these cases - I don’t use plain clojure, nor figwheel, nor shadow-cljs

Sasho08:06:42

O.K., perfect, it worked!

pez08:06:59

So, was that connect or jack-in? Guessing connect, since there would have been a picker for project type otherwise.

Sasho08:06:43

It was connect

pez08:06:37

Cool. Probably your project has the dependencies configured. You won't need that if you use jack-in.

Sasho08:06:19

Yeah, jack-in seems to be more convenient, since I wouldn’t need to start a separate repl manually in iTerm2, right?

pez08:06:23

What I do if I want to have the project running and connect to it is that I first do jack-in, and copy the command line. Then run that outside Calva and then connect.

pez08:06:57

Yeah, with jack-in you don't need anything in any terminal.

👍 1
Sasho08:06:42

Hm, strange thing is happening. I restart VS code and now the Calva icon at the bottom (nREPL) does not appear. When I try to start Jack in or connect from the command palette, I get command not found:

Sasho08:06:12

I restarted multiple times and also uninstalled/installed Calva 2… :thinking_face:

Sasho08:06:43

However, no problems are reported:

pez08:06:56

Not good. Do you have a clojure file opened?

Sasho08:06:31

Wait, I fell back to Calva 1. Let me again install Calva 2 and try again…

Sasho08:06:46

O.K., now it works. So I have to have a Clojure file opened in order for it to work?

pez08:06:13

I think so. I have been trying to fix it so that it is not necessary, but I don't think I am there yet.

pez08:06:01

I should try see if I can hide that command from the command palette as well...

Sasho08:06:02

Got it. So yes, this appears to be the problem - I have to have a file opened

pez08:06:04

I don't think we have an issue on that. Please file one if you got some time.

pez08:06:06

Also, if you feel in the helping mode. It could be something for a troubleshooting page on the wiki.

Sasho08:06:31

Yes, I’ll submit my experience to the Wiki by the end of the day.

❤️ 1
pez13:06:47

AAAAAAND. Calva 2 is out!

🎉 3
slipset13:06:57

w000000t!!!!

aw_yeah 1
pez13:06:12

I published it as a new extension. Making the upgrade sort of optional for now. I've added some checks for in the old and new extensions so that they warn the user about not having both installed. Tonight I'll rename the old extension to Calva Legacy.

👍 1
Sasho13:06:13

Hey, @pez, in Calva 2, is it possible to run a single test. I’m in a file with multiple tests, but I want to run only one of them.

pez13:06:34

Not at the moment, no. I think it might be posted as a feature request, if not, please do. 😃

pez13:06:05

Friends of Calva, a Request for your kind assistance. In releasing Calva 2 as a new extension I lost the 11 five-star, and kindly formulated, reviews the old one has. Please, pretty please, consider reviewing the new entry on the marketplace, to help people choose the right extension for their Clojure work: https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva&amp;ssr=false#review-details

🎉 3
bozhidar15:06:35

@pez Congratulations on the big release! Looks pretty sweet!

pez15:06:20

Thanks! I am so happy having this published now. Unreleased stuff is not fun!

pez16:06:53

Dear devs, with the recent releasing release we are also back on master. (And the legacy version is forked of to a new repository, hopefully enjoying its final rest.)

pez18:06:02

Oh, and the reason I forked out the legacy version is that vscode embeds the readme from the repo root. So for anyone using that version it would be confusion with the new readme.

bozhidar18:06:20

So, the new version was a complete rewrite?

slipset18:06:16

Not so much a rewrite as a write, I’d say

slipset18:06:33

Basically, a new repl window was written from scratch

slipset18:06:56

Also, the code to handle jack-in was written from scratch, AFAIK

bozhidar18:06:20

I just assumed something was radically different to warrant two apps in VS Code’s marketplace and two repos.

john18:06:42

Great work on the latest release, folks!

john18:06:59

I'm trying things out... I see the jack-in functionality supports figwheel and shadow out of the box. Can it setup a vanilla cljs repl too? Or does that require launching externally and connecting to the server?

pez19:06:40

What is a vanilla cljs repl? But, whatever it is, you probably will not be able to get Calva to start it for you.

john04:06:42

sorry, the repl described here https://clojurescript.org/guides/quick-start I think that's sometimes called the "vanilla" or bare bones repl.

john04:06:59

I like to test against it for some libs

john04:06:06

oh, I wonder if that's non-trivial, given the nrepl stuff... You'd probably end up rebuilding some of the figwheel/shadow functionality, to make the default repl "jack-in"

pez07:06:21

Got it. Can you post as a feature request on the repo?

yogthos18:06:48

hmm the keybindings stopped working for me after the update

Sasho06:06:13

Hey @yogthos, for Calva 2 to work, it has to have at least one Clojure file open. Do this: - open a project, but don’t open any files - Calva 2 will not work (if you try to connect via the Command Palette, you’ll get this error) - Now open a clj file - Calva 2 should be working now

yogthos12:06:21

ah thanks for the heads up

john18:06:02

I had to restart it

yogthos18:06:03

is there something silly I missed?

yogthos18:06:10

I did try restarting mine as well

john18:06:24

After installing the latest VS code 🙂

yogthos18:06:36

let me see 🙂

john18:06:52

I basically started with a fresh vs code instance

john18:06:07

installed calva, then had to restart vs code

yogthos18:06:29

ok looks like a second restart did it 🙂

john18:06:12

Holy cow, those collapsable error selectors in the repl are sick!

john18:06:41

Separates errors by Clojure, Java, Tooling and Duplicates

yogthos18:06:52

yeah, new release is looking very polished

john18:06:02

Honestly, the only thing keeping me on atom is the parinfer implementation on the atom plugin I use is so fluid for me now that it's hard to give it up

john18:06:02

I can cut and paste large sections of code without worrying about lining parens. Just highlight entire rows of text, cut, paste, parinfer fixes everything

john18:06:50

So hopefully these plugins will allow some par* customization/plugability in the future, as a lot of devs seem to have different habits there.

yogthos18:06:33

I actually prefer paredit myself

yogthos18:06:59

it takes a bit of getting used to, but it's really nice once you get going

john18:06:13

Do you barf/slurp?

john18:06:38

Is that what most folks do when managing brackets in calva?

yogthos18:06:15

I find I mostly get around using expand/shrink selection

Travis19:06:53

@pez Just loaded up the latest calva. I like what I see so far!

aw_yeah 1
pez19:06:03

@bozhidar: two versions is temporary. I mainly used this opportunity to fix some original bad naming choices. But, yeah, I am a bit defensive with the new version as well, as it could have some yet uncovered bugs that stop people from getting their work done. Let’s hope not, and I can remove the legacy version soon.

pez19:06:32

@john: I use barf/slurp all the time. Default key bindings for them are ctrl+left and ctrl-right to make them easy to reach and to remember. I also use expand/shrink, like @yogthos suggests. I wish vscode made a proper parinfer possible, but, so far, no-one who set out on that journey ever returned. Calva has a command Infer parens, ctrl+alt+p that often saves my day.

john22:06:16

ctrl-left and right are super easy actually. I might be able to get used to that

john22:06:34

Does that work pretty well across platform?

pez22:06:51

I think so. What could happen is that something else in the OS has booked it, but I don’t think that is the case on the OS level. Rather it is some other app, and hopefully it is configurable so that people can keep using the easy shortcuts for barf/slurp.

practicalli_john19:06:35

@pez just trying the latest vsix from the project repository (sorry, later than I said I would). Wow. it looks great. I've tried it with the classic ClojureBridge project and it just works. This is so awesome. I am also trying out all the exercises and some of the features to see if I find any bugs. I am using a clean install of VS Code (on a new laptop) so will let you know if I find any issues.

pez19:06:29

Wonderful to hear @jr0cket! Please try it with the freshly released version from the Marketplace. (it’s pretty much identical with the one from the repo, but anyway.

practicalli_john20:06:01

Okay, will do. Thanks for all the amazing work

❤️ 1
vlaaad21:06:25

trying calva and vscode, and nothing works — trying to run any calva command results in popup "command 'calva.%commandname%' not found"

Sasho06:06:55

When you open a given project, make sure at least 1 Clojure file is open. Does the problem remain?

vlaaad06:06:52

Yeah, having open clj file helps

vlaaad21:06:56

deps.edn-based project

vlaaad21:06:26

maybe there is an exception somewhere? I'm new to vscode, don't know how to find what's wrong

pez21:06:17

@vlaaad that sounds horrible. Is it a completely fresh Calva install?

pez21:06:48

There’s Toggle Develper Tools in the Help menu.

vlaaad21:06:04

I updated vscode to latest version, uninstalled old calva and installed new one. Did many restarts. not helping..

vlaaad21:06:35

Activating extension 'betterthantomorrow.calva' failed: Cannot read property 'languageId' of null.

pez21:06:26

Hmmm, do you have any more info there, like which file or something?

vlaaad21:06:48

found the stack trace:

Here is the error stack:  TypeError: Cannot read property 'languageId' of null
	at addDocument (/home/vlaaad/.vscode/extensions/betterthantomorrow.calva-2.0.2/out/calva-fmt/ts/docmirror/index.js:44:13)
	at Object.activate (/home/vlaaad/.vscode/extensions/betterthantomorrow.calva-2.0.2/out/calva-fmt/ts/docmirror/index.js:62:5)
	at Object.activate (/home/vlaaad/.vscode/extensions/betterthantomorrow.calva-2.0.2/out/calva-fmt/ts/extension.js:23:15)
	at activate (/home/vlaaad/.vscode/extensions/betterthantomorrow.calva-2.0.2/out/extension.js:61:13)
	at Function._callActivateOptional (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:738:936)
	at Function._callActivate (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:738:625)
	at define._doActivateExtension.Promise.all.then.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:737:635)

pez21:06:02

Thanks! I’ll have a look right away. Does it work if you first open a clojure file?

vlaaad21:06:07

indeed it does!

pez21:06:58

It’s haunting me still this bug. Can’t believe it almost. But I’ll bring my garlic and crucifixes this time.

bringe21:06:54

Hello. Have a small question about the new clj repl. Are results supposed to be pretty printed automatically? Mine appear to not be.

bringe21:06:23

Using an example from the pprint page on clojuredocs

bringe21:06:28

Note that my jack-in on windows is not currently working (made a note on a related issue in github). So actually, maybe I need to add the dependencies.

pez21:06:15

@brandon.ringe pretty printing is broken, unfortunately. We need to fix it! https://github.com/BetterThanTomorrow/calva/issues/179

bringe21:06:30

Oh, gotcha!

pez21:06:37

As for your jack-in, if you copy the command that Calva uses in the Calva Jack-in task and replace the unquoted double quotes with single quotes and execute it. Does it then work to connect to that repl?

bringe21:06:10

I will try and let you know

pez21:06:53

I have a very old mac with only 8G ram and it chokes when I start Win 10 in Virtual Box. It makes this really hard to fix for me. If you have the dev environment set up maybe we can work at it together?

👍 1
pez21:06:50

(And powershell feels as ancient as it did when I tried it back then many years ago. But that’s another issue. 😃 )

pez22:06:09

Will keep reposting this now and then, sorry for nagging. ❤️

✔️ 1
bringe22:06:14

This may be a silly question but how do I get the exact command that the task is running?

bringe22:06:31

for jack-in

pez22:06:35

It’s in the terminals pane. There’s a dropdown menu there. (You need to issue the jack-in command for it to appear, though.)

pez22:06:28

If that works, we at least have a workaround to add to the issue and to the wiki until the issue is fixed.

bringe22:06:01

OH, :man-facepalming: Was thinking it was being cut off, but it's the whole command I see

bringe22:06:26

works 🎊

bringe22:06:51

I mean, it does still ask me to input the nrepl port, but I think the task would handle that if it worked through the task right?

bringe22:06:01

repl starts fine though

pez22:06:57

Strange that it doesn’t pick up the port. is the .nrepl-port file created?

pez22:06:37

Can you updated the issue with the workaround, @brandon.ringe? I need to catch some sleep now.

pez22:06:08

Also, thanks for the kind review. ❤️!

bringe22:06:49

Yes, the .nrepl-port file was created with the correct port. You're welcome!

bringe22:06:26

Btw, I just updated my Leiningen because I was getting a warning about needing a higher version for cider-nrepl. After updating the repl window opened automatically when I ran the (corrected) task command

bringe22:06:04

It said it requires at least lein v2.8.3 I believe. I'm now at 2.9.1

bringe22:06:35

So that may need to be added to docs somewhere

bringe23:06:06

I am now back to the repl window not opening automatically.

bringe23:06:09

¯\(ツ)