This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-27
Channels
- # announcements (47)
- # babashka (36)
- # beginners (7)
- # biff (34)
- # calva (9)
- # cider (5)
- # clj-http (13)
- # clj-kondo (24)
- # cljs-dev (9)
- # clojure (146)
- # clojure-austin (1)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (2)
- # clojurescript (4)
- # clr (1)
- # core-async (9)
- # cursive (11)
- # datomic (6)
- # emacs (17)
- # events (3)
- # fulcro (45)
- # graphql (7)
- # helix (1)
- # hyperfiddle (28)
- # java (1)
- # london-clojurians (1)
- # lsp (75)
- # malli (1)
- # membrane (35)
- # reitit (6)
- # releases (1)
- # shadow-cljs (48)
- # tools-build (5)
- # tools-deps (27)
Released clojure-lsp https://github.com/clojure-lsp/clojure-lsp/releases/tag/2023.02.26-23.46.05 with fixes and improvements 🎉
There are improvements in hover being able to follow
:arglists
for documentation, support for cljs docs search on clojuredocs, big performance improvement in completion and more improvements!
• General
◦ Add new setting :paths-ignore-regex
to allow ignore analyzing/linting specific paths, useful if you have folders or files that are not relevant to be linted and are huge which may affect performance.
◦ Bump clj-kondo. Fixes missing lint class constructors, making clojure-lsp show add import code action always.
◦ Fix wrong ns rename for cljc files. https://github.com/clojure-lsp/clojure-lsp/issues/1508
• Editor
◦ Fix cache issue: wrong external dependencies analysis when running clojure-lsp in editor after running on CLI, affecting navigation. https://github.com/clojure-lsp/clojure-lsp/issues/1473
◦ Bump lsp4clj fixing progress notifications during initialization for Calva.
◦ Allow go to definition of namespace even when the var is not known. Ex: clojure.string/foo
will go to the definition of clojure.string
. This is useful for cases where the var was not created yet but user wants to go to the ns to check the available functions or check the correct name of the function.
◦ Avoid basing results on old analysis.
◦ Add new setting :completion :analysis-type
to choose between :fast-but-stale
(default) or :slow-but-accurate
, this should define whether completion should wait for changes that may still happening, this by default reverts the behavior introduced after https://github.com/clojure-lsp/clojure-lsp/issues/1425. https://github.com/clojure-lsp/clojure-lsp/issues/1487
◦ Fix textDocument/hover
issue when doc metadata isn't a string literal.
◦ Follow references to other vars in doc metadata for use in textDocument/hover
.
◦ Support :arglists
meta when finding docs of functions via hover feature. https://github.com/clojure-lsp/clojure-lsp/issues/1504
◦ Enhance hover to search clojuredocs on CLJS. https://github.com/clojure-lsp/clojure-lsp/issues/1506
Thank you for all sponsors and ClojuristsTogether 💙





