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`.
bringe 2021-04-26T02:00:05.230Z

I've seen this before too but haven't been able to repro consistently. If you can repro consistently it may be much easier for you to fix if you did find the time. No worries if not though. :simple_smile:

pez 2021-04-26T04:55:54.230200Z

For the record, my assessment was about adding the filtering. šŸ˜ƒ

šŸ‘ 1
mjosefs 2021-04-26T10:02:28.230800Z

Hi! It seems like my :lint-as specifications in .clj-kondo/config.edn arenā€™t picked up in .cljs files, though it works fine in .clj and .cljc files. Unsure whether itā€™s a Calva or clj-kondo issue, but should I specify or set this up separately somehow?

borkdude 2021-04-26T10:06:25.231Z

@marcus.josefsson please be more specific

mjosefs 2021-04-26T10:21:38.233100Z

Sure! By ā€œ`:lint-as` specifications in .clj-kondo/config.ednā€ I mean a bunch of stuff along the lines of:

{:lint-as {my-ns/deftestĀ clojure.core/def
Ā Ā Ā Ā Ā      Ā my-ns/def Ā Ā   schema.core/def
Ā Ā Ā Ā Ā Ā      my-ns/defnĀ    schema.core/defn
Ā Ā Ā Ā Ā      Ā ...}
Now, in .cljs files, writing e.g. (my-ns/defn my-fn ā€¦) gives a linting error Unresolved symbol: my-fn clj-kondo(unresolved-symbol). When just starting out with Calva this used to happen in .clj and .cljc files as well, but the :lint-as specifications fixed that (as per the ā€œunrecognized macrosā€ instructions in the user guide) - so my guess is theyā€™re somehow not picked up in the case of .cljs files.

borkdude 2021-04-26T10:25:17.233700Z

@marcus.josefsson I don't see why that wouldn't work specifically for .cljs unless the namespace is called differently in your ns form in the .cljs file

borkdude 2021-04-26T10:27:25.234500Z

@marcus.josefsson Can you test this with clj-kondo on the command line?

borkdude 2021-04-26T10:27:40.234900Z

And if the problem persists there, please make a repository I can clone locally to reproduce the problem

mjosefs 2021-04-26T10:30:40.237300Z

Thanks - yep, the namespaces are called in the same way, so Iā€™ll try that.

mjosefs 2021-04-26T10:42:10.238900Z

@borkdude no errors or warnings when checking with the command line tool, so would appear itā€™s not picking up the config when in VS Code, for .cljs

borkdude 2021-04-26T10:46:32.240200Z

@marcus.josefsson have you tried restarting vscode? perhaps lsp isn't refreshing your config correctly?

mjosefs 2021-04-26T10:58:29.241300Z

Iā€™ve tried restarting it a couple of times, but no errors visible on startup at least. Anything specific I could try to check the config?

borkdude 2021-04-26T10:58:59.241800Z

At this point I must defer the problem to @pez and @ericdallo / @snoe

mjosefs 2021-04-26T11:02:01.242200Z

Ok - thank you!

pez 2021-04-26T11:12:39.242800Z

A minimal reproduction project would be great, @marcus.josefsson.

ericdallo 2021-04-26T12:25:26.243800Z

Yes ā˜ļø also you could try rm -rf .lsp (even if this should work without doing that) and restart server

pez 2021-04-26T12:29:49.244500Z

Restart server is probably Command Palette -> Developer: Reload Window.

Tomas Brejla 2021-04-26T13:18:12.252700Z

Hello. I see that ericdallo suggested removing .lsp and restarting to server for some other issue ^^^. By a coincidence, I managed to get my Calva to some weird state today and I ended up deleting that folder too. And it actually seemed to help. But it may have been a coincidence. Here's how my Calva behaved: 1. in my core.clj file, I wasn't able to perform deletion via either Del or Backspace keys. No metter where I placed my cursor, Del/Backspace did nothing. I think I was able to "delete" expressions by selecting them and then pressing some key (space or any character key). I tried restarting REPL, restarting Calva (vs code), didn't help. 2. as a last resort, I tried deleting .lspfolder then performing calva restart. Once I connected my REPL again, everything worked fine. I believe similar thing (not being able to del/backspace) already happened to me once in the past, but it somehow fixed itself. This time I had to delete the .lsp folder - not sure if this really helped, but it's posible it did. Any idea what to check if it ever happens again?

Tomas Brejla 2021-04-27T07:15:29.257100Z

I actually hope to see that issue again as well, so that I could investigate it in more detail. Unfortunately I didn't have time for that yesterday, so I was trying all the things to quickly get over the issue. Maybe a question from the other way around.. Under which conditions del/`backspace` gets "ignored" in normal conditions? It's somehow related to paredit and the fact that if expressions would end up in unbalanced, the deletion doesn't get performed, right? If so, what moving part would have to break so that it could lead to the behavior I have seen? Probably nothing related to lsp and clj-kondo (?). Perhaps some expression parsing ? due to incorrect identation / unbalanced expressions etc? It's entirely possible I might have had some issues in my code. This specific one is quite a long scratch-pad really and my "identation" sometimes gets broken after copy-pasting. I also might have had some unsaved changes etc.

pez 2021-04-27T08:24:21.257300Z

Iā€™m not sure about this, but I think the general protection against deleting balancing things never behave in a ā€œnothing at all happensā€ way. The cursor is moved past the bracket instead. In case of complete unbalance of all the things this could maybe happen, even if I doubt it. Under the hood Calva keeps a ā€œmirrorā€ document for each editor document. It is this mirror that is used for determining, and updating, the structure (this two-way nature of it makes the term ā€œmirrorā€ is a broken metaphor). Some operations can throw the mirror out of whack. Like if you change the line ending of the file from windows to unix style or vice versa). Then, maybe, what you experienced could happen. But you should also see Calva Highlight paint a lot of closing brackets red in that case. And, for sure, restarting VS Code should fix it. What is more likely to me is that the Calva command bound to backspace, never gets registered. The binding is static and declarative. The registration is dynamic and imperative. Maybe the best thing to do is to run that project in Calva dev mode. Then if this happens again, use the debugger to try find where it fails.

Tomas Brejla 2021-05-04T14:39:59.001200Z

@pez Ha, guess what, it happened again. Unfortunately I'm not in calva dev mode šŸ˜ž

Tomas Brejla 2021-05-04T14:40:31.001400Z

anything to try before I restart code/calva?

pez 2021-05-04T14:41:48.001600Z

See if you can see anything in the Development console.

pez 2021-05-04T14:42:00.001800Z

And see if you can delete stuff using alt+enter.

Tomas Brejla 2021-05-04T14:42:40.002Z

alt-del or alt-backspace you mean, right?

Tomas Brejla 2021-05-04T14:42:49.002200Z

can't

pez 2021-05-04T14:43:01.002400Z

Yeah, sorry. In a bit of a hurry here and getting sloppy. šŸ˜ƒ

pez 2021-05-04T14:43:24.002600Z

But you can enter text?

Tomas Brejla 2021-05-04T14:43:25.002800Z

hmm actually it seems that I can't do anything, not just deletion.

Tomas Brejla 2021-05-04T14:43:31.003Z

I can enter text, yes

pez 2021-05-04T14:44:01.003200Z

Can you select text and then delete it?

Tomas Brejla 2021-05-04T14:44:57.003400Z

no, not using del/backspace.. I can only select the text and then overwrite it by pressing some regular key, such as A,B,C...

Tomas Brejla 2021-05-04T14:45:04.003600Z

but no matter what text editor I open, whenever it's .clj, I'm not able to do any calva-specific actions. I can't indent, i can't execute code.. nothing

Tomas Brejla 2021-05-04T14:45:37.003800Z

even if I create a completely new clj file, open it, write a basic hello-world form, I'm not able to perform any usual calva action

Tomas Brejla 2021-05-04T14:46:14.004Z

even expanding selection via alt+shift+right_arrow...

pez 2021-05-04T14:46:25.004200Z

Anything in the dev console?

Tomas Brejla 2021-05-04T14:46:44.004400Z

perhaps something stucks some global action-handling code in calva.

Tomas Brejla 2021-05-04T14:46:50.004600Z

re console: i'll check

pez 2021-05-04T14:47:15.004800Z

Yes. something is either stuck or not initialized as it should.

Tomas Brejla 2021-05-04T14:47:20.005Z

which console?

pez 2021-05-04T14:47:39.005200Z

Help Menu -> Toggle Developer Tools.

Tomas Brejla 2021-05-04T14:48:09.005400Z

oh, this is beautiful, didn't know about this one šŸ™‚

pez 2021-05-04T14:48:20.005600Z

I think the best path is to always run Calva in dev mode and then hope that you can catch it with the debugger.

Tomas Brejla 2021-05-04T14:48:39.005800Z

WARN UNRESPONSIVE extension host, 'betterthantomorrow.calva' took 93% of 5149.568ms, saved PROFILE here: 'file:///tmp/exthost-59fb4f.cpuprofile' Array(2)

pez 2021-05-04T14:49:35.006Z

Grab that profile and attach it to an issue on github. File issue using that Help menu and we will get some system context attached.

pez 2021-05-04T14:50:22.006200Z

I need to run now, have a Clojure presentation to deliver. Sorry for abandoning you!

šŸ‘ 1
Tomas Brejla 2021-05-04T14:50:52.006400Z

awesome, fingers crossed ! And don't be nervous, there's no reason for that, Calva is great stuff !

pez 2021-05-04T14:51:07.006700Z

Try figure if it might be a particular file that sends Calva into this spin.

ā˜ļø 1
pez 2021-05-04T14:51:48.006900Z

Last time I did this my live coding ended in a bug I couldnā€™t fix. Weā€™ll see how I fare this time. šŸ˜ƒ

šŸ‘ 2
šŸ¤ž 1
Tomas Brejla 2021-05-05T08:33:55.008100Z

@pez FYI I created the issue here https://github.com/BetterThanTomorrow/calva/issues/1167 & included the console log + cpuprofile file

Tomas Brejla 2021-05-05T08:34:35.008400Z

btw hope your live coding session went well šŸ˜‰

pez 2021-05-05T09:36:02.008600Z

Thanks! Yes it went well this time. Not saying I am safe from fuckups now, but I did learn something from the last one at least. šŸ˜ƒ

šŸ‘ 2
šŸ’Ŗ 1
ericdallo 2021-04-26T13:47:56.252800Z

thanks for the explanation, but I don't think LSP could block your input in anyway :thinking_face: Maybe this is related with other calva feature?

Tomas Brejla 2021-04-26T13:52:01.253Z

I'm not sure if LSP server was able to fully start up or not. Perhaps it somehow got stuck while initializing and Calva was waiting for it or something like that. But it's just a wild speculation, I'm definitely not pointing any fingers šŸ™‚. It felt really weird, especially the fact that restarting didn't help. Hopefully next time it happens I'll be able to get more details.

ericdallo 2021-04-26T13:52:44.253200Z

Np, it's something Calva should check indeed, as block user input is not good in any way šŸ™‚

mjosefs 2021-04-26T14:03:22.254600Z

Thanks for the suggestions pez and ericdallo - while trying to make a minimal reproduction I found that it wasnā€™t after all related to the file types: my workspace is composed of several projects and unlike the others this one didnā€™t have its own .clj-kondo/config.edn file. I thought it was reading from a parent folderā€™s .clj-kondo/config.edn (which also exists) but apparently not so. (Coincidentally, the others were .clj/`.cljc`-based and this one was .cljs-based). So I have a few duplications of that file now, but it seems to work.

šŸŽ‰ 1
pez 2021-04-26T15:38:23.254800Z

I feel a bit guilty for hoping it will happen to you again @brdloush. šŸ˜ƒ Joking, but really, sounds awful and if you have it, I get worried that others are experiencing as well. Iā€™m trying to think what could be going on. The fact that it was del/backspace that died gives us some clue, as those are bound to commands in Calva. If you experience it again, see if alt+backspace works.

bringe 2021-04-26T20:00:47.256500Z

Yeah, nothing should be blocked like that during clojure-lsp startup, as we've made that async. And nothing should be blocked if it fails to start either. But we'll have to see what's going on if you can find a repro in the future.