This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-26
Channels
- # announcements (10)
- # asami (15)
- # babashka (200)
- # beginners (48)
- # calva (56)
- # cider (6)
- # clara (2)
- # cljs-dev (18)
- # cljsrn (6)
- # clojars (3)
- # clojure (23)
- # clojure-czech (2)
- # clojure-europe (41)
- # clojure-germany (5)
- # clojure-italy (19)
- # clojure-nl (5)
- # clojure-uk (8)
- # clojurescript (60)
- # clojureverse-ops (5)
- # cursive (14)
- # datomic (6)
- # events (1)
- # figwheel-main (5)
- # graalvm (17)
- # honeysql (2)
- # instaparse (1)
- # integrant (9)
- # jobs (5)
- # music (2)
- # off-topic (37)
- # other-languages (1)
- # pathom (10)
- # proletarian (5)
- # quil (3)
- # reagent (39)
- # reitit (4)
- # remote-jobs (3)
- # reveal (6)
- # rum (9)
- # shadow-cljs (27)
- # vrac (3)
- # xtdb (5)
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?
@marcus.josefsson please be more specific
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.@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
@marcus.josefsson Can you test this with clj-kondo
on the command line?
And if the problem persists there, please make a repository I can clone locally to reproduce the problem
@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
@marcus.josefsson have you tried restarting vscode? perhaps lsp isn't refreshing your config correctly?
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?
At this point I must defer the problem to @pez and @ericdallo / @snoe
A minimal reproduction project would be great, @marcus.josefsson.
Yes ☝️ also you could try rm -rf .lsp
(even if this should work without doing that) and restart server
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 .lsp
folder 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?
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?
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.
Np, it's something Calva should check indeed, as block user input is not good in any way 🙂
I feel a bit guilty for hoping it will happen to you again @U01LFP3LA6P. 😃 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.
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.
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.
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.
@pez Ha, guess what, it happened again. Unfortunately I'm not in calva dev mode 😞
anything to try before I restart code/calva?
alt-del or alt-backspace you mean, right?
can't
hmm actually it seems that I can't do anything, not just deletion.
I can enter text, yes
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...
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
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
even expanding selection via alt+shift+right_arrow...
perhaps something stucks some global action-handling code in calva.
re console: i'll check
which console?
oh, this is beautiful, didn't know about this one 🙂
I think the best path is to always run Calva in dev mode and then hope that you can catch it with the debugger.
WARN UNRESPONSIVE extension host, 'betterthantomorrow.calva' took 93% of 5149.568ms, saved PROFILE here: 'file:///tmp/exthost-59fb4f.cpuprofile' Array(2)
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.
awesome, fingers crossed ! And don't be nervous, there's no reason for that, Calva is great stuff !
Last time I did this my live coding ended in a bug I couldn’t fix. We’ll see how I fare this time. 😃
@pez FYI I created the issue here https://github.com/BetterThanTomorrow/calva/issues/1167 & included the console log + cpuprofile file
btw hope your live coding session went well 😉
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. 😃
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.