This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-15
Channels
- # aleph (1)
- # announcements (7)
- # beginners (6)
- # calva (24)
- # cider (18)
- # clj-otel (1)
- # clojars (8)
- # clojure (22)
- # clojure-dev (11)
- # clojure-europe (52)
- # clojure-finland (12)
- # clojure-nl (1)
- # clojure-norway (28)
- # clojure-uk (7)
- # clojured (1)
- # cursive (6)
- # datomic (1)
- # events (1)
- # humbleui (41)
- # hyperfiddle (75)
- # lsp (46)
- # malli (34)
- # matrix (1)
- # off-topic (16)
- # releases (1)
- # shadow-cljs (12)
- # squint (11)
- # timbre (1)
- # tools-deps (24)
Does clojure-lsp have an option to use Sierra style imports?
- [org.eclipse.jetty.server Server]
+ (org.eclipse.jetty.server Server)
"Change coll to list" code action?
afaik there is no such option. but it should be easy to add one for clean-ns https://github.com/clojure-lsp/clojure-lsp/blob/master/lib/src/clojure_lsp/feature/clean_ns.clj#L432 btw, why do you prefer lists over vectors here?
It's classic https://stuartsierra.com/2016/clojure-how-to-ns.html style and a variety of tools have support for it
We had some thread on this channel discussing that, would be nice if we could follow some standard instead of supporting both, and in the thread we discussed about [
would be preferable over (
, I can't find it tho
I also remember seeing Alex Miller talk about his personal preferences to [
but it wasn't in the form of "standard"
However there's that Sierra standard that many teams have chosen to follow, and compatible tooling. Allow me to say, its it really tools' choice to change the course of what is considered prefered? Especially when other tools favor something else - it seems to me that having choice doesn't hurt anyone and avoids any possible form of tension, so to speak.
Yeah, I prefer to have a standard, but I agree it's something not easy to enforce or our responsibility
Ironically, I cannot enforce either what clojure-lsp should do š Suffice to say it would solve day-to-day problems at work - I'd greatly appreciate it And of course anything we can do cider-side to make life easier to you folks, would be done as well
(Speaking of, I'm reworking our cljfmt integration - should be 1:1 compatible with clojure-lsp)
Cool, glad to know :) Feel free to post a issue about supporting the sierra standard optionally
Hello, I think I found a bug related to code actions when java imports are involved. Steps to reproduce: ā¢ assume following ns declaration:
(ns my.namespace
(:import [java.awt.event ActionEvent]))
ā¢ write down Robot.
constructor:
(def robot (Robot.))
ā¢ execute code action which suggests importing java.awt.Robot
, the resulting namespace declaration becomes broken:
(ns my.namespace
(:import [[java.awt Robot event] ActionEvent]))
Shall I create gh issue for that?yeah, it seems to happen on some classes only :thinking_face: , but please open a issue, I can repro that
I discovered that it happens when the path is already reused by another import declaratin, e.g. java.awt.event
and we are importing new class with a subpath java.awt
so it drops event
Hi, I've tested new lsp build: https://github.com/clojure-lsp/clojure-lsp-dev-builds/releases/download/2024.01.15-12.02.49-nightly/clojure-lsp-native-macos-aarch64.zip for mac aarch I've found a new issue (regression that when I rename the fn with lsp-rename it doesn't refresh it's state, so the highlight stay on the previous length of the name and references are kept on old name (so rename results in 0 references) and to refresh the state lsp-restart-workspace is needed Described here in more detail: https://github.com/clojure-lsp/clojure-lsp/issues/1755#issue-2082066732
But the good news is @UKFSJSM38 that your update on renaming namespaces is working well!
@U0281QDFE1X thanks, is that only related to code lens, or find-references become a problem as well?
So for lsp-find-references Directly after lsp-rename it works, but after I run "lsp" it doesn't. Previously it was opposite way, so if I've run lsp-rename, find-refences won't work unless I would run "lsp" So hard to answer directly with yes/no because I have this case with lsp-rename that it won't take effect if I don't do "lsp" in that namespace, e.g. if I do lsp-rename namespace, it works correctly in terms of rename, but for lsp to not highilight me it on red or to find references I need to run lsp. And it was a case for some other commands/workflow with lsp, so now I have muscle memory to often run "lsp". I'm not sure if that's intended part of workflow with clojure-lsp or if it should be reported
That's odd, I'll try to repro what you mentioned later today, but it's supposed to work without any extra lsp
command
So in that case, running lsp-rename
on namespace requires lsp
afterwards to find refernces, running lsp-rename
on function don't require it, but after running lsp
it won't find references anymore
that is sounding like a lsp-mode bug, one easy way to confirm that is try to repro on Calva vscode
Can someone tell me how to set up initializationOptions:
for a given server? I think I did learn this before, but I can't figure it out anymore. Basically, I want to set up options for fennel-ls server, like explained here: https://sr.ht/~xerool/fennel-ls. Ideally, I want to be able to use different settings for each project.
Set up where? If you wanna understand how and where in the protocol you should pass it, the clojure-lsp integration tests help a lot understand that
If so: https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-clojure.el#L574C16-L574C16
yes, so I set up lsp client for Fennel, it works, but now, I want to be able to change its settings. See, here https://sr.ht/~xerool/fennel-ls/#default-settings I want to set "extra-globals"
Wrong link: https://github.com/emacs-lsp/lsp-mode/blob/master/clients%2Flsp-clojure.el#L574
Would be nice if I could do it per project, but if it's global, well, for now it would be fine
What do you mean it's not possible? We're talking about Emacs here. Everything is possible. It's just the matter of how crazy you are, that's all š
But, you can even extend lsp-mode functions via elisp so it's possible as well but maybe not a good idea haha
I dunno, sounds pretty straightforward. In theory that is, at least. You'd just eval some shit in .dir-locals.el, that calls (lsp-register-client
on some hook, I dunno. Good... bad.. if it works... who cares, right?
And hey, :initialization-options is actually a function... I can slurp some fennel-ls.cfg, or something from the project root.
Goddammit... I just wanted seemingly simple fokkin ting... and now I have this whole yak to shave... I hate myself sometimes...
Here you go (if anyone needs it):
(defun fennel-ls-init-options ()
(let* ((lsp-cfg-dir (concat (projectile-project-root) "/.lsp/"))
(cfg-file (expand-file-name "fennel-ls.json" lsp-cfg-dir))
(json-object-type 'plist))
(when (file-exists-p cfg-file)
(json-read-file cfg-file))))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection "fennel-ls")
:activation-fn (lsp-activate-on "fennel")
:server-id 'fennel-ls
:initialization-options #'fennel-ls-init-options))
and in the project root:
.lsp/fennel-ls.json:
{
"fennel-ls": {
"checks": {
"unused-definition": true,
"unknown-module-field": true
},
"extra-globals": "awesome mapcat"
}
}