This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-22
Channels
- # announcements (10)
- # babashka (40)
- # beginners (192)
- # calva (9)
- # cider (2)
- # clj-kondo (9)
- # clojure (69)
- # clojure-dev (15)
- # clojure-europe (29)
- # clojure-gamedev (6)
- # clojure-italy (2)
- # clojure-nl (41)
- # clojure-spec (49)
- # clojure-uk (11)
- # clojurescript (68)
- # conjure (1)
- # cryogen (20)
- # cursive (37)
- # data-oriented-programming (10)
- # data-science (4)
- # datahike (7)
- # datomic (8)
- # depstar (14)
- # emacs (7)
- # events (2)
- # figwheel-main (1)
- # fulcro (81)
- # honeysql (22)
- # hugsql (5)
- # juxt (3)
- # leiningen (8)
- # lsp (314)
- # malli (20)
- # meander (15)
- # membrane (20)
- # mid-cities-meetup (11)
- # practicalli (2)
- # reagent (2)
- # remote-jobs (2)
- # ring-swagger (1)
- # rum (3)
- # sci (21)
- # shadow-cljs (52)
- # startup-in-a-month (1)
- # testing (9)
- # tools-deps (41)
- # vim (8)
- # xtdb (4)
Hi, is there a place to configure clojure-lsp and clj-kondo? I'm not getting all the warnings and also it doesnt look like in the docs.
Another quick question, do I need company-lsp? In the https://emacs-lsp.github.io/lsp-mode/ I read it was no longer supported. https://clojure-lsp.github.io/clojure-lsp/clients/ it recommends it.
I'm still having some problems with clj-kondo and lsp.
I have an example file with 1 error and 3 warnings.
I manually run clj-kondo
which gets the config that I placed in ~/.clj-kondo/config.edn
on that file and I get the 3 warnings and the error.
When I open that example.clj file with emacs and lsp, I'm only getting 3 warnings and no errors.
$ clj-kondo --lint example.clj
example.clj:4:5: warning: Unsorted namespace: clojure.set
example.clj:4:5: warning: namespace clojure.set is required but never used
example.clj:11:12: warning: unused binding x
example.clj:15:3: error: clojure.string/join is called with 0 args but expects 1 or 2
linting took 12ms, errors: 1, warnings: 3
My clj-kondo config looks like this:
{:skip-comments true
:linters {:unused-namespace {:exclude [clojure.test.check]}
:unused-referred-var {:exclude {clojure.test [is deftest testing]}}
:unsorted-required-namespaces {:level :warning}} }
This is what I have in my init.el:
(use-package lsp-mode
:ensure t
:hook ((clojure-mode . lsp)
(clojurec-mode . lsp)
(clojurescript-mode . lsp))
:config
;; add paths to your local installation of project mgmt tools, like lein
(setenv "PATH" (concat
"/usr/local/bin" path-separator
(getenv "PATH")))
(dolist (m '(clojure-mode
clojurec-mode
clojurescript-mode
clojurex-mode))
(add-to-list 'lsp-language-id-configuration `(,m . "clojure")))
(setq lsp-clojure-server-command '("bash" "-c" "clojure-lsp"))
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024))
(setq lsp-completion-provider :capf)
(setq lsp-headerline-breadcrumb-enable nil))
Previously I was using flycheck-clj-kondo
but I removed it. When I had`flycheck-clj-kondo`
and lsp-mode
at the same time I saw the 3 warnings and 1 error for 1 or 2 seconds until lsp-mode connected to the clojure-lsp server. When it connected, lsp-mode
overrode the error.
And emacs shows the example file like this:This is my ~/.lsp/config.edn
{
:auto-add-ns-to-new-files? true
:semantic-tokens? true
}
but as you can see in the screenshot I sent before, comment isn't colored. It gets colored once I turn on cider and eval the buffer.thanks @ericdallo for all of your work. the new github pages layout, the emacs guide, and all of the support I’ve seen in this channel are much appreciated

