Fork me on GitHub
#spacemacs
<
2022-05-06
>
allentiak18:05:53

Hi, Could you please help me to setup Spacemacs for debugging ClojureScript code directly from within Spacemacs? (I know CIDER does not support ClojureScrpit.) I found some instructions for using LSP. I tried it, with no avail... (details in thread) Of course, other options are most welcome :-) Thanks in advance, --Leandro

allentiak19:05:18

I know it's also possible to debug a ClojureScript project with the Developer Tools of most browsers (Firefox, Chromium...). However, I would like to be able to do that directly from Spacemacs itself. Would you know of such a way? I have only found one, and cannot make it work... Whereas I found a link[1] where they show how to use dap-mode to debug ClojureScrip under vanilla Emacs, I haven't been able to adapt these instructions to work under Spacemacs... [1]: https://emacs-lsp.github.io/lsp-mode/tutorials/debugging-clojure-script/ This is my current setup [2]. [2]: https://github.com/allentiak/.spacemacs.d This is what I have done so far, following the instructions from[1][: 1) Create a launch.json in the project root [DONE] 2) Install Google Chrome Debug Adapter via M-x dap-chrome-setup [FAILS] I cannot install the adapter. It seems the command is obsolete[3]. [3]: https://github.com/microsoft/vscode-chrome-debug#rotating_light-important I get the following error: "helm-M-x-execute-command: Have you loaded the ‘chrome’ specific dap package?" How should I load that package? In a reply to my original Zulip message [4], @U05254DQM mentioned a bug w.r.t. the package download [4]. https://github.com/emacs-lsp/dap-mode/issues/554 That being said, the command M-x dap-chrome-setup, as mentioned in [1], seems not to exist... [4]: https://clojurians.zulipchat.com/#narrow/stream/151763-beginners/topic/spacemacs.20.2B.20clojurescript.20.2B.20debugging.20.3F/near/281212390 Thank you in advance, Leandro

Drew Verlee20:05:19

Fwiw. Nothing has ever worked for me in terms of a debugger w/ step, inspect, etc... I just def vars. You can set break points on the js in the browser. But i rarely do.

allentiak23:05:13

thanks for the reply

allentiak23:05:11

does everybody do that? I thought there were more sophisticated ways to debug ClojureScript...

Drew Verlee23:05:17

Well, in a way, you can debug clojure with clojure using the repl. So it's not really lacking, just different. The downside is you can't step though code as easily. I'll say that i think that's a weakness, but most fe frameworks would probably make it impossible regardless...

practicalli-johnny01:05:38

I haven't tried a step debug tool for ClojureScript as I rarely write complex algorithms in the front end. Even with Clojure, the Cider debug tool is not the first thing I reach for. Usually the result of calling a function in the REPL gives me an idea what's wrong. I use the Cider inspector if it's a large or nested data structure (or clojure.pprint) If the cause is not obvious from calling the function I'll break down that function and evaluate just the parts of it (using some mock values) If the ClojureScript code it is platform neutral (no JavaScript interoperability) I can always write that code in a .cljc file and use the Cider debug tool and a Clojure REPL. And then there is always println or the more sophisticated tap> approach (with a tool like portal).