Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active October 15, 2019 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sogaiu/025ce011b60c6636446ad3ec6e593d84 to your computer and use it in GitHub Desktop.
Save sogaiu/025ce011b60c6636446ad3ec6e593d84 to your computer and use it in GitHub Desktop.
using the devtools debugger in atom for plugins written in cljs (that are built with shadow-cljs)

using the devtools debugger in atom for plugins written in cljs (that are built with shadow-cljs)

steps

  1. choose a plugin to examine (e.g. atom-chlorine) and watch compile it
  2. start atom
  3. activate the plugin somehow -- this makes sure the cljs files are visible in devtools
  4. open devtools (ctrl-shift-i or equivalent) and choose the sources tab
  5. expand top -> file:// -> /home/<fill-in> -> <something>/atom-chlorine -> lib/js/cljs-runtime
  6. among the displayed folders and files should be some .cljs ones
  7. double-click a .cljs file and view its contents
  8. click on a number in the column to the left of the source code to enable a breakpoint -- some lines aren't such good choices (e.g. "case", "let", don't seem to yield good results)
  9. figure out a way to trigger the breakpoint -- by opening another project window that would trigger the plugin and loading the plugin, it might be possible to trigger a breakpoint that would only be reached early on. this might work because breakpoints appear to be saved -- even across editor restarts.
  10. trigger the breakpoint and use the debugger :)

notes

  • the debugger doesn't appear to be active unless devtools is open -- so even if breakpoints are set, they may not trigger
  • activating (initial loading of) the plugin while devtools is open may hamper proper operation of the plugin -- so opening devtools after the plugin has activated may lead to better results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment