This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-04
Channels
- # announcements (10)
- # babashka (16)
- # beginners (3)
- # calva (14)
- # clj-kondo (119)
- # clojure (15)
- # clojure-nl (2)
- # clojure-uk (2)
- # clojurescript (15)
- # conjure (1)
- # datascript (1)
- # duct (1)
- # fulcro (2)
- # lsp (6)
- # malli (1)
- # off-topic (9)
- # polylith (3)
- # re-frame (9)
- # reagent (12)
- # reitit (6)
- # shadow-cljs (27)
- # sql (14)
- # vim (5)
hi. there is an off-by-1 error either on Idea or on clj-kondo on reporting unused function argument location. see f
in the pic. greyed out are from cursive, underlines from clj-kondo :thinking_face:
This is weird, might be an issue with the thing you’re using to integrate clj-kondo, what is that?
I have posted a similar issue about this before I see: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003434480-File-watcher-inspection-doesn-t-use-line-and-column-correctly
note on the LSP-version performance. for large/complex files, it’s really slow on IDEA. Trying to write (inc "kikka")
into the end of malli.core
ns, takes 10sec just to echo the characters into screen.
I think it can be improved by borrowing some ideas from clojure-lsp, especially the implementation of incremental diffing. or you might want to try clojure-lsp altogether in Cursive, it uses clj-kondo so you would get that for free as well.
actually I wrote part of that diffing code in clojure-lsp ;) (not sure if that code is still used)
@UKFSJSM38 might have some ideas here
The code is here: https://github.com/clj-kondo/clj-kondo.lsp PRs are welcome
thanks. I would assume the LSP is on different thread and would not block the basic editor features. At least with clj-kondo, seeing result later is totally ok (different case with auto-complete etc)
it's kind of worrying that the lsp plugin for intellij is "on hold" since a year ago
Yeah... @U04V15CAJ the grey feature is a thing on the LS server, the server can add a tag on the diagnostic telling that is unused, then the LS client grey the variable
https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/feature/diagnostics.clj#L32
sure, PR welcome! I don't use the LSP plugin myself but I'm open to improvements for who do
hmm.. says classpath lookup failed in clojure-lsp
. tried to add brew-installed clojure-lsp
as the server.
Alright, check the clojure-lsp log file, you can set it with :log-path setting on .lsp/config.edn
The lookup is directly related with clojure-lsp running lein classpath
or clojure -Spath
2021-07-04T20:54:19.454Z UnknownHost INFO [clojure-lsp.crawler:236] - Automatically resolved source-paths from deps.edn: #{"src" "resources" "test"}
2021-07-04T20:54:19.971Z UnknownHost WARN [clojure-lsp.db:55] - Could not load db [SQLITE_ERROR] SQL error or missing database (no such table: project)
2021-07-04T20:54:19.972Z UnknownHost INFO [clojure-lsp.crawler:27] - Finding classpath via ` clojure -A:dev -Spath `
2021-07-04T20:54:19.979Z UnknownHost ERROR [clojure-lsp.crawler:38] - Error while looking up classpath info in /Users/tommi/projects/metosin/malli Cannot run program "clojure" (in directory "/Users/tommi/projects/metosin/malli"): error=2, No such file or directory
not sure how can I pass any PATH to LSP, copied clojure
executable to the directory, still doesn’t see that.
So it's not a issue with clojure-lsp, probably something with your OS not finding Clojure command
pasted the error here: https://gist.github.com/ikitommi/f2cacfe5c389c4459a89f397342293c3
This is how clojure-lsp call that command: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/crawler.clj#L32
@U055NJ5CC sure, but the startup should happen only once
Not if the classpath scan didn't work @U04V15CAJ
clj-kondo.lsp doesn't use a classpath scan, unless you do that yourself from the command line
Oh, @U055NJ5CC does /`Users/tommi/projects/metosin/malli` is the correct project root?
it seems clojure
cannot be found? what do you get for which clojure
in the shell?
intellij/cursive might have an issue with passing through the PATH
, I've seen such an issue in #cursive before
Oh, good point, it must be something with Intellij/cursive not using the correct PATH
perhaps you could use as the lsp plugin a bb script which spits out the PATH to a file and does nothing else
@U055NJ5CC I can try to setup Intellij later, what plugins for intellij are you using to setup clojure-lsp?
well, IntelliJ is a UI program which might not use the same PATH as bash or whatever?
tested from command line, the PATH is corrrect, but still doesn’t work, timeouts after 30sec:
2021-07-05T07:46:22.505Z UnknownHost INFO [clojure-lsp.crawler:27] - Finding classpath via ` clojure -Spath `
2021-07-05T07:46:22.566Z UnknownHost INFO [clojure-lsp.crawler:27] - Finding classpath via ` npx shadow-cljs classpath `
2021-07-05T07:46:51.574Z UnknownHost INFO [clojure-lsp.crawler:204] - Analyzing classpath for project root /Users/tommi/projects/metosin/malli
2021-07-05T07:46:51.575Z UnknownHost INFO [clojure-lsp.crawler:88] - Analyzing 15 paths with clj-kondo with batch size of 1 ...
IDEA logs this:
2021-07-05 10:47:52,122 [ 106969] WARN - pper.LanguageServerWrapperImpl - Capabilities are null for rawCommand : /usr/local/bin/clojure-lsp
2021-07-05 10:47:52,123 [ 106970] WARN - ub.gtache.lsp.utils.FileUtils$ - invalid url: ///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj (java.net.MalformedURLException: no protocol: ///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar)
java.net.MalformedURLException: invalid url: ///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj (java.net.MalformedURLException: no protocol: ///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar)
at java.base/java.net.URL.<init>(URL.java:679)
at java.base/java.net.URL.<init>(URL.java:541)
at java.base/java.net.URL.<init>(URL.java:488)
at com.github.gtache.lsp.utils.FileUtils$.VFSToURI(FileUtils.scala:101)
at com.github.gtache.lsp.utils.FileUtils$.editorToURIString(FileUtils.scala:89)
at com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapperImpl.connect(LanguageServerWrapperImpl.scala:181)
at com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapperImpl.$anonfun$restart$1(LanguageServerWrapperImpl.scala:405)
at com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapperImpl.$anonfun$restart$1$adapted(LanguageServerWrapperImpl.scala:405)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
at com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapperImpl.restart(LanguageServerWrapper
tested from repl, that doesn’t work:
(java.net.URL. "///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar")
; =throws=> Execution error (MalformedURLException) at java.net.URL/<init> (URL.java:593).
; no protocol: ///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar
➜ ~ ls -l ///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar
-rw-r--r-- 1 tommi staff 3914649 Mar 11 20:47 ///Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar
so:
1. IDEA doesn’t set the PATH correctly
2. clojure -Spath
returns URLs that the plugin doesn’t understand (uses java.net.Url
.
➜ malli git:(malli.instrument) ✗ clojure -Spath
src:resources:/Users/tommi/.m2/repository/borkdude/dynaload/0.2.2/dynaload-0.2.2.jar:/Users/tommi/.m2/repository/borkdude/edamame/0.0.11/edamame-0.0.11.jar:/Users/tommi/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar:/Users/tommi/.m2/repository/org/clojure/test.check/1.1.0/test.check-1.1.0.jar:/Users/tommi/.m2/repository/org/clojure/tools.reader/1.3.4/tools.reader-1.3.4.jar:/Users/tommi/.m2/repository/org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.jar:/Users/tommi/.m2/repository/org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar
@U016JRE24NL the 2. seems a issue with clojure-lsp right? For some reason with IDEA it returns wrong urls
above is what clojure -Spath
returns. The plugin uses Url
to handle those, which can’t
e.g. the plugin should be changed or the urls should be preprosessed to be compliant what Url
accepts.
Yeah, but probably is not following some convention somewhere in the plugin as all other editors like VSCode, emacs, vim works
(java.net.URL. "file:/Users/tommi/.m2/repository/org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar")
works okBTW try to disable that timeout, that will not work as sometimes (first time) clojure-lsp will take a while to scan the project and other times it will be fast
yeah, did that. just that it doesn’t load any files from classpath as it can’t read the urls
But I need to say this LSP plugin is missing a lot of features and its UX is not great IMO 😞
I'd suggest you try Calva for VSCode or Emacs if you want the better clojure development experience 😕
@U055NJ5CC what font/theme are you using btw?
@UJ1339K2B Borealis + Ligaturzed Menlo.