This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-16
Channels
- # babashka (53)
- # beginners (61)
- # biff (2)
- # cherry (15)
- # cider (28)
- # clj-kondo (17)
- # clojure (57)
- # clojure-europe (27)
- # clojure-nl (13)
- # clojure-norway (6)
- # clojure-uk (4)
- # clojurescript (30)
- # core-async (2)
- # data-science (39)
- # datomic (16)
- # docker (34)
- # emacs (4)
- # events (1)
- # figwheel-main (9)
- # guix (5)
- # hiccdown (2)
- # honeysql (5)
- # hyperfiddle (5)
- # interceptors (1)
- # jobs (2)
- # joyride (5)
- # lsp (36)
- # midje (1)
- # minimallist (1)
- # nbb (21)
- # off-topic (45)
- # polylith (42)
- # rum (1)
- # shadow-cljs (24)
- # sql (1)
- # squint (62)
- # vrac (1)
- # xtdb (6)
Here's a little tip for those working with monorepos, and using vim + coc. Ensure you set your coc.preferences.rootPatterns
correctly, otherwise the wrong project-root will be sent to clojure-lsp when determining the classpath.
"coc.preferences.rootPatterns": [
"deps.edn",
"project.clj",
".git",
".projections.json"
],
we stopped doing that manually and finding deps.edn, and just delegate to the classpath resolver tool, like lein classpath
or clj -Spath
which usually bring the expected correct classpath, but yeah, you need to setup the project root properly
Thing is, is that coc hands to clojure-lsp the project root which it believes is correct
so if you're in a monorepo, it'll walk up until it finds a .git
directory then the whole thing gets confused, as the source paths are then all set incorrectly
yeah, we have the same issue on emacs, people importing the root wrongly, this is something client should ask and handle correctly, there is nothing to be done on server side I believe :/
I am again having problems with jumpReferences
giving me hits in the target
directory on the newest version of clojure-lsp in clojurescript. This despite setting both :source-paths
and :source-paths-ignore-regex
to try to avoid this.
I went back some versions, trying both 2022.05.03-12.35.40
and 2022.06.22-14.09.50
, but they had the same problem. Version 2022.03.31-14.21.14
is working as expected (pjuh)
@U04V15CAJ reported the same https://clojurians.slack.com/archives/CPABC1H61/p1660120980660409, I still need to investigate that. @U01E4ELDYM9 Do you have any sample project where I can try?
@UKFSJSM38 first run clojure -T:build uber
to create a target dir. Then restart the project and the navigation should go to the wrong place
@U04V15CAJ done, I tested some go-to-defs and it seems to be working, do you have a example of a var you are trying to go to which goes to target?
yeah, I have the target after ran that command and going to parse-args works for me :thinking_face:
Could you check lsp-clojure-server-info
? it should print to messages buffer a edn, there you should find source-paths
This is mine:
:source-paths
["/home/greg/dev/babashka-cli/src"
"/home/greg/dev/babashka-cli/dev-resources"
"/home/greg/dev/babashka-cli/test"
"/home/greg/dev/babashka-cli/.build"]
note: clojure-lsp excluded the target source-path properlyHere is a repro for cljs (in my case using CoC and nvim):
1. clone https://github.com/sigvesn/cljs-dummy
2. start repl with clj -M:dev -m figwheel.main
, creating the target
dir in the process
3. call jumpReferences
on any of the defined functions in src/web/core.cljs
It works too for me @U01E4ELDYM9 I suspect you have the same issue borkdude is having, maybe clojure-lsp is not finding the source-paths properly, could you check what is the return of the clojure/serverInfo
command? I'm not sure how to call it from vim though, on emacs we have a function to help with that M-x lsp-clojure-server-info
It seems that source-paths in final-settings is set correctly to
'source-paths': ['/home/sigvesn/clojure/web/src'
'/home/sigvesn/clojure/web/tests'
'src'
'tests']
here is the full result of serverInfo (found using
echo CocRequest('clojure-lsp', 'clojure/serverInfo/raw')` )I gave it a try and I can't reproduce, your settings looks correct too, clojure-lsp didn't include any target folder in source-paths, so it seems something different, not sure if the client (vim) may affect that. Maybe ask if other people using vim are having the same issue with that repro?
Hi!
I'm writing a library, and clojure-lsp
gives me "unused public var" warnings for my public API namespace.
I'm curious about how other people who are writing libraries and are using clojure-lsp are doing here. Do you simply disable "unused public var" warnings for the whole namespace?
for me i'd generally have some tests which run the fns so that takes care of the warnings for me š
ahh, good point. I could consider writing some tests. That's .. yeah, I should actually do that. š
there are some ways to solve that:
ā¢ add #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
to a specific function
ā¢ Add a custom config to exclude specific ns patterns. At Nubank we use this and works pretty well for most projects, for example:
.clj-kondo/config.edn
{:linters {:clojure-lsp/unused-public-var {:exclude-regex [".+\\.server/run-dev"]}}
:config-in-ns {user {:linters {:clojure-lsp/unused-public-var {:level :off}}}}}