whenever im trying to do a textDocument/hover
in my nvim i get this error now:
clojure_lsp: -32603: Internal error
for example, when trying to hover on the defn
here: https://github.com/lispyclouds/dotfiles/blob/main/tasks/general/commit.clj#L14dont see anything useful in the client side lsp logs
Yeah, I'm working on that, it's a bug, I'm using eval and graal doesn't support that
ah, thanks!
tried it with the dev build here: https://cirrus-ci.com/task/6733629292806144 and it works!
thanks! 😄
released the fix https://github.com/clojure-lsp/clojure-lsp/releases/tag/2023.02.27-13.12.12
I’m getting some errors on lsp startup that are preventing navigation from working. Details in thread:
com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine PosixPlatformThreads.java: 203
com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine PlatformThreads.java: 775
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
...
clojure.core/binding-conveyor-fn/fn core.clj: 2047
clojure-lsp.startup/analyze-source-paths!/fn startup.clj: 73
clojure-lsp.kondo/run-kondo-on-paths! kondo.clj: 328
clojure-lsp.kondo/run-kondo! kondo.clj: 312
clojure-lsp.kondo/run-kondo!/fn kondo.clj: 313
clj-kondo.core/run! core.clj: 224
clj-kondo.core/run!/fn core.clj: 225
clojure-lsp.kondo/run-kondo-on-paths!/fn kondo.clj: 325
clojure-lsp.kondo/custom-lint-project! kondo.clj: 213
clojure-lsp.feature.diagnostics/custom-lint-project! diagnostics.clj: 230
clojure-lsp.feature.diagnostics/findings-of-project diagnostics.clj: 215
clojure-lsp.feature.diagnostics/unused-public-vars diagnostics.clj: 188
clojure.core/set core.clj: 4114
clojure.core/reduce1 core.clj: 944
clojure.core/chunk-next core.clj: 710
...
clojure.core/map/fn core.clj: 2763
clojure.core/seq core.clj: 139
...
clojure.core/filter/fn core.clj: 2834
clojure.core/complement/fn core.clj: 1455
clojure.core/partial/fn core.clj: 2648
clojure-lsp.feature.diagnostics/exclude-public-diagnostic-definition? diagnostics.clj: 65
clojure.string/starts-with? string.clj: 365
java.lang.NullPointerException:
from startup logand then this appears constantly:
2023-02-27T16:25:22.309Z WARN [clojure-lsp.kondo:315] - Non-fatal error from clj-kondo: No configs copied.
only on latest release @U11BV7MTK?
yes. was previously working fine. i’m gonna try to disable the linter and see if that fixes it. and then rollback with linter enabled and should continue working?
the exception happens https://github.com/clojure-lsp/clojure-lsp/blob/148222e32dedc5be06e02faee9e13c4dd77d7251/lib/src/clojure_lsp/feature/diagnostics.clj#L65, weird, some var-definition is missing a :name
, we didn't change anything related to that in clojure-lsp IIRC
i still get the error with the linter disabled
clojure-lsp.feature.diagnostics/exclude-public-diagnostic-definition? diagnostics.clj: 65
clojure.string/starts-with? string.clj: 365
Hmm, probably also an opportunity for performance, when people don't use the linter don't do the work?
we do have this check https://github.com/clojure-lsp/clojure-lsp/blob/148222e32dedc5be06e02faee9e13c4dd77d7251/lib/src/clojure_lsp/kondo.clj#L209
Downgrading to 2022.12.09-15.51.10
fixes navigation.
Interestingly I’m seeing a bunch of
ARNING: error while trying to read hook for clojure.test/deftest: Unmatched delimiter: ), expected: ] to match [ at [11 10]
I think someone fixed this on our side recently i’m just on a few days old branch. I don’t know if that could impact it or notoh so, even the release of jan happens the same issue? https://github.com/clojure-lsp/clojure-lsp/releases/tag/2023.01.26-11.08.16
@U11BV7MTK could you confirm the issue happens on jan release as well? there was indeed code changes in that release
issue not present on the link you sent for the jan release. no error in startup log. Yes it is metabase
Found it, maybe it's a bug on clj-kondo
The exception when analyzing defclause
https://github.com/metabase/metabase/blob/07f174deaaf3ee7794e17c3aa9ebf94250b04d8e/shared/src/metabase/mbql/schema.cljc#L986, this is a analysis with the name nil which AFAIK should not happen:
{:end-row 984,
:meta {},
:name-end-col 82,
:external? false,
:name-end-row 983,
:name-row 983,
:ns metabase.mbql.schema,
:name nil,
:lang :clj,
:col 1,
:name-col 70,
:uri "file:///home/greg/dev/metabase/shared/src/metabase/mbql/schema.cljc",
:end-col 44,
:bucket :var-definitions,
:row 983}
I noticed that macro is configured as a lint-as in clj-kondo config clj-kondo.lint-as/def-catch-all
is this configured with def-catch-all, this had a change recently in clj-kondo which should have been an improvement ;)
@U11BV7MTK would you mind creating that issue in clj-kondo later with those details of that macro please?
can you reproduce the issue with clj-kondo only? the analysis of the defclause defined vars should have a name
borkdude@m1 ~/temp/lint_as $ clj-kondo --lint src/my_lib.clj --config '{:analysis true :output {:format :edn}}' | jet -t ':analysis :var-definitions'
[{:col 1,
:defined-by clojure.core/defmacro,
:end-col 31,
:end-row 3,
:filename "src/my_lib.clj",
:macro true,
:name defclause,
:name-col 11,
:name-end-col 20,
:name-end-row 3,
:name-row 3,
:ns my-lib,
:row 3,
:varargs-min-arity 0}
{:col 1,
:end-col 44,
:end-row 6,
:filename "src/my_lib.clj",
:name median,
:name-col 62,
:name-end-col 68,
:name-end-row 5,
:name-row 5,
:ns my-lib,
:row 5}]
(ns my-lib)
(defmacro defclause [& _args])
(defclause ^{:requires-features #{:percentile-aggregations}} median
field-or-expression FieldOrExpressionDef)
{:lint-as {my-lib/defclause clj-kondo.lint-as/def-catch-all}}
thank you for reporting this @U11BV7MTK
having trouble identifying any blank names on my side
clj-kondo/clj-kondo {:mvn/version "2023.02.17"}
and then with the api:
(def x (clj-kondo/run! {:lint ["src"]
:config {:analysis true
:output {:format :edn}}
:config-dir ".clj-kondo"}))
kondo=> (count (->> x :analysis :var-definitions (filter (comp nil? :name))))
0
yeah, I suspect it's something with that ns or any extra kondo config that metabase does differently
ah, i didn’t have that classpath root
kondo=> (->> x :analysis :var-definitions (filter (comp nil? :name)))
({:end-row 984,
:name-end-col 82,
:name-end-row 983,
:name-row 983,
:ns metabase.mbql.schema,
:name nil,
:lang :clj,
:filename "shared/src/metabase/mbql/schema.cljc",
:col 1,
:name-col 70,
:end-col 44,
:row 983}
{:end-row 984,
:name-end-col 82,
:name-end-row 983,
:name-row 983,
:ns metabase.mbql.schema,
:name nil,
:lang :cljs,
:filename "shared/src/metabase/mbql/schema.cljc",
:col 1,
:name-col 70,
:end-col 44,
:row 983})
and what is at the location at the source? e.g. can you narrow the repro down to only that source snippet?
(declare ag:var) ;; for clj-kondo
(defclause ^{:requires-features #{:standard-deviation-aggregations}} [ag:var var]
field-or-expression FieldOrExpressionDef)
but repro finds it:
❯ echo '(declare ag:var)' | clj-kondo --config '{:analysis true :output {:format :edn}}' --lint - | jet -t ':analysis :var-definitions'
[{:col 1,
:defined-by clojure.core/declare,
:end-col 17,
:end-row 1,
:filename "<stdin>",
:name ag:var,
:name-col 10,
:name-end-col 16,
:name-end-row 1,
:name-row 1,
:ns user,
:row 1}]
I can repro the issue with @U04V15CAJ’s repro but with this code:
(defclause ^{:requires-features #{:standard-deviation-aggregations}} [ag:var var]
field-or-expression FieldOrExpressionDef)
with custom syntax like this, it might be better to write a hook (:macroexpand hook is easiest and sufficient for this one probably)
i got confused by the two results thinking it was the two forms. but it’s from clj and cljs analysis
looks like the previous kondo (“2023.01.16”) also reported a nil name
{:filename "shared/src/metabase/mbql/schema.cljc",
:row nil,
:col nil,
:ns metabase.mbql.schema,
:name nil,
:lang :clj}
but also excluded row and col information.
Current kondo reports
{:end-row 984,
:name-end-col 82,
:name-end-row 983,
:name-row 983,
:ns metabase.mbql.schema,
:name nil,
:lang :clj,
:filename "shared/src/metabase/mbql/schema.cljc",
:col 1,
:name-col 70,
:end-col 44,
:row 983}
clj-kondo could also not include this nil-name var, but then it would maybe also harder to debug things
it’s interesting it knows the length of the name (70 - 82) but doesn’t grab the name
because it's the length of the vector, but [ag:var var]
it's not really a name of a var-definition
Ah. Right. I was focusing on the colon in the name. But the vector doesn’t make sense at all. Sorry I’m playing catch-up on that
have we arrived at a conclusion? will it be fixed? 😅
AFAICS it should be fixed in metabase repo itself, defining a hook for that macro
@U11BV7MTK Happy to do that later this week, if you want me to do it
I agree that there should be a fix in metabase. But seems lsp/kondo should be more resilient and not fail?
yes, we should filter nameless var-definitions in clojure-lsp or kondo, I'm ok doing it on clojure-lsp so feel free to open an issue there
ok, so i need to debug why my personal setup broke with the latest release from first principles, gotcha
if it’s the same stacktrace as I was seeing,
(ns nocommit.kondo
(:require [clj-kondo.core :as clj-kondo]
[clojure.string :as str]))
(def x (clj-kondo/run! {:lint ["src"
;; and your other source paths
]
:config {:analysis true
:output {:format :edn}}
:config-dir ".clj-kondo"}))
(count (->> x :analysis :var-definitions (filter (comp nil? :name))))
https://github.com/clojure-lsp/clojure-lsp/issues/1510 in clojure-lsp. Thank you all for the help