Fork me on GitHub

clojure-lsp Released clojure-lsp with a lot of performance improvements and some new features! • General ◦ Use `:source-aliases` setting during default deps.edn and lein project-spec aliases, avoiding the need to configure a whole project-spec just because of a additional alias. ◦ Exclude from unused-public-var linter vars with metadata `^:export`. ◦ Fix clean-ns multiple refers sort when there is a alias before the refers. ◦ Bump clj-kondo from `2022.01.15` to `2022.02.09` adding support for implementation analysis and more improvements. ◦ Medium performance improvement during startup when unused-public-var linter is disabled. ◦ Medium performance improvement during startup on unused-public-var calculation parallelizing calculations. ◦ Small performance improvement on code actions calcullation. ◦ Add `:use-source-paths-from-classpath` setting defaulting to true, which makes clojure-lsp do not manually discovery source-paths but get from classpath excluding jar files and paths outside project-root. ◦ Improve completion performance when all clojure.core or cljs.core symbols are valid completions. ◦ Fix scenarios where the lint findings in individual files differed from what you'd expect based on the .clj-kondo/config.edn settings. ◦ Add `:exclude-regex` and `:exclude-when-definted-by-regex` to `:clojure-lsp/unused-public-var` linter. ◦ Bump `org.clojure/clojure` to `1.11.0-rc1`. • Editor ◦ Fix exception during code actions calculation when in a invalid code of a map with not even key-pairs. ◦ Don't return diagnostics for external files like files on jar dependencies, avoiding noise on lint when opening dependencies. ◦ Support finding implementations of defprotocol and references of defrecord/deftype, implementing LSP method `textDocument/implementation`. ◦ Make the actions and commands aware of when they were invoked from comments or whitespace. This will allow individual refactorings to be more deliberate about how they handle comments and whitespace. ◦ Correctly position the cursor after calling move-coll-entry-down on an entry with leading comments. ◦ Don't return completions when invoked from a comment, avoiding performance problems. ◦ Fix small anomalies in parameter names of extracted private functions. ◦ Add semantic tokens for protocol implementations methods like defrecord and deftype. ◦ Small performance improvevement on code lens calculation using transducers. • API/CLI ◦ Small performance improvement to `format`, `clean-ns`, `diagnostics`, and `rename` via parallelizing parts of the logic. ◦ Fix edn->json parser of `serverInfo/raw` for Calva use cljfmt configuration. ◦ Add `:cljfmt-raw` config to `serverInfo/raw` for Calva. ◦ Add support for passing specific `--filenames` for most actions. Main highlights: The focus of this release was to make clojure-lsp faster on a lot of places, especially on the post-startup time, which stands for the time clojure-lsp analyzed whole project with clj-kondo default linters but is yet linting whole project for unused-public-vars and looking for test trees. 🚀 We did lots of completion and code actions performance improvements thanks to @jacob.maine which did a great help on that! 👏 Following @borkdude suggestion, clojure-lsp by default now check source-paths from the classpath string and not manually checking your project deps file, this should decrease a lot the false-positives of wrong source-paths, especially for lein/deps mono-repo projects! Check more details 🏁 And at least but not last, we now have support for finding implementations of defprotocols following LSP spec and with the help of clj-kondo 🎉 check the gif for a example This release was supported by clojurists-together gratitude Thank you for the new gold sponsor 🧡

🎉 15
clojurists-together 6
❤️ 3

Regarding the source path change, looks like :use-source-paths-from-classpath breaks :ignore-classpath-directories ? I’d set :ignore-classpath-directories to false in one of my projects, and the latest release shows references from my resources/ directory as :use-source-paths-from-classpath is set to true by default. No biggie as I can just set :use-source-paths-from-classpath to false , but I thought I’d ask if this was intended. As in, would :ignore-classpath-directories be replaced by :use-source-paths-from-classpath at some point?


Yes, unfortunately there is no way to differ the "target" dirs from a dir on the classpath AFAIK, so for those cases disabling this new flag is probably needed


@U0WKCCE3S actually we could check for :ignore-classpath-directories when checking the source-paths, I think that could work, do you have a sample project where I could test it these changes?


The ignore-classpath-directories is a obscure flag I'd like to improve/make it smarter somehow, so I feel we have room to improve here


I used a boilerplate CLJS project and lein with :source-paths. No :source-aliases in project.clj though. The exact issue I was having was that files in resources/public/js were getting picked up as duplicate references.


Hmmm can :ignore-classpath-directories be used to drive :use-source-paths-from-classpath? It looks like :use-source-paths-from-classpath overrides :ignore-classpath-directories right now.


yes, ATM :use-source-paths-from-classpath is not overriding but causing clojure-lsp to consider the paths which were ignored by :ignore-classpath-directories at some other point of the code, Threrefore "ignoring" the flag. I think we can check for :ignore-classpath-directories after checking :use-source-paths-from-classpath` to keep the old behavior, but as I'm not a heavy cljs user I always have issues trying to repro ignore-classpath-directories cases, that's why I asked for a sample repro 😅


Ah right! I’ll create a public repo then, as I was using a private repo with limited sharing.


Perfect, that should help a lot!

👍 1
Lukas Domagala12:03:57

@UKFSJSM38 I’m having this problem in the clojure-lsp repo 😅 cli/target/classes/clojure_lsp is showing up as references. I’m a little confused as to which flag I’d need to stop this from happening


hum, it should not happen on clojure-lsp repo


we need to make sure that always happen and fix it

Lukas Domagala13:03:44

I can create an issue if you want. To repro I just open the repo calva after running make


yeah, lets start with an issue, we should try to avoid considering those folders

👍 1