This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-08
Channels
- # aleph (9)
- # announcements (42)
- # babashka (13)
- # babashka-sci-dev (9)
- # beginners (38)
- # biff (1)
- # calva (4)
- # cider (5)
- # clj-kondo (39)
- # cljdoc (4)
- # cljsrn (3)
- # clojure (93)
- # clojure-bay-area (1)
- # clojure-czech (1)
- # clojure-dev (4)
- # clojure-europe (65)
- # clojure-finland (3)
- # clojure-nl (2)
- # clojure-norway (7)
- # clojure-portugal (1)
- # clojure-uk (2)
- # clojurescript (73)
- # cloverage (1)
- # cursive (5)
- # data-science (1)
- # datahike (22)
- # emacs (51)
- # graalvm (6)
- # introduce-yourself (8)
- # jobs-discuss (14)
- # kaocha (6)
- # mount (5)
- # nbb (19)
- # off-topic (19)
- # reagent (5)
- # releases (1)
- # sci (19)
- # scittle (4)
- # shadow-cljs (6)
- # tools-deps (9)
- # xtdb (2)
I have a buffer that is constantly hanging emacs. When I toggle-debug-on-quit
and C-g
during the hang, I get this backtrace.
I suspect the problem is related to the fact that I am using local vars named comment
(shadowing clojure.core/comment).
Based off this backtrace can anyone point me in the direction of which project I should report this to? (FWIW I'm using latest doom emacs)
One thing is check if clojure-toplevel-inside-comment-form
is t
. Try setting it to nil
and seeing if that helps
I think this could be the “top of defun” feature is breaking with the overload of comment
i'm not sure where the markdown is coming from 😕 aside from the fact that the doom markdown package is enabled. not sure why it's running in my clojure-mode though
the root of your stacktrace says lsp-fontlock. you might want to disable it. CIDER already provides sweet font-locking which is not exclusive at all with clojure-lsp
https://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html syntax highlighting basically
I suspect this might be related to lsp ui? Maybe the doc popups? Perhaps it grabs the source and puts it inside of a markdown string and renders that?
Not really, it's a lsp-mode core feature, that when hovering in a element, it shows the docs of the symbol, so we font-lock the clojure code
but it's wrapped in markdown (as seen in the stacktrace), surely that makes it unparsable to clojure-mode
ignore what - arbitrary markdown syntax? seems an odd requirement :thinking_face: I'm hypothesizing about how this stuff works, just by judging the stacktrace, but if markdown is passed to clojure-mode, better to strip the markdown delimiters beforehand
Explaining better the feature:
• client requests information about the symbol, docs, clojure code example etc via lsp hover
request
• server response with custom markdown showing all the docs + clojure code as a string.
• client(Emacs) just delegate to the major mode to apply font locking on what is inside the clojure
markdown, but AFAIK it should not send markdown to clojure-mode
checking out the stacktrace again, the string starts with comment
not (comment
that's the issue - unbalanced parentheses (either on the buffer itself, or due to some bug in the responsible code)
I think it's expected to have invalid code all the time while developing, shouldn' t clojure-mode handle that better?
depends on the definition of invalid code you should have balanced parentheses 99% of the time which emacs makes really easy although it is to be confirmed that @U70QFSCG2’s buffer actually has unbalanced parentheses
I think we should not expect user has a paren tool or something like that, at least o clojure-lsp, clj-kondo we always need to handle invalid code which is more common that we think
So no.. there aren't unbalanced parens in this case (though it can happen if you paste in text containing unbalanced parens, but that wasn't the case here)
> One thing is check if clojure-toplevel-inside-comment-form
is t
. Try setting it to nil
and seeing if that helps
This definitely fixed it.. when nil
I don't get any hanging
nice. if we can figure out a minimal case we can solve it. don’t think we can use runtime information to know that comment
is not clojure.core/comment
though
(ns app.bug
(:refer-clojure :exclude [comment]))
(def comment {:comment/body "I probably shouldn't be using comment"})
ok. we can make it smarter by ignoring comment
forms that don’t have a (
immediately preceding them
I'm not sure how exactly to trigger it.. simply editing things in and round the def seems to trigger it sometimes. Even just using the mouse to place the point somewhere in that form will cause it
That sound reasonable.. until we go and use a comment var as a function xD. But at least in this codebase I don't see myself doing that heh.
yeah. but then if you do that its on you to not use the “comment acts as top level” then i guess
Done https://github.com/clojure-emacs/clojure-mode/issues/639 Thanks for the assistance folks
> don’t think we can use runtime information to know that comment
is not clojure.core/comment
though
(ns-resolve 'comment)
? and friends e.g. ns-interns
(maybe you know this well and mean that clojure-mode can't do this without cider?)
when i connect to a shadow-cljs repl initially, cider thinks that i'm connected to a clj repl. all good. then if i does a switch like this
shadow.user> (shadow/repl :app)
To quit, type: :cljs/quit
[:selected :app]
cljs.user>
then cider notices that i'm connected to a cljs repl while at the same time thinks i'm disconnected from a clj repl
i can start a second clj repl to the same shadow-cljs and leave it in clj mode, but cider is not to be able to recognize that i'm connected to both clj and cljs repl.
when i activate either the clj or cljs repl buffer, cider thinks i'm connected to the respective repl but disconnected from the other.
how to make emacs cider support both repls at the same time?I think you shouldn't start second REPL. You need to use cider-connect-sibling-cljs
command
matter of fact you should probably figure out the way to use cider-jack-in-clj&cljs
that way it would automatically create two REPLs for you. And what's great about it that in .cljc files, if you set the major mode to clojure-mode - it will eval things in clj REPL, if you change it to clojurescript-mode - it will eval things in cljs-repl
I am struggling to do this.
I run cider-jack-in-clj&cljs
and the Clojure REPL boots ok, but the ClojureScript one says:
> error in process filter: ClojureScript is not available. See https://docs.cider.mx/cider/basics/clojurescript for details
The docs are not very helpful there. Most likely my configuration is wrong, so I looked up full-stack projects on GitHub and mostly copied https://github.com/schnaq/cljs-re-frame-full-stack but the results are the same.
Would you happen to have pointers to help me out here?
here what i do with shadow-cljs: somewhere in your code just require these two lines
[shadow.cljs.devtools.api :as shadow]
[shadow.cljs.devtools.server :as server]
then add
(server/start!)
(shadow/watch :app)
also in your deps add this
cider/cider-nrepl {:mvn/version "0.28.7"}
then you can get rid of all your other repl setup, just fire up the clojure, from within emacs do cider-connect
then do cider-connect-sibling-cljs
Cheers! I will try that.