Fork me on GitHub
#calva
<
2022-08-17
>
Luke Johnson15:08:36

Good day! I’ve been seeing this whenever I start clojure-lsp in my shadow-cljs+deps.edn project. Both classpath commands work in my terminal (integrated and standalone) and I see expected output. Also:

❯ which clojure
/opt/homebrew/bin/clojure

❯ clojure --version         
Clojure CLI version 1.11.1.1149
LSP seems to be working correctly. I can jump to definition, rename symbols, etc. It does appear that references don’t update until I eval the file. For example, I see 0 references until I go eval the other namespace, then it updates to 2 references . Searching Slack, I can’t find anything specific to my issue. I’m on an Apple M1 Pro macOS Monterey 12.5 and using the latest VS Code and Calva.

Luke Johnson15:08:39

Also, for future searches, here’s the output:

Classpath lookup failed when running `clojure -A:test:dev -Spath`. Some features may not work properly. Error: Cannot run program "clojure" (in directory "/Users/ljohnson/CODE/practice/my-project"): error=2, No such file or directory

Classpath lookup failed when running `npx shadow-cljs classpath`. Some features may not work properly. Error: shadow-cljs - config: /Users/ljohnson/CODE/practice/my-project/shadow-cljs.edn Executable 'clojure' not found on system path.

ericdallo15:08:40

that sounds like wrong classpath indeed, could you check server logs? there is a calva command for that

ericdallo15:08:36

yep, it seems it's not finding clojure, @U0ETXRFEW we had issues like that in the past right? do you remember how we solved it? it's related to the PATH your vscode has IIRC

Luke Johnson15:08:02

❯ echo $PATH       
/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Visual Studio 

Luke Johnson15:08:44

Is it homebrew vs other install? FWIW, I installed both clojure and visual-studio-code through homebrew.

pez15:08:22

Looks like you have homebrew in the path. Where did you run that command?

Luke Johnson15:08:22

In the VS Code integrated terminal but the output is the same in iTerm2

pez15:08:31

Very strange. Still might be worth testing if it makes a difference if you start VS Code from the terminal.

Luke Johnson15:08:36

Interesting! When I quit everything and started VS Code by typing code in iTerm the error didn’t come up. Now when I quit and start again normally, the error also doesn’t come up. I think that somehow fixed it?!?!

pez15:08:04

Super happy it now works. 🎉 Weird though.

Luke Johnson15:08:19

Thanks for your time, Eric and Peter!

🙏 1
pez15:08:59

Another weird thing was with those references. I don't think we support that feature dynamically, yet you saw the count react on eval of the namespace. Do you have any idea what that could be about, @U9A1RLFNV?

bringe21:08:31

Where is this references count that you’re referring to?

ericdallo21:08:58

I think it's from code lens, I never saw that feature on any place besides LSP, I don't think it's related to repl

👍 1
bringe01:08:54

It may have something to do with clojure-lsp not having analyzed the other namespace until the file is opened, but I don’t know why.

ericdallo12:08:29

Yep, if clojure-lsp doesn' t know the source-paths or had a issue like Luke had, it won' t have the hability to scan the whole project, that' s why code lens show no references

ericdallo00:11:18

Does running that command in your project root works?

bringe22:11:43

@U02S178HM6Y If you start VS Code using the code command from a terminal, does this problem still occur?

Aquati01:12:44

Sorry for the late reply! @UKFSJSM38 No, it doesn't work 😕 I am getting this error when I open the Calva repository using VSCode with Calva @U9A1RLFNV Yes, it happens even opening VSCode from Terminal I had very little time this week to understand if it causes any major trouble when developing, so in the weekend I probably will know it better

bringe02:12:52

What happens if you run /usr/bin/clojure -A:test:dev -Spath in a terminal? What about just clojure -A:test:dev -Spath?

☝️ 1