Skip to content

Instantly share code, notes, and snippets.

@thefonso
Created January 25, 2023 21:14
Show Gist options
  • Save thefonso/1f5f36c852b46e0d57f147dd9dfca07f to your computer and use it in GitHub Desktop.
Save thefonso/1f5f36c852b46e0d57f147dd9dfca07f to your computer and use it in GitHub Desktop.

Revisions

  1. unclefonso created this gist Jan 25, 2023.
    76 changes: 76 additions & 0 deletions indium_emacs_debugging.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    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

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

    to your `~/.bashrc` file

    (setq indium-chrome-executable "chrome")