Fork me on GitHub
#lsp
<
2022-09-20
>
lassemaatta05:09:05

Not sure if this is a clj-kondo or clojure-lsp question but: why can't I interact with the ns form similar to any other form? For example (in emacs) running lsp-find-references or lsp-find-definition on the ns symbol provides nothing. Also, no docstrings or anything are provided for ns (e.g. in a lsp-ui popup etc). If I navigate to clojure.core, the lens for the ns macro reports 0 references. I can create a ticket if this is not a known issue already somewhere.

ericdallo12:09:20

I think this is related to clj-kondo analysis, you can confirm that running lsp-clojure-cursor-info on the ns , it's areally helpful command to debug kondo analysis with LSP, you will see that for ns there is no analysis

✔️ 1
athomasoriginal16:09:12

I have a repo structure like this:

root
  front-end-1/
    .lsp/
    deps.edn
  front-end-2/
    .lsp/
    deps.edn
  shared-code/
    .lsp/
    deps.edn
shared-code is referenced in both front-end-1 and front-end-2 in the deps.edn file:
{:paths {shared/code {:local/root "../shared.code"}}
However, when I reference shared.code :as code in front-end-1 or front-end-2 clojure-lsp warns:
(ns my.ns
  (:require [shared.code :as code]))

(defn my-fn
   [code/fn arg]) ; unresolved var: code/fn
Any thoughts on how to resolve this? Thanks in advance!!

ericdallo16:09:32

My suggestion for deps.edn project is: • import the folder root as the project root • Add a root deps.edn with :dev alias that points to all 3 projects This is pretty similar to how clojure-lsp project is configured and it works pretty well, I suggest you use it as example: https://github.com/clojure-lsp/clojure-lsp/blob/master/deps.edn#L2-L17

ericdallo16:09:50

If you still wanna follow with your current arch, we would need to understand what project-root your editor is sending to clojure-lsp and the classpath that is returning (you can check that via server logs)

athomasoriginal17:09:38

Sweet. So, for the root lvl deps.edn file you have: when you run the project in development, do you run the aliases in the root deps.edn or move into the sub projects and run the aliases from there.

ericdallo17:09:14

if you have a deps.edn on root, clojure-lsp runs clj -Adev:test -Spath by default

athomasoriginal17:09:15

ahh, sweet. So, is your deps.edn mainly to get clojure-lsp to pickup the sub projects correctly?

ericdallo17:09:12

I think it's a good standard for any tool that relies on know what you use during development, but yeah, mainly for LSP tool

👍 1
ericdallo17:09:28

#polylith does somthing similar IIRC

athomasoriginal17:09:54

Thanks!! and I agree. For other projects I have, that's how I structure it. I was curious because it's helpful to know that we can add the top level one, but keep the others as is and just note that it's to satisfy tooling.

ericdallo18:09:10

it's possible to not require the root one, telling clojure-lsp to cd && clj -Spath via custom project-specs but IMO it's harder to do and maintain

1
skylize19:09:54

Found another Request textDocument/codeAction failed. exception in Calva. Repro: (`|` represents cursor) clojure-lsp version used: 2022.09.20-16.33.44-nightly

{:foo b|}
Type <backspace> to trigger.

pez19:09:54

Thanks for the repro! I've been getting a few of the exception pop-ups, but have failed to see a reproducible pattern. I'll be on the alert if I see something that doesn't seem to be this particular one.

ericdallo22:09:03

could you get the server log for that exception plz?

ericdallo22:09:57

Oh, I can repro it only with Calva, that's interesting it does happen on a specific case, on both editors

ericdallo22:09:15

Made a fix on master @U90R0EPHA

skylize02:09:52

👌 thanks