This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-25
Channels
- # asami (5)
- # babashka (38)
- # beginners (116)
- # calva (65)
- # chlorine-clover (4)
- # cider (8)
- # cljfx (6)
- # cljsrn (7)
- # clojure (18)
- # clojure-australia (1)
- # clojure-europe (49)
- # clojure-spec (6)
- # clojure-uk (4)
- # clojurescript (3)
- # clojureverse-ops (13)
- # core-async (2)
- # cryogen (1)
- # cursive (9)
- # datahike (32)
- # fulcro (3)
- # gratitude (17)
- # malli (4)
- # music (3)
- # nrepl (8)
- # off-topic (14)
- # releases (2)
- # rewrite-clj (3)
- # shadow-cljs (4)
- # vrac (1)
- # xtdb (4)
I’ve just returned to a Clojure project which has been lying fallow for a while. When I start VSCode, the “Initializing Clojure language features via clojure-lsp” never goes away. I’ve followed the troubleshooting instructions on the Calva website, and sure enough, I see an error in the Clojure Language Client channel, but I’m not sure what it’s telling me. Suggestions gratefully received (thanks in advance):
[Trace - 17:02:01] Sending request 'initialize - (0)'.
Params: {
"processId": 30674,
"clientInfo": {
"name": "vscode",
"version": "1.60.2"
},
"rootPath": "/Users/paulbutcher/Projects/raceandimprove/race-and-improve",
"rootUri": "file:///Users/paulbutcher/Projects/raceandimprove/race-and-improve",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional"
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
}
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
}
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
}
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
}
},
"window": {
"workDoneProgress": true
}
},
"initializationOptions": {
"dependency-scheme": "jar",
"auto-add-ns-to-new-files?": true,
"document-formatting?": false,
"document-range-formatting?": false,
"keep-require-at-start?": true
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///Users/paulbutcher/Projects/raceandimprove/race-and-improve",
"name": "race-and-improve"
}
]
}
Sep 25, 2021 5:02:01 PM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: An error occurred while processing an incoming message.
java.lang.NullPointerException
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:279)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
that's exception is no good 😅 But it seems it's not the full stack, could you try get the full stack from clojure-lsp server log?
Thanks @UKFSJSM38. Sorry for the delay, but I’ve just got back to this. This is what I see in the clojure-lsp server log:
2021-09-26T14:58:59.026Z Pauls-16in-MBP ERROR [clojure-lsp.server:?] -
com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine PosixJavaThreads.java: 192
com.oracle.svm.core.thread.JavaThreads.threadStartRoutine JavaThreads.java: 567
java.lang.Thread.run Thread.java: 829
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 628
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1128
java.util.concurrent.FutureTask.run FutureTask.java: 264
java.util.concurrent.Executors$RunnableAdapter.call Executors.java: 515
org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run ConcurrentMessageProcessor.java: 113
org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen StreamMessageProducer.java: 94
org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage StreamMessageProducer.java: 194
org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume RemoteEndpoint.java: 190
org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest RemoteEndpoint.java: 261
org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request GenericEndpoint.java: 120
org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0 GenericEndpoint.java: 65
...
clojure_lsp.server.proxy$clojure_lsp.ClojureExtensions$ExtraMethods$LanguageServer$4129860f.initialize
clojure-lsp.server/fn/fn server.clj: 301
clojure-lsp.handlers/initialize handlers.clj: 49
clojure-lsp.crawler/initialize-project crawler.clj: 186
clojure.core/update core.clj: 6185
clojure.core/partial/fn core.clj: 2635
clojure-lsp.source-paths/process-source-paths source_paths.clj: 131
clojure-lsp.source-paths/resolve-source-paths source_paths.clj: 126
clojure-lsp.source-paths/resolve-source-paths-from-files source_paths.clj: 92
clojure-lsp.parser/lein-zloc->edn parser.clj: 112
rewrite-clj.zip/remove zip.cljc: 569
rewrite-clj.zip.removez/remove removez.cljc: 57
java.lang.AssertionError: Assert failed: zloc
2021-09-26T14:58:59.028Z Pauls-16in-MBP DEBUG [clojure-lsp.server:?] - :initialize 21ms
The significant line seems to be:
java.lang.AssertionError: Assert failed: zloc
But I’m not sure what that’s telling me?
@U5KAD4W2E it seems the file you have opened has not valid clojure code, even with this exception the server should start without any issues
You mean the file that I’ve opened in VSCode?
could you try with a simple repro where I can see the code as well? a repo on github would help a lot
So I don’t have a file open at all. All I’ve done is open VSCode on a directory containing a Clojure project.
Are you suggesting that one of the files within the project might be causing the problem?
this expection happens when we can't parse the code but again, it should not block clojure-lsp from initializing and working
I thought that Calva had its own clojure-lsp bundled?
The documentation here suggests that it does use latest (unless configured otherwise, which I haven’t done): https://calva.io/clojure-lsp/
How would I check which version is being used?
OK, so I’m going to create an empty Clojure project and confirm that Calva/clojure-lsp startup OK with that.
@U5KAD4W2E I just checked again the exception and found that the issue is when resolving the source-paths
Assuming that that does work, I’ll see if I can create a cutdown version of my project which reproduces the problem
deps.edn
This is my deps.edn:
{:deps {org.clojure/clojure {:mvn/version "1.10.3"}
org.clojure/clojurescript {:mvn/version "1.10.879"}
org.clojure/spec.alpha {:mvn/version "0.2.194"}
amazonica/amazonica {:mvn/version "0.3.156"}
binaryage/dirac {:mvn/version "1.7.2"}
binaryage/oops {:mvn/version "0.7.1"}
clj-http/clj-http {:mvn/version "3.12.3"}
cljs-ajax/cljs-ajax {:mvn/version "0.8.4"}
com.bhauman/figwheel-main {:mvn/version "0.2.14"}
com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
day8.re-frame/http-fx {:mvn/version "0.2.3"}
day8.re-frame/tracing {:mvn/version "0.6.2"}
day8.re-frame/re-frame-10x {:mvn/version "1.1.13"}
funcool/promesa {:mvn/version "6.0.2"}
io.sentry/sentry-clj {:mvn/version "5.0.152"}
nrepl/nrepl {:mvn/version "0.8.3"}
org.slf4j/slf4j-simple {:mvn/version "1.7.32"}
ovotech/ring-jwt {:mvn/version "2.2.1"}
re-frame/re-frame {:mvn/version "1.2.0"}
reagent/reagent {:mvn/version "1.1.0", :exclusions [cljsjs/react
cljsjs/react-dom
cljsjs/react-dom-server]}
metosin/reitit {:mvn/version "0.5.15"}
ring/ring-defaults {:mvn/version "0.3.3"}
ring/ring-jetty-adapter {:mvn/version "1.9.4"}
ring/ring-json {:mvn/version "0.5.1"}
testdouble/clojurescript.csv {:mvn/version "0.5.1"}
tick/tick {:mvn/version "0.5.0-RC2"}}
:paths ["src/cljs" "src/cljc" "src/clj" "resources"]
:aliases {:dev-ui {:extra-paths ["src/dirac" "test/cljs" "src/dev"]
:main-opts ["-m" "dirac-figmain.repl"]}
; :main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]} ; Normal figwheel build
:prod-ui {:extra-paths ["src/prod"]
:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "prod"]}
:test-ui {:extra-paths ["test/cljs"]
:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" race-and-improve.test-runner]}
:dev {:extra-paths ["src/dev"]}
:prod {:extra-paths ["src/prod"]}
:serve {:main-opts ["-m" "race-and-improve.core"]}
:test {:extra-paths ["test/clj"]
:extra-deps {com.cognitect/test-runner {:git/url ""
:sha "dd6da11611eeb87f08780a30ac8ea6012d4c05ce"}}
:main-opts ["-m" "cognitect.test-runner"]}
:depstar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}}
:ns-default hf.depstar
:exec-args {}}}}
Alright, I'll take a look, just to make sure, this is the only project type right? do you have a bb.edn or something as well?
Its the only project type. There are some additional Figwheel edn config files (although I don’t imagine that they should make a difference?)
FYI, I can confirm that clojure-lsp starts successfully in a “bare bones” Clojure project
And it tells me:
clojure-lsp version used: 2021.09.13-22.25.35
clj-kondo version used: 2021.08.07-SNAPSHOT
Any sign of a “smoking gun” in that deps.edn?
not really, I used that deps.edn on a sample project of mine and everything started :thinking_face:
OK, let me start cutting the project down and see if I can create a minimal reproduction.
that would help, probably it's a clojure-lsp bug or corner case it's not handling well, but we need a sample project which repro the issue so we can debug further more and understand what's wrong
I lied when I said that there was no other project file. There is a project.clj. But it looks like this:
; Unused - only here because the Heroku Clojure buildpack insists upon project.clj being present
Delete that file and everything works fine. I guess I need to have something minimal in there like:
{}
you could just change to:
; Unused - only here because the Heroku Clojure buildpack insists upon project.clj being present
{}
Just tried that and I get the same error
So it looks like that’s still too minimal
even so, probably a exception would happen on clojure-lsp because it doesn't expects a missing defproject on project.clj
for now, you can probably set :source-paths
setting or just delete that file if you can do that
Cool, thanks! Would it be helpful for me to raise a bug on the clojure-lsp project? Or happy to leave you to do it as you understand it much better than I do!
I can’t delete it, sadly: even though it’s unused, Heroku’s Clojure build pack insists upon it being there 😞
Will do. And thanks for your help!
@U5KAD4W2E Just so you know, Calva ouputs the version of clojure-lsp it’s configured to use in the “Calva says” channel. For example:
> clojure-lsp version configured: latest
When the clojure-lsp server actually starts up, you can use the Clojure-lsp Server Info
command, as well.
Thanks @U9A1RLFNV. I noticed that once it actually started: my problem was that it wasn’t starting at all and didn’t get to that point :rolling_on_the_floor_laughing:
Right, hence my note about when it actually start up 😄. I think the first info in that channel I mentioned will show whether it starts or not.
How to fix broken indentation
cljfmt
does not pack spaces between forms, afaik. You’ll have to make it (< px (+
manually, I think.
Ok tx. Is there anything in Emacs or spacemacs?
Hitting tab or alt tab l did not repack and reformat the entire form. Neither did control k control f