This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-02
Channels
- # asami (24)
- # babashka (85)
- # beginners (137)
- # calva (46)
- # cider (16)
- # clj-kondo (19)
- # cljs-dev (7)
- # clojure (13)
- # clojure-australia (1)
- # clojure-europe (10)
- # clojure-nl (4)
- # clojure-spec (6)
- # clojure-uk (3)
- # clojurescript (5)
- # conjure (21)
- # cursive (15)
- # datascript (46)
- # datomic (13)
- # depstar (32)
- # figwheel-main (1)
- # fulcro (6)
- # honeysql (20)
- # lsp (53)
- # malli (7)
- # meander (9)
- # off-topic (35)
- # other-languages (1)
- # polylith (41)
- # re-frame (5)
- # reagent (4)
- # releases (3)
- # rewrite-clj (2)
- # shadow-cljs (22)
- # spacemacs (15)
- # tools-deps (3)
- # xtdb (17)
maybe a bug? in a clojure file, i have (:require [clojure.string :as string])
in my ns
macro, and then hover over (string/join ", " ...)
and press my keys for "go to definition". it loads the clojurescript string file in my ~/.m2
directory
if i "go to defintion" on clojure core library functions, it goes to the right clojure file
even if I [clojure.string :refer [join]]
, when i "go to definition" on join
, it loads ~/.m2/.../clojurescript-1.10.238.jar::clojure/string.cljs
will do!
it is
it's very long lol
all 3
hum, maybe clojure-lsp is not getting the right one when there are the clojure and cljs available
if i run lein new minimal
and then open the "core.clj" file, it works correctly
yeah, I think it'll only happen for projects where it has clojure core and cljs core on classpath
if i change the :dependencies
to those from my primary project, it shows the error again
looks like it happens with
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.238"]]
thanks so much, and good luck!
Fixed https://github.com/clojure-lsp/clojure-lsp/commit/076ee8055078c87d2441ba317c00c911da9a9bee, I'll probably release next version this weekend ๐
I forgot to mention that I'm using vim and coc.nvim, so maybe there's some funny business happening with that configuration
Can people who use lsp linting (not clj-kondo standalone) try this snippet:
(defmulti foo :bar)
(defmethod foo :test
[{:keys [a b] :or {a 1 b 2}}]
(let [q (* 10 (dec a))]
(+ b q)))
Do you get any warnings?Hum, it seems clj-kondo standalone doesn't print that unless you pass :locals true
clj -Sdeps '{:deps {clj-kondo {:mvn/version "2021.03.31"}}}' -m clj-kondo.main --lint src/clojure_sample/lsp/definition/a.clj --config '{:output {:analysis {:arglists true :locals true :keywords true} :canonical-paths true}}
/home/greg/dev/clojure-sample/src/clojure_sample/lsp/definition/a.clj:6:22: warning: unused default for binding a
/home/greg/dev/clojure-sample/src/clojure_sample/lsp/definition/a.clj:6:26: warning: unused default for binding b
linting took 156ms, errors: 0, warnings: 2
clj -Sdeps '{:deps {clj-kondo {:mvn/version "2021.03.31"}}}' -m clj-kondo.main --lint src/clojure_sample/lsp/definition/a.clj --config '{:output {:analysis {:arglists true :keywords true} :canonical-paths true}}'
linting took 160ms, errors: 0, warnings: 0
Not sure, but maybe https://github.com/clj-kondo/clj-kondo/blob/master/src/clj_kondo/impl/namespace.clj#L233 is affecting that
I think it might be in here:
v (cond-> (assoc m
:name s
:filename (:filename ctx)
:tag t)
(:analyze-locals? ctx)
(-> (assoc :id (swap! (:id-gen ctx) inc)
:str (str expr))
(merge (scope-end scoped-expr))))
So there is a condition if locals are being analyzed or not, and if so, something is added, which may cause some comparison to go wrongso I can repro with this:
$ clj-kondo --config '{:output {:analysis {:locals true}}}' --lint /tmp/sean.clj
/tmp/sean.clj:3:20: warning: unused default for binding a
yes, I just used the same args from clojure-lsp, but yeah, it's the locals that cause that
fixed. @U04V70XH6
Wow! Nice detective work!
Thanks! I should bump and release a new clojure-lsp with that fix tomorrow, then @U9A1RLFNV can bump on Calva soon ๐