This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-11
Channels
- # announcements (15)
- # babashka (13)
- # babashka-sci-dev (2)
- # beginners (80)
- # clerk (11)
- # clj-commons (4)
- # cljs-dev (1)
- # cljsrn (1)
- # clojars (19)
- # clojure (48)
- # clojure-austin (2)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (26)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-hungary (32)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojure-uk (2)
- # community-development (7)
- # datomic (15)
- # emacs (6)
- # fulcro (2)
- # gratitude (1)
- # hoplon (3)
- # hyperfiddle (28)
- # inf-clojure (14)
- # introduce-yourself (1)
- # jobs (1)
- # joyride (4)
- # lsp (50)
- # malli (4)
- # nrepl (2)
- # polylith (12)
- # shadow-cljs (27)
- # spacemacs (3)
- # sql (8)
- # tools-build (11)
- # xtdb (22)
I have been having a problem when indenting for a while, getting this sort of error
Debugger entered--Lisp error: (error "Internal error")
error("Internal error")
lsp-request("textDocument/rangeFormatting" #<hash-table equal 3/65 0x1572bdc0aa71>)
lsp-format-region(91 821)
apply(lsp-format-region (91 821))
#f(advice-wrapper :override clojure-indent-region lsp-format-region)(91 821)
indent-region(91 821)
indent-for-tab-command(nil)
funcall-interactively(indent-for-tab-command nil)
#<subr command-execute>(indent-for-tab-command nil nil nil)
ad-Advice-command-execute(#<subr command-execute> indent-for-tab-command)
apply(ad-Advice-command-execute #<subr command-execute> indent-for-tab-command)
command-execute(indent-for-tab-command)
weirdly it doesn't always do that, just on some forms
well actually interesting it doesn't even always happen on the same form 🤯
this works fine now
(defn hello []
42)
But trying to indent
(def x 232)
failsyeah would do that after work, takes too long to reinstall everything
even though I'm pretty sure I had it for a while and I've done that already
You can check https://clojure-lsp.io/troubleshooting/#server-log to make sure it's not a server's fault before reinstalling everything
ah yes
2023-04-11T13:13:20.788Z ERROR [clojure-lsp.server:55] - Error receiving message: Internal error (-32603)
{:id 1395, :method "textDocument/rangeFormatting"}
com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine PosixPlatformThreads.java: 203
com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine PlatformThreads.java: 775
java.util.concurrent.ForkJoinWorkerThread.run ForkJoinWorkerThread.java: 183
java.util.concurrent.ForkJoinPool.runWorker ForkJoinPool.java: 1594
java.util.concurrent.ForkJoinPool.scan ForkJoinPool.java: 1656
java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec ForkJoinPool.java: 1020
java.util.concurrent.ForkJoinTask.doExec ForkJoinTask.java: 290
java.util.concurrent.CompletableFuture$AsyncSupply.exec CompletableFuture.java: 1692
java.util.concurrent.CompletableFuture$AsyncSupply.run CompletableFuture.java: 1700
promesa.util.Supplier/get util.cljc: 34
promesa.exec/wrap-bindings/fn exec.cljc: 163
clojure-lsp.server/fn/fn server.clj: 291
clojure-lsp.handlers/range-formatting handlers.clj: 428
clojure-lsp.feature.format/range-formatting format.clj: 137
rewrite-clj.zip/node zip.cljc: 178
rewrite-clj.custom-zipper.core/node core.cljc: 55
clojure.zip/node zip.clj: 67
java.lang.NullPointerException:
I'm on
clojure-lsp 2023.02.27-13.12.12
clj-kondo 2023.02.17
which looks like the latestyeah clojure-lsp format
works fine
@U0524T275 would help if you get client<->server logs and check what client is sending to server to range format
actually one think I didn't mention is that I selected the form before pressing TAB
for the formatting
if I just do TAB before the form on (def x 3)
without selecting anything it works
but well actually it's not even deterministic
since sometimes it just works
most of the times it works tbf
I'll check that it's not my Emacs config somehow after work
I just nuked my elpa directory, reinstall everything and it still does the same
I'll see if it I can replicate it somehow with a minimal config
I really can't find any pattern in when it happens or useful log
@ericdallo Hmm, in clj-kondo when I have :cljc {:features [:clj]}
in my .clj-kondo/config.edn
, clj-kondo should only lint the #?(:clj
branches, and this works with clj-kondo on the command line, but with clojure-lsp that doesn't seem to work. As an example project you can look at https://github.com/babashka/process
I didn't know about that kondo config, could you elaborate what you would expect from clojure-lsp? is your problem with clojure-lsp CLI or editor?
Interestingly:
$ clojure-lsp-dev diagnostics
[100%] Project analyzed
Finding diagnostics...
Execution error (NullPointerException) at java.util.regex.Matcher/getTextLength (Matcher.java:1769).
Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
Full report at:
/var/folders/j9/xmjlcym958b1fr0npsp9msvh0000gn/T/clojure-6415229798231618710.edn
My expectation is that clj-kondo config is not tampered with and it just lints the features that I describe in my config.edn
[[java.util.regex.Matcher getTextLength "Matcher.java" 1769]
[java.util.regex.Matcher reset "Matcher.java" 415]
[java.util.regex.Matcher <init> "Matcher.java" 252]
[java.util.regex.Pattern matcher "Pattern.java" 1149]
[java.util.regex.Pattern split "Pattern.java" 1277]
[java.util.regex.Pattern split "Pattern.java" 1350]
[clojure.string$split invokeStatic "string.clj" 225]
[clojure.string$split invoke "string.clj" 219]
[clojure_lsp.feature.diagnostics$kondo_findings__GT_diagnostics$fn__18370
invoke
"diagnostics.clj"
123]
[clojure.lang.Delay deref "Delay.java" 42]
[clojure.core$deref invokeStatic "core.clj" 2337]
[clojure.core$deref invoke "core.clj" 2323]
[clojure_lsp.feature.diagnostics$diagnostics_start_char_coll_QMARK_
invokeStatic
"diagnostics.clj"
When I do:
(defn ^:private kondo-findings->diagnostics [uri linter db]
(let [range-type (settings/get db [:diagnostics :range-type] :full)
;; we delay for performance
lines* (delay (some-> (get-in db [:documents uri :text])
(string/split #"\r?\n")))]
(when-not (exclude-ns? uri linter db)
(->> (get-in db [:findings uri])
(filter valid-finding?)
(mapv (partial kondo-finding->diagnostic range-type lines*))))))
(change ->
to some->
the NPE is solved)