Fork me on GitHub
#lsp
<
2023-09-25
>
lassemaatta06:09:38

Is ~/.emacs.d/workspace/.cache/ something related to lsp-mode and/or clojure-lsp? I noticed that when I navigate from my project to some library namespace, emacs opens ~/.emacs.d/workspace/.cache/some.library.ns.clj . This is fine, but if I have multiple projects open with different versions of dependencies, then ~/.emacs.d/workspace/.cache/some.library.ns.clj gets populated once and does not reflect the actual version wrt. the currently open project.

lassemaatta06:09:52

I guess this is related to lsp-clojure-workspace-cache-dir

pesterhazy08:09:03

FWIW with eglot I don't have am .emacs.d/workspace folder

ericdallo10:09:28

Yeah, that's from lsp-mode and it's a known issue, we should append the lib version in the path to avoid conflicts, meanwhile you can just delete the file when it's outdated and go to definition again to create a updated one

borkdude16:09:06

Found a renaming bug in lsp with cljc files. Could be in kondo, but I'm going to paste it here first so I don't forget (EDIT: not a clj-kondo analysis issue)

(let [instance-expr 1
      instance-expr instance-expr]
  #?(:clj [instance-expr]
     :cljs [instance-expr]))
Rename the second instance-expr in the let to instance-expr* and only the :clj branch will pick up the change

borkdude16:09:22

clj-kondo data seems correct: I get id 2 for both local usages, but only one gets renamed

$ clj-kondo --lint - --config '{:analysis {:locals true} :output {:format :edn}}' <<< '(let [instance-expr 1 instance-expr instance-expr] #?(:clj [instance-expr] :cljs [instance-expr]))' | jet -T ':analysis (select-keys [:locals :local-usages])'
{:local-usages [{:col 37,
                 :end-col 50,
                 :end-row 1,
                 :filename "<stdin>",
                 :id 1,
                 :name instance-expr,
                 :name-col 37,
                 :name-end-col 50,
                 :name-end-row 1,
                 :name-row 1,
                 :row 1}
                {:col 61,
                 :end-col 74,
                 :end-row 1,
                 :filename "<stdin>",
                 :id 2,
                 :name instance-expr,
                 :name-col 61,
                 :name-end-col 74,
                 :name-end-row 1,
                 :name-row 1,
                 :row 1}
                {:col 83,
                 :end-col 96,
                 :end-row 1,
                 :filename "<stdin>",
                 :id 2,
                 :name instance-expr,
                 :name-col 83,
                 :name-end-col 96,
                 :name-end-row 1,
                 :name-row 1,
                 :row 1}],
 :locals [{:col 7,
           :end-col 20,
           :end-row 1,
           :filename "<stdin>",
           :id 1,
           :name instance-expr,
           :row 1,
           :scope-end-col 99,
           :scope-end-row 1,
           :str "instance-expr"}
          {:col 23,
           :end-col 36,
           :end-row 1,
           :filename "<stdin>",
           :id 2,
           :name instance-expr,
           :row 1,
           :scope-end-col 99,
           :scope-end-row 1,
           :str "instance-expr"}]}

borkdude16:09:23

I'll open a github issue if you want @UKFSJSM38

ericdallo17:09:20

Yeah, please open a issue, it's a bug indeed