Fork me on GitHub

clojure-lsp We now have a Github Sponsors profile page 🙂

metal 9

When running clojure-lsp and a REPL in Emacs (27), creating a new file automatically adds the namespace of that file twice. Is this a known feature and any suggestions about avoiding this? I've tried this on a Clojure as well as a ClojureScript project, both running Clojure CLI tools (although I doubt that makes a difference) I usually have the REPL running most of the time, so my default approach would just be to switch this feature off in the LSP config.


This is a known conflict of clojure-lsp with clj-refactor, you can avoid it disabling one of them, like said here: on *Conflict with clj-refactor when creating new files*


I suggest disabling on clj-refactor as the clojure-lsp doesn't need a REPL for that feature 🙂


Hmm, I am not (knowingly) running clj-refactor and havent done for a while. I wonder if its crept in somewhere. I certainly dont have clj-refactor in my deps.edn file or in any of the aliases I use to run the repl process on the command line. Maybe something has changed in the Cider middleware and that is pulling it in, but that seems unlikely.


clj-refactor is a emacs package


Using this config from the lsp docs didnt make any difference even after reboot 😞

(setq cljr-add-ns-to-blank-clj-files nil)


Hum, odd, let me double check


I confirmed this issue, probably cider or clj-refactor or something changed that is causing that, I'll take a closer look


I've explicitly set clj-refactor to not be included as a package. Used the setting above too. I still get the same error, even without the REPL running... must be something else causing it. I'll try disable lsp with that config and see if it still does that


it seems a lsp-mode bug sending didOpen request twice, I'll check with lsp-mdoe folks but I'll do a fix on clojure-lsp to be idempotent as well

👍 6

@U05254DQM fixed on master on lsp-mode, I should release a fix for clojure-lsp in next release, thanks for the report

👏 6