Fork me on GitHub

clojure-lsp Released clojure-lsp 2022.05.03-12.35.40 with mostly really important performance improvements! 🚀 • General ◦ Bump clj-kondo to 2022.04.26-20220429.192438-2. ◦ Decrease uncached startup time by 60-70%, by instructing clj-kondo to skip var definition bodies when analyzing deps. ◦ Improve speed of alias/ns completions. ◦ Change alias/ns completions to return a label that matches the input. ◦ Support sorting classes inside package imports during clean-ns. ◦ Avoid saving duplicate source-paths, not calling clj-kondo to analyze same filenames multiple times, improving startup speed. ◦ Improve progress report both on editor and CLI using new clj-kondo callback feature. • Editor ◦ Support workspace/willRenameFiles, renaming namespaces and all its references when a file is renamed. ◦ Don't save cache when classpath lookup failed. ◦ Wait for editor to apply edits before requesting cursor re-positioning. Fixes cursor positioning after drag in Calva. ◦ drag: Request edit only of changed clauses, not entire parent, reducing flicker. • CLI/API ◦ Bump lsp4clj to 0.3.0. The most important changes are performance, lots of improvements regarding completion and startup time, with @jacob.maine's help we now scan classpath way faster. We improved how clojure-lsp update the progress bar both on CLI and on editors, showing a way more precise percentage when starting server! Also, we have a long waited new feature: support for when renaming files in editor, update namespace name and all references to it! This already worked if you rename the namespace using LSP rename, but now following new LSP spec we made it work if renaming files in editor as well! This release was supported by clojurists-together gratitude

🎉 10
gratitude 1

Just tried to do a rename file with neovim and coc, it no work 😞 I see the output in that CoC is sending a workspace/willRenameFiles with the old and the new, but the response back from clojure-lsp is documentChanges [] Details in thread:


[Trace - 15:54:52] Sending request 'workspace/willRenameFiles - (8)'.
Params: {
    "files": [
            "oldUri": "file:///home/david/tmp/foo/foo.clj",
            "newUri": "file:///home/david/tmp/foo/bar.clj"

[Trace - 15:54:52] Received response 'workspace/willRenameFiles - (8)' in 2ms.
Result: {
    "documentChanges": []


the ns stays at (ns foo) with clj-kondo flagging it now as namespace does not match


are the project source-paths configured properly?


could you print your lsp server info?


from your snippet, it seems it's a temp file, not from a real project, right? if so, that's intended


a real project requires a deps.edn or project.clj?


I moved the file into src and same issue


yes, something to bring a valid classpath, please, check


also try rebooting your editor just to be sure


that it uses the new binary


I had a similar problem today, and restarting solved the issue for me


rebooting editor? You mean just exiting and coming back in again. Done that.


I've sent Eric a screen capture of what is happening.


@U11EL3P9U could you try calling LSP rename on the namespace to check if the file and references are renamed properly, this works on clojure-lsp for some time, just to make sure source-paths and everything is working as expected


Yes, that worked.


alright, let me double check creating a sample temp project like you did


it seems to work on Emacs, so maybe somthing with vim?


although, you showed server sent no data which is weird


oh, maybe a graalvm thing facepalm could you test a non graal image?


Same problemo. If okay with you, let's park this for now - I have to disappear for a bit. I'll gather some logs and post as an issue, just for reference.

👍 1

(I think it would need verification from another vim user too 🙂 )


Maybe @UMMMKKADU could help testing this as well?

Noah Bogart15:05:35

i'm also looking into this, lol, so if I find something I'll post here


Hello! I'm trying clojure-lsp on a large project and I don't think it's working... but I can't find out why 😕 It looks like references are only found for the file I'm currently in. I deleted the cache file, just in case, but it doesn't appear to have any effect.


Any suggestion what I could try next?


Definitions are also always "not found"


@frozenlock after deleting the cache you should restart your workspace in order for clojure-lsp to lint the classpath


in emacs this can be done through lsp-workspace-restart


in VSCode this is "reload window" (I think)


Yes, I called lsp-restart-workspace but it didn't work. (Still no effect)


by default clojure-lsp lints your classpath using clojure -Spath when you have a deps.edn. Does that make sense for your project?


similar for project.clj: lein classpath


Ah, probably not. It's a repo with many lein projects


You can configure the classpath cmd, but maybe @UKFSJSM38 can show you where this is


for lein, probably open each lein project as a project would be better


unless you have a project.clj on the root that bring correct classpath for all subprojects


Alas, it's just hundreds of lein projects


you could write a script that concatenates all the source paths from the sub projects and uses that as the classpath command


well, hundreds of services sounds a lot, you won't be working on those hundreds at the same time probably, I suggest you open only the project you are working


or add deps.edn files in each sub project and use local/root in your parent project


When trying with a single project, llsp always recreates the cache a the repo root, instead of the where the project.clj is located. Am I missing a config somewhere?


yep, try lsp-workspace-folders-remove and then lsp and select correct subproject


Ah yes it works!


Thanks to both of you

👍 2

For the record: In Calva it is better to stop and start the clojure-lsp server, instead of full window reload. There are commands for this, and they are also accessible from the clojure-lsp statusbar button. Maybe that is the equivalent to the lsp-workspace-restart in Emacs?


Maybe that needs a "restart clojure lsp" button


Yep, it's equivalent to that