If you experience slowness in clojure-lsp with emacs, consider bumping company-idle-delay
to a positive non-zero value
Another thing that maybe can help is increase the company-min-length too Also I'll improve 0 length completion peerformance on clojure-lsp
I tend to abuse the 0 min-length completion in Typescript 😅 to see which exports a module has 😅
Yeah, that feature added this performance issue haha we can improve the results to show more important items and discard others
Oh right, yea I can imagine how much more inefficient it can get with everything showing up as a candidate. Is it possible to asynchronously load the candidates in chunks? Not sure how TS LSP does it but I'm willing to bet they do something like this
we can certainly improve some things like don't return the docs for all items and use resolveItem LSP method
BTW @U04V15CAJ just FYI, doom-emacs default of company-idle-delay is 0.5 and the company package default is 0.2
resolveItem
= only return candidates that fit the current context?
> Emacs is single thread in the end
The comm with the LSP server is done async, right? So do you mean, the inefficiency is from Emacs rendering the candidates? (I'm just guessing)
There is https://github.com/emacs-ng/emacs-ng in rust, that make emacs use js and is 30x better in performance 🙂
Oh yea. Is this backwards-compatible with Elisp packages?
> Oh yea. Is this backwards-compatible with Elisp packages? I think so 😅 > The comm with the LSP server is done async, right? So do you mean, the inefficiency is from Emacs rendering the candidates? (I'm just guessing) (edited) I don't know that much about client completion, but the size of json matters a lot, but yeah, completion performance on emacs is worst than vscode for example AFAIK
Right
Oh wait, emacs-ng is not the rust port of emacs. You're probably talking about remacs
. Seems like emacs-ng
is from the native-comp branch that supports Deno (Typescript) for writing packages
Oh right, I see a rust_src
dir, yea
Can we support other languages like Clojure too maybe via a running JVM server or possibly babashka? Is this emacs-ng extensible?
yeah, probably 🙂 This is the maintainers channel: https://gitter.im/emacsng/community
@U04V15CAJ @UR37CBF8D do you see any items from this "All completions items" that we could remove from the 0 length completion? https://pastebin.com/U4zH4jYD
There are, clojure.core symbols, java.lang and util symbols, other ns symbols, current ns symbols
@ericdallo When I type 1s, why would lsp be interested in symbols not starting with 1 at all?
If I don't get any completions for 1s, why did it make the request and why did it take so long?
I can see a bunch of keyword labels like these: Are these meant to be candidates?
(I have to sleep now, past midnight here in Aus 😴 )
They are from the clj-kondo (the project I was testing it), I think makes sense to keep it
Also the response size is not big, I'll let remove completion items as a last resource if needed
@ericdallo When do you get all these completions, out of the blue without a context (a starting letter, for example)?
when I just hit C-SPC
in the start of a line (to get all completion items, without any prefix)
When I have lsp enabled in emacs, using clojure-lsp, the editor slows to a crawl, forward-char, backward-char, previous-line and next-line take about a second to run. Is this normal?
oh the company-idle-delay? Thanks
Yes @danieleneal, Also I'm improving that on clojure-lsp side, soon changing that setting will not be necessary anymore
great, thanks 🙂
when I use cider alone, in addition to the function name I also have the required arguments
Just trying out Doom Emacs with clojure-lsp and having some trouble with autocompletion hints. It doesn't seem to work on expanding ns aliases unless I type some standard form first (like defn
). But then it still isn't working for deps that are in an extra deps.edn alias. For example, [datomic.dev-local :as dev-local]
in a :dev alias. Typing "(dev-local)" doesn't show any hints. Running the actual code works with dev-local as intended.
It appears my .lsp/config.edn in the project root is being ignored.
Checked them and there's nothing indicating an issue
Ok so I checked lsp-clojure-server-info
and there is :project-settings, which shows what I have and :client-settings, which does not include my alias and :project-specs is nil
so, let me see if I understand your issue, you have a deps in your deps.edn in a custom alias, and the completion feature doesn't show the completion for that deps, right?
Right
these are the defaults https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/crawler.clj#L53-L60
if you need a different classpath different from clojure -Spath
, then you need to configure the project-spec
I have
:project-specs [{:project-path "deps.edn"
:classpath-cmd ["clj" "-A:dev" "-Spath"]}]
Running that command manually shows the correct path
But it seems to be using the settings in :client-settings vs :project-settings
It shows the same output in the server info and still doesn't work
the :client-settings are settings sent from emacs, your config should be in :project-settings
Recreated the sqlite db and no change
My config is in :project-settings, but it's not being applied
This project is early on
I just installed Doom Emacs today
So how do you include additional aliases?
But how do you personally do it?
So how do you handle per-project aliases?
You include dev deps with prod deps?
:dev {:extra-paths ["dev"]
:extra-deps {com.datomic/dev-local {:mvn/version "0.9.225"}
org.clojure/tools.namespace {:mvn/version "1.1.0"}}}
Right
Oddly enough moving dev-local to main deps still doesn't work
What is your config?
sample-project/.lsp/config.edn
{:project-specs [{:project-path "deps.edn"
:classpath-cmd ["clj" "-A:dev" "-Spath"]}]}
sample-project/deps.edn
{:deps {org.clojure/clojure {:mvn/version "1.10.2"}}
:paths ["src" "resource"]
:aliases {:dev {:extra-paths ["dev"]
:extra-deps {org.clojure/tools.namespace {:mvn/version "1.1.0"}}}}}
and when I require [clojure.tools.namespace.file :as tools.ns]
and try to complete tools.ns/
I get the results
I tried that already. And .clj-kondo doesn't exist
Ok, so when require the tools.namespace.repl with an alias it does work. But typing out the FQDN doesn't
1.10.2
2021.02.21-21.02.51
Doesn't exist
do you have any clj-kondo
config in your home or something that could mess with that?
Type out the FQDN and autocomplete doesn't work
So like clojure.tools.namespace.repl
.repl/, but yes
yeah, we don't support that ATM, and it should not be hard to implement it, please open a feature request issue, sorry for the bad comumnication 🙂
Hmm, ok. That's a significant missing piece since there are times to prefer the FQDN
But I still can't get dev-local to work
But the code itself runs normal
com.datomic/dev-local
That one is a bit more complicated because you have to have a mvn config for the repo
My dev helper code is in dev and the main stuff is in src
It's free to use, but you still have to sign up for access
What disables being able to insert spaces?
we could check the transit file, like this for example:
project/.clj-kondo/.cache/2021.02.14-SNAPSHOT/clj/clojure.tools.namespace.file.transit.json
So I don't know why that dir doesn't exist
I have clj-kondo installed
I uninstalled the system clj-kondo and no difference
it should not make any difference indeed, but any ~/.clj-kondo/config.edn
or something like that changing the cache dir can cause a issue
That file doesn't exist either
yeah, that's sad. Please open an issue following the issue template, it'd be good to use a external deps easy to debug and a minimal project with all those files configured if you don't mind
I also can't get REBL to work with Doom either so this is looking less appealing as I go
lsp is working for deps other than dev-local
It works fine in Cursive
Including autocompleting dev-local
I like Cursive a lot. I just wanted to see what this side looked like. I don't know how it's so popular with how much trouble it is to get right
But not really. Even with the regular alias deps it was inconsistent in autocompleting
What I don't understand is that the jar is in my .m2/repository for dev-local so Cursive can scan it fine. I don't know why clojure-lsp is having this trouble
The autocomplete wouldn't always work for the working completions. Sometimes nothing would show up and just deleting the text repeatedly it would sometimes work
But if I grabbed the latest doom emacs and simply enabled clojure and lsp then there shouldn't be an issue
Exactly. And it does show up in the -Spath
And Cursive reads it fine
But you can easily sign up for datomic dev-local and grab the jar yourself. It's just an email sign-up and .m2/settings.xml credentials given
Oh, check if kondo recognizes the namespace, hover under the datomic.dev require and call lsp-clojure-cursor-info
Nope. And thus going to definition also doesn't work
I honestly wonder if it's an issue with the hyphen
None of my other deps have one to test
Wait, yes there is one. com.datomic/client-cloud
And that one autocompletes and goes to definition
Hold on. I'm derping. I'm thinking of the on-prem dev tools. dev-local is just a regular dep: https://docs.datomic.com/cloud/dev-local.html#using
So you can pull that and test
I'm also noticing that enabling parinfer makes lsp not start automatically. And it doesn't work either
I'm getting:
Could not find artifact com.datomic:dev-local:jar:0.9.225 in central ( )
when add that datomic depsWhat is the dep config you have?
Oh, missed the bit at the top. You do have to sign up for it after all: https://cognitect.com/dev-tools
But still just an email sign-up
{:deps {org.clojure/clojure {:mvn/version "1.10.2"}}
:paths ["src" "resource"]
:aliases {:dev {:extra-paths ["dev"]
:extra-deps {com.datomic/dev-local {:mvn/version "0.9.225"}
org.clojure/tools.namespace {:mvn/version "1.1.0"}}}}}
But once it gets used it does get added to .m2/repository
Follow the link
That's datomic.client.api. That one works for me
We're talking about com.datomic/dev-local
I know I'm brand new to Doom, but I didn't think it was my setup
you can confirm that if you hover over the namespace require and call lsp-clojure-cursor-info
Right, I mentioned that earlier
And doesn't on datomic.client.api
And datomic-cloud comes from an S3 bucket so that's external too
Yeah, still curious why mine isn't caching
I'm in Arch Linux
I looked at Nix, but couldn't move forward with the fact that packages have to be built on your machine or they won't work. I love the declarative aspect of it though
Yeah, that's nice. I just like being able to use pre-built binaries for certain things
I've been on Arch for over 15 years. Have looked around, but nothing was compelling enough to leave. The AUR and ABS are very convenient for when I need something that isn't in the main repos or needs to be tweaked or I can update it before the official maintainers.
So, I'm trying to use clj-kondo via terminal to lint the classpath and check if it is a issue there
So read the readme for clj-kondo and it mentions that you have to create the .clj-kondo/. I created it in the project and now there is a cache
That didn't change the behavior though
I created the full cache from the classpath and it shows up in the cache
try call clj-kondo --lint /tmp/foo.clj --config '{:output {:analysis true :format :edn}}'
to get clj-kondo analysis
I don't see anything odd in it
Oh, we should call differently, we need to pass the classpath instead of a folder, or pass the path to the datomic.dev-local jar/file
Something like:
clj -Sdeps '{:deps {clj-kondo {:mvn/version "2021.02.14-20210218.170309-6"}}}' -m clj-kondo.main --config '{:output {:analysis true :format :json}}' --lint "~/.m2/repository/com/datomic/dev-local/0.9.225/dev-local-0.9.225.jar:datomic/dev_local.clj" |jq .
Oh, I see. It makes sense for them to do it that way though
Again, Cursive does it so there is a way to do it.
I can test that
It works without the REPL
I wouldn't know. I haven't used the tool directly before today
I do know that IntelliJ can decompile class files so they might be leveraging that.
@U04V15CAJ Can you help us?
TL DR: clj-kondo analysis doesn't work with jars that don't have the source code, like datomic.dev-local
, so clojure-lsp completion doesn't work for that, Is there any way to get that working?
Cursive somehow works without a REPL
Yes, it could be that @U01NYKKE69G
Thanks for confirming, but that really puts a damper on using it for me
:/ I'm sorry, I can't see a easier way to fix that, only using cider probably you will get that completion
I couldn't get it to work there either
The code itself runs fine, but the completion doesn't work
yeah, not sure Cider completion doesn't work for jars without source code, I suggest you ask in #emacs
hey all! thanks so much for making clojure-lsp
, it's wonderful
is there a way to turn off tooltips/intellisense on words in strings?
thank you! What editor are you using? tooltips/intellisense you mean the diagnostics/lint?
sorry, the pop-up window that displays function argument lists and docstrings. i use vim 8.1 and coc.nvim
as you can see, it's suggesting apply
even tho I'm in the middle of typing applicable
lol
We implemente support for signatureHelp on latest release, probably now it's enable by default on vim
you need to disable on your vim LSP client, maybe @dharrigan knows how to do that, I'm a user 😛