Skip to content

Instantly share code, notes, and snippets.

@badbabykosh
Created January 25, 2023 21:13
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 badbabykosh/c16998e9586626d4a167afda39234296 to your computer and use it in GitHub Desktop.
Save badbabykosh/c16998e9586626d4a167afda39234296 to your computer and use it in GitHub Desktop.
emacs debugging with indium

EMACS JS DEBUGGING WITH INDIUM

  1. indium requires a config file to be setup .indium.json
  2. M-x indium-launch

The .indium.json file can contain as many configurations as needed, and mix any supported configuration types.

The currently supported type values are "chrome" and "node".

The root directory of the source files is by default set to the directory where this .indium.json file is placed, but it can be overridden with the root (or the webRoot alias) option:

BACK-END (node mode)

program: Nodejs program to start a new process. The --inspect flag will be added automatically. Expected type: string.
args: Arguments passed to the program to debug. Expected type: string.
inspect-brk: Whether Indium should break at the first statement (false by default).
host: Host on which the Node inspector is listening (defaults to "localhost").
port: Port on which the Node inspector is listening (defaults to 9229).
{
  "configurations": [
    {
      "name": "11ty",
      "type": "node",
      "program": "node",
      "args": "./node_modules/.bin/eleventy",
      "inspect-brk": true
    }
  ]
}

FRONT-END(chrome)

host: Host on which Chrome is running (defaults to "localhost").
port: Port on which Chrome is running (defaults to 9222).
url: Url to open when running indium-launch.
{
  "configurations": [
    {
      "name": "Web project",
      "type": "chrome",
      "host": "127.0.0.1",
      "url": "http://127.0.0.1/",
      "port": 9222
    }
  ]
}

Starting Indium

Indium can be started in two modes:

  • Connect: M-x indium-connect Connect indium to a running runtime from one of the configurations in the .indium.json project file.
  • Launch: M-x indium-launch Start a JavaScript process (Chrome or NodeJS) as specified from the configurations in the .indium.json project file.

NOTES:

snap chrome allows chromium cli call

Append

alias chromium="flatpak run org.chromium.Chromium"

to your ~/.bashrc file

(setq indium-chrome-executable "chrome")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment