This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-06
Channels
- # announcements (14)
- # babashka (14)
- # beginners (22)
- # calva (56)
- # cider (20)
- # clerk (8)
- # clj-commons (10)
- # clj-kondo (18)
- # cljs-dev (11)
- # clojure (87)
- # clojure-conj (3)
- # clojure-europe (29)
- # clojure-nl (1)
- # clojure-poland (5)
- # clojure-portugal (1)
- # clojurescript (100)
- # data-science (3)
- # datahike (1)
- # datomic (13)
- # events (2)
- # fulcro (10)
- # funcool (2)
- # helix (19)
- # hoplon (6)
- # humbleui (2)
- # hyperfiddle (40)
- # leiningen (5)
- # lsp (22)
- # malli (26)
- # nrepl (2)
- # off-topic (19)
- # reagent (32)
- # releases (1)
- # shadow-cljs (266)
- # spacemacs (6)
- # tools-build (9)
- # vim (1)
Not sure whether this is a recent Calva change or a recent LSP change but at some point, a few releases back, go to definition stopped working on qualified symbols that use the #'
reader macro:
#'ctl-search/online-now ; go to definition does not work
ctl-search/online-now ; go to definition DOES work
(and, weirdly, if you remove #'
, do go to definition, then put #'
back, go to definition continues to work for that symbol)Ah, a little more nuance: if you go to definition on any symbol like some-ns/some-var
then future go to definitions work for all vars in some-ns
even when they have #'
in front of them.
i.e.,
some-ns/var-one ; go to definition works
#'some-ns/var-two ; go to definition will now work here too!
I can’t reproduce this. Can you enable REPL message logging and share here? Maybe we can see what’s going wrong there.
How do I "enable REPL message logging"?
Of course there is...
-> sent
{
op: 'info',
ns: 'user',
symbol: "'ctl-web-site/get-profile-delete-reasons",
id: '1525',
session: '7b694f70-6cd6-4661-8673-dc81e26ab1b3'
}
<- received
{
id: '1525',
session: '7b694f70-6cd6-4661-8673-dc81e26ab1b3',
status: [ 'done', 'no-info' ]
}
So it's including the leading '
in the string...
The same thing, strangely.
-> sent
{
op: 'info',
ns: 'ws.api.main',
symbol: "'ctl-web-site/get-profile-delete-reasons",
id: '1557',
session: '7b694f70-6cd6-4661-8673-dc81e26ab1b3'
}
<- received
{
id: '1557',
session: '7b694f70-6cd6-4661-8673-dc81e26ab1b3',
status: [ 'done', 'no-info' ]
}
-> sent
{
op: 'info',
ns: 'ws.api.main',
symbol: "'ctl-web-site/get-profile-delete-reasons",
id: '1558',
session: '7b694f70-6cd6-4661-8673-dc81e26ab1b3'
}
<- received
{
id: '1558',
session: '7b694f70-6cd6-4661-8673-dc81e26ab1b3',
status: [ 'done', 'no-info' ]
}
Oh, not quite. the first, failed one has ns: 'user'
Yeah, I just tried and it includes it for me too. And also no-info
, so I guess clojure-lsp saves the day.
So the only difference is that sometimes Calva sends ns: 'user'
-- in which case it fails -- and subsequently Calva sends ns: 'ws.api.main'
and it works.
I think it never really works with the repl. But it could be failing differently in Calva. In one case recognized as a failure, and falling back on clojure-lsp. In the other case failing in some way that Calva instead croaks on, and the fallback never happens. This is all guessing, but I wrote most of that code, so not completely out of the blue guesses. 😃 You might be able to see a difference in the developer console log.
I just made my dev Calva not include the '
in the repl info lookup. And then it starts to work. Please file an issue (if you have the time, I can do it otherwise). Not sure what the implications are if I fix it the way I have fixed it now. I think things like foo'
will stop working then. VS Code is pretty crude in this area. But we can fix it in the nrepl client, instead.
Here’s a pull request fixing the nrepl part of the issue: https://github.com/BetterThanTomorrow/calva/pull/2145 • https://output.circle-artifacts.com/output/job/16c1840f-f6bb-43bb-a959-c8c76168f700/artifacts/0/tmp/artifacts/calva-2.0.348-2144-quoted-symbol-lookup-d595e3bf.vsix
Thanks. Unlikely I'll get to try that until Monday tho' at this point.
It’s still a mystery why the clojure-lsp fallback mechanism doesn’t work for you. Let’s check your clojure-lsp message logs on Monday.
LSP logs for this:
2023-04-06T22:11:18.494Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.494Z] Received request 'textDocument/documentHighlight - (5692)'
2023-04-06T22:11:18.494Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.494Z] Received request 'textDocument/codeAction - (5693)'
2023-04-06T22:11:18.495Z INFO [clojure-lsp.handlers:277] - :document-highlight 1ms
2023-04-06T22:11:18.495Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.495Z] Sending response 'textDocument/documentHighlight - (5692)'. Request took 1ms.
2023-04-06T22:11:18.517Z INFO [clojure-lsp.handlers:437] - :code-actions 23ms
2023-04-06T22:11:18.518Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.518Z] Sending response 'textDocument/codeAction - (5693)'. Request took 24ms.
2023-04-06T22:11:18.711Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.711Z] Received request 'textDocument/codeLens - (5694)'
2023-04-06T22:11:18.712Z INFO [clojure-lsp.handlers:449] - :code-lens 0ms
2023-04-06T22:11:18.712Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.711Z] Received request 'textDocument/codeAction - (5695)'
2023-04-06T22:11:18.712Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.712Z] Sending response 'textDocument/codeLens - (5694)'. Request took 1ms.
2023-04-06T22:11:18.732Z INFO [clojure-lsp.handlers:437] - :code-actions 20ms
2023-04-06T22:11:18.732Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:18.732Z] Sending response 'textDocument/codeAction - (5695)'. Request took 21ms.
2023-04-06T22:11:21.581Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:21.581Z] Received request 'textDocument/documentHighlight - (5696)'
2023-04-06T22:11:21.582Z INFO [clojure-lsp.handlers:277] - :document-highlight 1ms
2023-04-06T22:11:21.583Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:21.583Z] Sending response 'textDocument/documentHighlight - (5696)'. Request took 2ms.
2023-04-06T22:11:21.833Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:21.833Z] Received request 'textDocument/codeAction - (5697)'
2023-04-06T22:11:21.872Z INFO [clojure-lsp.handlers:437] - :code-actions 38ms
2023-04-06T22:11:21.872Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:21.872Z] Sending response 'textDocument/codeAction - (5697)'. Request took 39ms.
2023-04-06T22:11:27.423Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.423Z] Received request 'textDocument/documentHighlight - (5698)'
2023-04-06T22:11:27.423Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.423Z] Received request 'textDocument/codeAction - (5699)'
2023-04-06T22:11:27.423Z INFO [clojure-lsp.handlers:277] - :document-highlight 0ms
2023-04-06T22:11:27.424Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.424Z] Sending response 'textDocument/documentHighlight - (5698)'. Request took 1ms.
2023-04-06T22:11:27.464Z INFO [clojure-lsp.handlers:437] - :code-actions 41ms
2023-04-06T22:11:27.465Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.464Z] Sending response 'textDocument/codeAction - (5699)'. Request took 41ms.
2023-04-06T22:11:27.634Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.634Z] Received request 'textDocument/codeLens - (5700)'
2023-04-06T22:11:27.635Z INFO [clojure-lsp.handlers:449] - :code-lens 0ms
2023-04-06T22:11:27.635Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.635Z] Received request 'textDocument/codeAction - (5701)'
2023-04-06T22:11:27.635Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.635Z] Sending response 'textDocument/codeLens - (5700)'. Request took 1ms.
2023-04-06T22:11:27.662Z INFO [clojure-lsp.handlers:437] - :code-actions 28ms
2023-04-06T22:11:27.663Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:27.663Z] Sending response 'textDocument/codeAction - (5701)'. Request took 28ms.
2023-04-06T22:11:28.932Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:28.932Z] Received request 'textDocument/definition - (5702)'
2023-04-06T22:11:28.932Z INFO [clojure-lsp.handlers:246] - :definition 0ms
2023-04-06T22:11:28.932Z DEBUG [clojure-lsp.server:55] - [Trace - 2023-04-06T22:11:28.932Z] Sending response 'textDocument/definition - (5702)'. Request took 0ms.
So... nothing odd there...
Nope. Nothing in dev tools.
It used to work at some point in the past. I don't remember exactly when it stopped working.
VS Code just nudged me about the updated Calva so I reloaded -- and can confirm it is working now. Thank you for that very swift fix!
I have a workspace root I connect to a repl from using "connect to a REPL running in your project". It's a shadow REPL with the configuration file a couple directories down from the root. When I try to connect, the drop down excludes any mention of connecting with shadow-cljs. If I type it in and press enter, the output window appears but it aborts the connection. But if I repeat the exact same command again, shadow-cljs now appears in the drop down and I can connect fine. Is this expected behavior?
I also wonder, is the shadow-cljs.edn file not at the root of the shadow project, or just not at the root of the workspace?
It's in the root of the project for sure, I always use the create-cljs-project template so I don't screw that up 😅
So, the project root is showing, but not the shadow-cljs option in the project type menu?
Sorry I'm not exactly a VScode power user so if I'm screwing up terminology here lmk. But I have my editor open in /var/www/html
(the doc root of an apache server) and then the shadow project is in /var/www/html/cms/cljms
No probs. I’m still not clear about what happens. Can you describe, step by step, how you connect, which menus you see, what you select, and so on?
1. Open VSCode at directory above.
2. Start REPL in terminal with npx shadow-cljs watch app
3. Click REPL button in lower left hand corner to bring up connection panel.
4. Click on connection sequence type (shadow if it's there, first time it usually isn't)
*3.5 Click on "connect to a repl running in your project"
Thanks. I’m so used to having several projects in a workspace so I forgot that you don’t get the project root menu if you only have one.
Nope, just the cljs stuff rn
Now that I've already connected once shadow-cljs shows up. But the other options are generic, clojurescript nREPL server, babashka, nbb, joyride
Windows 10 running VSCode and Clojure etc through WSL
VScode version 1.77.q
OK. Maybe Windows 10 + WSL has something to do with it. Could be that the glob is slow. Can you check if you press esc
on the project type menu and try to connect again, if shadow shows up then?
Yeah its there after I escape
Please file an issue. Do it from vscode’s help menu. Then some system info will get attached.
From this menu, yes?
Here’s a pull request fixing the nrepl part of the issue: https://github.com/BetterThanTomorrow/calva/pull/2145 • https://output.circle-artifacts.com/output/job/16c1840f-f6bb-43bb-a959-c8c76168f700/artifacts/0/tmp/artifacts/calva-2.0.348-2144-quoted-symbol-lookup-d595e3bf.vsix
Dear Calva friends, a bug is fixed: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.348 • Fix: https://github.com/BetterThanTomorrow/calva/issues/2144 (Not that most of us notice the bug, because clojure-lsp has nrepl’s back here.)
VS Code just nudged me about the updated Calva so I reloaded -- and can confirm it is working now. Thank you for that very swift fix!