This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-18
Channels
- # announcements (6)
- # babashka (137)
- # beginners (115)
- # biff (4)
- # calva (24)
- # cider (1)
- # clj-kondo (15)
- # cljs-dev (18)
- # cljsrn (1)
- # clojure (43)
- # clojure-australia (1)
- # clojure-europe (11)
- # clojure-germany (3)
- # clojure-nl (3)
- # clojure-spec (40)
- # clojure-uk (6)
- # clojured (1)
- # clojurescript (24)
- # code-reviews (14)
- # core-logic (5)
- # cursive (24)
- # datahike (2)
- # datomic (3)
- # deps-new (9)
- # events (5)
- # figwheel-main (1)
- # fulcro (7)
- # helix (3)
- # honeysql (8)
- # jobs (4)
- # jobs-discuss (7)
- # lsp (59)
- # malli (9)
- # mid-cities-meetup (1)
- # nrepl (2)
- # off-topic (27)
- # portal (11)
- # re-frame (16)
- # reitit (1)
- # releases (12)
- # remote-jobs (4)
- # shadow-cljs (48)
- # spacemacs (1)
- # vim (9)
- # xtdb (14)
Hi!
In Emacs when I create a clojurescript file some_name.cljs
, cider and lsp are adding the namespace like this:
(ns some-name)(ns some-name)
if I recall correctly there was an option to prevent this from happening but I can't find it, anyone remembers which was it? I'll keep searching in the meantime.
Doesn't seem so. This is the code:
(defun cljr--clojure-ish-filename-p (file-name)
(or (string-suffix-p ".clj" file-name)
(string-suffix-p ".cljs" file-name)
(string-suffix-p ".cljx" file-name)
(string-suffix-p ".cljc" file-name)))
(defun cljr--add-ns-if-blank-clj-file ()
(ignore-errors
(when (and cljr-add-ns-to-blank-clj-files
(cljr--clojure-ish-filename-p (buffer-file-name))
(= (point-min) (point-max)))
(insert (format "(ns %s)\n\n" (cider-expected-ns)))
(when (cljr--in-tests-p)
(cljr--add-test-declarations)))))
If I enable clj refactor:
(ns app.components.aaaa.pepe)
(ns app.components.aaaa.pepe)(ns app.components.aaaa.pepe)
Yeah, I would disable on cljr since I know how clojure-lsp handles it, but it's your choice
Can you check if this problem happens in cljs files? In the buffer message I see:
LSP :: Connected to [clojure-lsp:405252]. [2 times]
LSP :: Applying 1 edits to `fd.cljs' ...
Applying 1 edits to `fd.cljs' ...done
LSP :: Applying 1 edits to `fd.cljs' ...
Applying 1 edits to `fd.cljs' ...done
I was wrong, the problem still persists.
I created a project using npx create-cljs-app
, then I ran cider-jack-in-cljs
-> shadow -> :app
Then I created a file reagent_components.cljs
The result was:
(ns reagent-component)(ns reagent-component)(ns reagent-component)(ns reagent-component)
This was in m *Messages*
buffer
(New file)
LSP :: Connected to [clojure-lsp:24277]. [2 times]
LSP :: Applying 1 edits to `reagent_components.cljs' ...
Applying 1 edits to `reagent_components.cljs' ...done
LSP :: Applying 1 edits to `reagent_components.cljs' ...
Applying 1 edits to `reagent_components.cljs' ...done
LSP :: Applying 1 edits to `reagent_components.cljs' ...
Applying 1 edits to `reagent_components.cljs' ...done
LSP :: Applying 1 edits to `reagent_components.cljs' ...
Applying 1 edits to `reagent_components.cljs' ...done
cljr-add-ns-to-blank-clj-files
is nil
and this is my ~/.lsp/config.edn
{
:auto-add-ns-to-new-files? true
:semantic-tokens? false
}
No that's absolutely odd multiple process running. Could you try killing all process and start the project again?
Sorry I was afk! Yes, there are multiple processes alive. In the lsp-describe-session buffer everything seems fine.
Hi @UKFSJSM38, I’m seeing the same symptom (multiple ns
forms inserted by LSP):
LSP :: Connected to [clojure-lsp:99779].
LSP :: Applying 1 edits to `scratch.clj' ...
Applying 1 edits to `scratch.clj' ...done
LSP :: Applying 1 edits to `scratch.clj' ...
Applying 1 edits to `scratch.clj' ...done
I don’t have multiple LSP processes running, however.
that's probably not a clojure-lsp issue, but a lsp-mode one, you have probably multiple project roots or something like that running...
please, create a issue with minimal code as minimal as you can that repro the issue
Hm, I have a single clojure-lsp
process; not multiple. 🙂
I have a single project active and the root for that is correct (from lsp-describe-session
).
Is there a way to ascertain “multiple project roots”.
I think that's enough, that's why a minimal repro could help understand if it's some bug or some wrong configuration
also, please test it with https://github.com/emacs-lsp/lsp-mode/blob/master/scripts/lsp-start-plain.el to make sure it s not a issue with your emacs
Sure; I can try creating an issue but I’m hoping that we can determine which repo to create it under. (`lsp-mode` or clojure-lsp
)
you can start on clojure-lsp, if we prove is not a bug on the server, then you can open on lsp-mode
With newest update I started to notice on hover a popup with docstring. And Im failing to find a way to disable that. Am I missing a setting to do so?
yeah it looks like it was on in a buffer
hmm I guess I will take a look at my config
I also updated doom maybe I blamed the wrong thing for it
thanks Eric, figured it out 🙂
I just disabled the lsp-ui-doc-mode 🙂
There is currently an experimental setup possible for getting clojure-lsp support in babashka scripts: https://github.com/babashka/babashka/issues/733#issue-811939787 Feel free to give it a try and suggest improvements.