\input texinfo @c -*-texinfo-*-
|
|
@c %**start of header
|
|
@setfilename Indium.info
|
|
@documentencoding UTF-8
|
|
@ifinfo
|
|
@*Generated by Sphinx 1.7.5.@*
|
|
@end ifinfo
|
|
@settitle Indium Documentation
|
|
@defindex ge
|
|
@paragraphindent 0
|
|
@exampleindent 4
|
|
@finalout
|
|
@dircategory Emacs
|
|
@direntry
|
|
* Indium: (Indium.info). JavaScript development environment for Emacs.
|
|
@end direntry
|
|
|
|
@definfoenclose strong,`,'
|
|
@definfoenclose emph,`,'
|
|
@c %**end of header
|
|
|
|
@copying
|
|
@quotation
|
|
Indium 1.2.0, Nov 28, 2018
|
|
|
|
Nicolas Petton
|
|
|
|
Copyright @copyright{} 2018, Nicolas Petton
|
|
@end quotation
|
|
|
|
@end copying
|
|
|
|
@titlepage
|
|
@title Indium Documentation
|
|
@insertcopying
|
|
@end titlepage
|
|
@contents
|
|
|
|
@c %** start of user preamble
|
|
|
|
@c %** end of user preamble
|
|
|
|
@ifnottex
|
|
@node Top
|
|
@top Indium Documentation
|
|
@insertcopying
|
|
@end ifnottex
|
|
|
|
@c %**start of body
|
|
@anchor{index doc}@anchor{0}
|
|
@c Indium documentation master file, created by
|
|
@c sphinx-quickstart on Tue Apr 4 11:48:03 2017.
|
|
@c You can adapt this file completely to your liking, but it should at least
|
|
@c contain the root `toctree` directive.
|
|
|
|
Indium is a JavaScript development environment for Emacs@footnote{http://gnu.org/software/emacs}.
|
|
|
|
Indium is Free Software, licensed under the GPL v3.0. You can follow its
|
|
development on GitHub@footnote{https://github.com/NicolasPetton/indium}.
|
|
|
|
Indium connects to a browser tab or nodejs process and provides several features
|
|
for JavaScript development, including:
|
|
|
|
|
|
@itemize *
|
|
|
|
@item
|
|
a REPL (with auto completion) & object inspection;
|
|
|
|
@item
|
|
an inspector, with history and navigation;
|
|
|
|
@item
|
|
a scratch buffer (@code{M-x indium-scratch});
|
|
|
|
@item
|
|
JavaScript evaluation in JS buffers with @code{indium-interaction-mode};
|
|
|
|
@item
|
|
a stepping Debugger, similar to @code{edebug}, or @code{cider}.
|
|
@end itemize
|
|
|
|
This documentation can be read online at @indicateurl{https://indium.readthedocs.io} and in
|
|
Info format (within Emacs with @code{(info "Indium")}).
|
|
|
|
It is also available in Info format and can be consulted from within Emacs with
|
|
@code{C-h i m indium RET}.
|
|
|
|
@menu
|
|
* Table of contents::
|
|
* Indices and tables::
|
|
|
|
@detailmenu
|
|
--- The Detailed Node Listing ---
|
|
|
|
Table of contents
|
|
|
|
* Installation::
|
|
* Getting up and running::
|
|
* The REPL::
|
|
* Interaction in JS buffers::
|
|
* The stepping debugger::
|
|
* The inspector::
|
|
* Troublehooting::
|
|
|
|
Installation
|
|
|
|
* The Indium server::
|
|
* Using MELPA::
|
|
* Manual installation::
|
|
|
|
Getting up and running
|
|
|
|
* Project configuration::
|
|
* General configuration::
|
|
* Chrome/Chromium configuration options::
|
|
* NodeJS configuration options::
|
|
* Starting Indium::
|
|
* NodeJS requirements::
|
|
* Chrome/Chromium requirements::
|
|
|
|
The REPL
|
|
|
|
* Starting a REPL::
|
|
* Using the REPL::
|
|
* Code evaluation & context::
|
|
|
|
Using the REPL
|
|
|
|
* Keybindings::
|
|
* Reconnecting from the REPL buffer::
|
|
|
|
Interaction in JS buffers
|
|
|
|
* Evaluating and inspecting::
|
|
* Switching to the REPL buffer::
|
|
* Adding and removing breakpoints::
|
|
|
|
The stepping debugger
|
|
|
|
* Using sourcemaps::
|
|
* Blackboxing scripts::
|
|
|
|
Using sourcemaps
|
|
|
|
* Overriding sourcemap paths::
|
|
|
|
The inspector
|
|
|
|
* Using the inspector::
|
|
|
|
Troublehooting
|
|
|
|
* General advices before reporting issues::
|
|
* The Indium server doesn’t start::
|
|
* Breakpoints are not set (not using sourcemaps): Breakpoints are not set not using sourcemaps.
|
|
* Breakpoints and debugging do not work (using sourcemaps): Breakpoints and debugging do not work using sourcemaps.
|
|
|
|
@end detailmenu
|
|
@end menu
|
|
|
|
@node Table of contents,Indices and tables,Top,Top
|
|
@anchor{index indium}@anchor{1}@anchor{index table-of-contents}@anchor{2}
|
|
@chapter Table of contents
|
|
|
|
|
|
@menu
|
|
* Installation::
|
|
* Getting up and running::
|
|
* The REPL::
|
|
* Interaction in JS buffers::
|
|
* The stepping debugger::
|
|
* The inspector::
|
|
* Troublehooting::
|
|
|
|
@end menu
|
|
|
|
@node Installation,Getting up and running,,Table of contents
|
|
@anchor{installation installation}@anchor{3}@anchor{installation doc}@anchor{4}
|
|
@section Installation
|
|
|
|
|
|
@cartouche
|
|
@quotation Note
|
|
If you already have installed @code{Jade}, you should read the
|
|
migration-from-jade page first.
|
|
@end quotation
|
|
@end cartouche
|
|
|
|
Indium supports @code{Emacs 25.3+}, works with @code{Chrome} (debugging protocol
|
|
@code{v1.2}, see @ref{5,,Chrome/Chromium requirements}) and @code{NodeJS}, see
|
|
@ref{6,,NodeJS requirements}.
|
|
|
|
Indium works with @code{js-mode}, @code{js2-mode}, @code{js2-jsx-mode} and
|
|
@code{rjsx-mode}. It supports the ECMAScript features of the runtime it connects
|
|
to.
|
|
|
|
Indium is availabe on MELPA@footnote{https://melpa.org}, MELPA Stable@footnote{https://stable.melpa/org}.
|
|
|
|
@menu
|
|
* The Indium server::
|
|
* Using MELPA::
|
|
* Manual installation::
|
|
|
|
@end menu
|
|
|
|
@node The Indium server,Using MELPA,,Installation
|
|
@anchor{installation server-installation}@anchor{7}@anchor{installation the-indium-server}@anchor{8}
|
|
@subsection The Indium server
|
|
|
|
|
|
Indium needs to communicate with a small server for evaluation and debugging.
|
|
Install the server with the following command (prepend @code{sudo} on GNU/Linux):
|
|
|
|
@example
|
|
npm install -g indium
|
|
@end example
|
|
|
|
@node Using MELPA,Manual installation,The Indium server,Installation
|
|
@anchor{installation using-melpa}@anchor{9}
|
|
@subsection Using MELPA
|
|
|
|
|
|
Unless you are already using MELPA, you will have to setup @code{package.el} to use
|
|
MELPA or MELPA Stable repositories. You can follow this documentation@footnote{https://melpa.org/#/getting-started}.
|
|
|
|
You can install Indium with the following command:
|
|
|
|
@example
|
|
M-x package-install [RET] indium [RET]
|
|
@end example
|
|
|
|
or by adding this bit of Emacs Lisp code to your Emacs initialization file
|
|
(@code{.emacs} or @code{init.el}):
|
|
|
|
@example
|
|
(unless (package-installed-p 'indium)
|
|
(package-install 'indium))
|
|
@end example
|
|
|
|
If the installation doesn’t work try refreshing the package list:
|
|
|
|
@example
|
|
M-x package-refresh-contents [RET]
|
|
@end example
|
|
|
|
@node Manual installation,,Using MELPA,Installation
|
|
@anchor{installation manual-installation}@anchor{a}
|
|
@subsection Manual installation
|
|
|
|
|
|
If you want to install Indium manually, make sure to install @code{websocket.el}.
|
|
Obtain the code of Indium from the repository@footnote{https://github.com/NicolasPetton/indium}.
|
|
|
|
Add the following to your Emacs configuration:
|
|
|
|
@example
|
|
;; load Indium from its source code
|
|
(add-to-list 'load-path "~/projects/indium")
|
|
(require 'indium)
|
|
@end example
|
|
|
|
@node Getting up and running,The REPL,Installation,Table of contents
|
|
@anchor{setup setup}@anchor{b}@anchor{setup getting-up-and-running}@anchor{c}@anchor{setup doc}@anchor{d}
|
|
@section Getting up and running
|
|
|
|
|
|
@menu
|
|
* Project configuration::
|
|
* General configuration::
|
|
* Chrome/Chromium configuration options::
|
|
* NodeJS configuration options::
|
|
* Starting Indium::
|
|
* NodeJS requirements::
|
|
* Chrome/Chromium requirements::
|
|
|
|
@end menu
|
|
|
|
@node Project configuration,General configuration,,Getting up and running
|
|
@anchor{setup project-configuration}@anchor{e}@anchor{setup configuration-file}@anchor{f}
|
|
@subsection Project configuration
|
|
|
|
|
|
Place a @code{.indium.json} file in the root folder of your JavaScript project.
|
|
The project file can contain one or many configurations settings for NodeJS (see
|
|
@ref{10,,NodeJS configuration options}) and Chrome/Chromium (see
|
|
@ref{11,,Chrome/Chromium configuration options}).
|
|
|
|
Here is a minimalist @code{.indium.json} file.:
|
|
|
|
@example
|
|
@{
|
|
"configurations": [
|
|
@{
|
|
"name": "Web project",
|
|
"type": "chrome"
|
|
@}
|
|
]
|
|
@}
|
|
@end example
|
|
|
|
@node General configuration,Chrome/Chromium configuration options,Project configuration,Getting up and running
|
|
@anchor{setup general-configuration}@anchor{12}@anchor{setup id1}@anchor{13}
|
|
@subsection General configuration
|
|
|
|
|
|
The @code{.indium.json} file can contain as many configurations as needed, and mix
|
|
any supported configuration types.
|
|
|
|
The currently supported @code{type} values are @code{"chrome"} and @code{"node"}.
|
|
|
|
The root directory of the source files is by default set to the directory where
|
|
this @code{.indium.json} file is placed, but it can be overridden with the @code{root}
|
|
(or the @code{webRoot} alias) option:
|
|
|
|
@example
|
|
@{
|
|
"configurations": [
|
|
@{
|
|
"type": "chrome",
|
|
"root": "src"
|
|
@}
|
|
]
|
|
@}
|
|
@end example
|
|
|
|
Custom sourcemap path overrides can be set with @code{sourceMapPathOverrides}, see
|
|
@ref{14,,Using sourcemaps} for mode information on sourcemaps and debugging.
|
|
|
|
@node Chrome/Chromium configuration options,NodeJS configuration options,General configuration,Getting up and running
|
|
@anchor{setup chrome-chromium-configuration-options}@anchor{15}@anchor{setup chrome-configuration}@anchor{11}
|
|
@subsection Chrome/Chromium configuration options
|
|
|
|
|
|
@*host:
|
|
Host on which Chrome is running (defaults to @code{"localhost"}).
|
|
|
|
|
|
@*port:
|
|
Port on which Chrome is running (defaults to @code{9222}).
|
|
|
|
|
|
@*url:
|
|
Url to open when running @code{indium-launch}.
|
|
|
|
|
|
Example configuration:
|
|
|
|
@example
|
|
@{
|
|
"configurations": [
|
|
@{
|
|
"name": "Web project",
|
|
"type": "chrome",
|
|
"host": 192.168.22.1,
|
|
"url": "http://192.168.22.1/myproject/index.html",
|
|
"port": 9222
|
|
@}
|
|
]
|
|
@}
|
|
@end example
|
|
|
|
@node NodeJS configuration options,Starting Indium,Chrome/Chromium configuration options,Getting up and running
|
|
@anchor{setup nodejs-configuration}@anchor{10}@anchor{setup nodejs-configuration-options}@anchor{16}
|
|
@subsection NodeJS configuration options
|
|
|
|
|
|
@*command:
|
|
Nodejs command to start a new process. The @code{--inspect} flag will be
|
|
added automatically.
|
|
|
|
|
|
@*inspect-brk:
|
|
Whether Indium should break at the first statement (false by
|
|
default).
|
|
|
|
|
|
@*host:
|
|
Host on which the Node inspector is listening (defaults to @code{"localhost"}).
|
|
|
|
|
|
@*port:
|
|
Port on which the Node inspector is listening (defaults to 9229).
|
|
|
|
|
|
Here is an example configuration for debugging Gulp tasks:
|
|
|
|
@example
|
|
@{
|
|
"configurations": [
|
|
@{
|
|
"name": "Gulp",
|
|
"type": "node",
|
|
"command": "node ./node_modules/gulp/bin/gulp.js",
|
|
"inspect-brk": true
|
|
@}
|
|
]
|
|
@}
|
|
@end example
|
|
|
|
@node Starting Indium,NodeJS requirements,NodeJS configuration options,Getting up and running
|
|
@anchor{setup starting-indium}@anchor{17}@anchor{setup id2}@anchor{18}
|
|
@subsection Starting Indium
|
|
|
|
|
|
Indium can be started in two modes:
|
|
|
|
|
|
@itemize -
|
|
|
|
@item
|
|
Connect: @code{M-x indium-connect} Connect indium to a running runtime from one
|
|
of the configurations in the @code{.indium.json} project file.
|
|
|
|
@item
|
|
Launch: @code{M-x indium-launch} Start a JavaScript process (Chrome or NodeJS) as
|
|
specified from the configurations in the @code{.indium.json} project file.
|
|
@end itemize
|
|
|
|
@node NodeJS requirements,Chrome/Chromium requirements,Starting Indium,Getting up and running
|
|
@anchor{setup id3}@anchor{19}@anchor{setup nodejs-requirements}@anchor{6}
|
|
@subsection NodeJS requirements
|
|
|
|
|
|
Nodejs >= @code{8.x} is required for Indium to work.
|
|
|
|
If your distribution ships an old version of NodeJS, you can install a more
|
|
recent version using nvm@footnote{https://github.com/creationix/nvm}:
|
|
|
|
@example
|
|
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
|
|
@end example
|
|
|
|
Once @code{nvm} is install, you can easily install and use the version of NodeJS
|
|
you want:
|
|
|
|
@example
|
|
$ nvm install v8
|
|
$ nvm alias default v8
|
|
$ node --version
|
|
@end example
|
|
|
|
If you install NodeJS using @code{nvm}, chances are that Emacs won’t have it in its
|
|
@code{exec path}. A simple solution is to use the excellent exec-path-from-shell@footnote{https://github.com/purcell/exec-path-from-shell} package.
|
|
|
|
@node Chrome/Chromium requirements,,NodeJS requirements,Getting up and running
|
|
@anchor{setup chrome-requirements}@anchor{5}@anchor{setup chrome-chromium-requirements}@anchor{1a}
|
|
@subsection Chrome/Chromium requirements
|
|
|
|
|
|
Chrome/Chromium >= @code{60.0} is required for Indium to properly work (debugging
|
|
protocol @code{v1.2}).
|
|
|
|
When the variable @code{indium-chrome-use-temporary-profile} is non-nil (the
|
|
default), @code{M-x indium-launch} will start a new instance of Chrome/Chromium
|
|
with the remote debugging port set up.
|
|
|
|
Otherwise, you can start Chrome/Chromium with the @code{--remote-debugging-port}
|
|
flag like the following:
|
|
|
|
@example
|
|
chromium --remote-debugging-port=9222 https://localhost:3000
|
|
@end example
|
|
|
|
If you start Chrome manually, make sure that no instance of Chrome is already
|
|
running, otherwise Chrome will simply open a new tab on the existing Chrome
|
|
instance, and the @code{remote-debugging-port} will not be set.
|
|
|
|
@node The REPL,Interaction in JS buffers,Getting up and running,Table of contents
|
|
@anchor{repl the-repl}@anchor{1b}@anchor{repl repl}@anchor{1c}@anchor{repl doc}@anchor{1d}
|
|
@section The REPL
|
|
|
|
|
|
@menu
|
|
* Starting a REPL::
|
|
* Using the REPL::
|
|
* Code evaluation & context::
|
|
|
|
@end menu
|
|
|
|
@node Starting a REPL,Using the REPL,,The REPL
|
|
@anchor{repl starting-a-repl}@anchor{1e}
|
|
@subsection Starting a REPL
|
|
|
|
|
|
A REPL (Read Eval Print Loop) buffer is automatically open when a new Indium
|
|
connection is made (see @ref{b,,Getting up and running}).
|
|
|
|
@image{repl,,,,png}
|
|
|
|
The REPL offers the following features:
|
|
|
|
|
|
@itemize *
|
|
|
|
@item
|
|
Auto completion with @code{company-mode}
|
|
|
|
@item
|
|
JS syntax highlighting
|
|
|
|
@item
|
|
Pretty printing and preview of printed values
|
|
|
|
@item
|
|
Access to the object inspector (see @ref{1f,,The inspector})
|
|
@end itemize
|
|
|
|
@image{repl2,,,,png}
|
|
|
|
@node Using the REPL,Code evaluation & context,Starting a REPL,The REPL
|
|
@anchor{repl using-the-repl}@anchor{20}
|
|
@subsection Using the REPL
|
|
|
|
|
|
@menu
|
|
* Keybindings::
|
|
* Reconnecting from the REPL buffer::
|
|
|
|
@end menu
|
|
|
|
@node Keybindings,Reconnecting from the REPL buffer,,Using the REPL
|
|
@anchor{repl keybindings}@anchor{21}
|
|
@subsubsection Keybindings
|
|
|
|
|
|
Here is the list of available keybindings in a REPL buffer:
|
|
|
|
|
|
@multitable {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
|
|
@headitem
|
|
|
|
Keybinding
|
|
|
|
@tab
|
|
|
|
Description
|
|
|
|
@item
|
|
|
|
@code{RET}
|
|
|
|
@tab
|
|
|
|
Evalute the current input. When the point is on a printed object, inspect the object.
|
|
|
|
@item
|
|
|
|
@code{C-RET}
|
|
|
|
@tab
|
|
|
|
Insert a newline.
|
|
|
|
@item
|
|
|
|
@code{C-c M-i}
|
|
|
|
@tab
|
|
|
|
Evalute the current input and open an inspector on the result.
|
|
|
|
@item
|
|
|
|
@code{C-c C-o}
|
|
|
|
@tab
|
|
|
|
Clear the output.
|
|
|
|
@item
|
|
|
|
@code{C-c C-q}
|
|
|
|
@tab
|
|
|
|
Kill the REPL buffer and close the current connection.
|
|
|
|
@item
|
|
|
|
@code{M-n}
|
|
|
|
@tab
|
|
|
|
Insert the previous input in the history.
|
|
|
|
@item
|
|
|
|
@code{M-p}
|
|
|
|
@tab
|
|
|
|
Instert the next input in the history.
|
|
|
|
@end multitable
|
|
|
|
|
|
@node Reconnecting from the REPL buffer,,Keybindings,Using the REPL
|
|
@anchor{repl reconnecting-from-the-repl-buffer}@anchor{22}
|
|
@subsubsection Reconnecting from the REPL buffer
|
|
|
|
|
|
When a connection is closed (most probably because other devtools were open on
|
|
the same runtime), the REPL will display two buttons, one to try to reopen the
|
|
connection, and another one to kill Emacs buffers using this connection (the
|
|
REPL buffer, inspectors & debuggers).
|
|
|
|
@node Code evaluation & context,,Using the REPL,The REPL
|
|
@anchor{repl code-evaluation-context}@anchor{23}
|
|
@subsection Code evaluation & context
|
|
|
|
|
|
When evaluating code in the REPL, Indium will always run the code on the current
|
|
execution context.
|
|
|
|
This means that while debugging, code execution will happen in the context of
|
|
the current stack frame, and will be able to access local variables from the
|
|
stack, etc.
|
|
|
|
@node Interaction in JS buffers,The stepping debugger,The REPL,Table of contents
|
|
@anchor{code-evaluation interaction}@anchor{24}@anchor{code-evaluation interaction-in-js-buffers}@anchor{25}@anchor{code-evaluation doc}@anchor{26}
|
|
@section Interaction in JS buffers
|
|
|
|
|
|
Indium comes with a minor mode called @code{indium-interaction-mode} for interactive
|
|
programming. To enable it in all JavaScript buffers, add something
|
|
like the following to your Emacs configuration:
|
|
|
|
@example
|
|
(require 'indium)
|
|
(add-hook 'js-mode-hook #'indium-interaction-mode)
|
|
@end example
|
|
|
|
When @code{indium-interaction-mode} is on, you can evaluate code, inspect objects and
|
|
add or remove breakpoints from your buffers.
|
|
|
|
@menu
|
|
* Evaluating and inspecting::
|
|
* Switching to the REPL buffer::
|
|
* Adding and removing breakpoints::
|
|
|
|
@end menu
|
|
|
|
@node Evaluating and inspecting,Switching to the REPL buffer,,Interaction in JS buffers
|
|
@anchor{code-evaluation evaluating-and-inspecting}@anchor{27}
|
|
@subsection Evaluating and inspecting
|
|
|
|
|
|
Here’s a list of available keybindings:
|
|
|
|
|
|
@itemize -
|
|
|
|
@item
|
|
@code{C-x C-e}: Evaluate the JavaScript expression preceding the point.
|
|
|
|
@item
|
|
@code{C-M-x}: Evaluate the innermost function enclosing the point.
|
|
|
|
@item
|
|
@code{C-c M-i}: Inspect the result of the evaluation of an expression (see
|
|
@ref{1f,,The inspector}).
|
|
|
|
@item
|
|
@code{C-c M-:}: Prompt for an expression to evaluate and inspect.
|
|
|
|
@item
|
|
@code{M-x indium-eval-buffer}: Evaluate the entire buffer.
|
|
|
|
@item
|
|
@code{M-x indium-eval-region}: Evaluate the current region.
|
|
@end itemize
|
|
|
|
@node Switching to the REPL buffer,Adding and removing breakpoints,Evaluating and inspecting,Interaction in JS buffers
|
|
@anchor{code-evaluation switching-to-the-repl-buffer}@anchor{28}
|
|
@subsection Switching to the REPL buffer
|
|
|
|
|
|
Press @code{C-c C-z} from any buffer with @code{indium-interaction-mode} turned on to
|
|
switch back to the REPL buffer (see @ref{1c,,The REPL}).
|
|
|
|
@node Adding and removing breakpoints,,Switching to the REPL buffer,Interaction in JS buffers
|
|
@anchor{code-evaluation adding-and-removing-breakpoints}@anchor{29}
|
|
@subsection Adding and removing breakpoints
|
|
|
|
|
|
You need to first make sure that Indium is set up correctly to use local files
|
|
(see @ref{12,,General configuration}).
|
|
|
|
|
|
@itemize -
|
|
|
|
@item
|
|
@code{C-c b b}: Add a breakpoint
|
|
|
|
@item
|
|
@code{C-c b c}: Add a conditional breakpoint
|
|
|
|
@item
|
|
@code{C-c b k}: Remove a breakpoint
|
|
|
|
@item
|
|
@code{C-c b t}: Toggle a breakpoint
|
|
|
|
@item
|
|
@code{C-c b K}: Remove all breakpoints from the current buffer
|
|
|
|
@item
|
|
@code{C-c b e}: Edit condition of a breakpoint
|
|
|
|
@item
|
|
@code{C-c b l}: List all breakpoints and easily jump to any breakpoint
|
|
|
|
@item
|
|
@code{C-c b d}: Deactivate all breakpoints (the runtime won’t pause when hitting a breakpoint)
|
|
|
|
@item
|
|
@code{C-c b a}: Activate all breakpoints (it has no effect if breakpoints have not been deactivated)
|
|
@end itemize
|
|
|
|
The left fringe or margin can also be clicked to add or remove breakpoints.
|
|
|
|
Once a breakpoint is set, execution will stop when a breakpoint is hit, and the
|
|
Indium debugger pops up (see @ref{2a,,The stepping debugger}).
|
|
|
|
Since Indium 0.7, breakpoints are supported in source files with an associated sourcemap, see @ref{14,,Using sourcemaps}.
|
|
|
|
@cartouche
|
|
@quotation Note
|
|
Breakpoints are persistent: if the connection is closed, when a new
|
|
connection is made Indium will attempt to add back all breakpoints.
|
|
@end quotation
|
|
@end cartouche
|
|
|
|
@node The stepping debugger,The inspector,Interaction in JS buffers,Table of contents
|
|
@anchor{debugger the-stepping-debugger}@anchor{2b}@anchor{debugger debugger}@anchor{2a}@anchor{debugger doc}@anchor{2c}
|
|
@section The stepping debugger
|
|
|
|
|
|
@menu
|
|
* Using sourcemaps::
|
|
* Blackboxing scripts::
|
|
|
|
@end menu
|
|
|
|
@node Using sourcemaps,Blackboxing scripts,,The stepping debugger
|
|
@anchor{debugger using-sourcemaps}@anchor{2d}@anchor{debugger sourcemaps}@anchor{14}
|
|
@subsection Using sourcemaps
|
|
|
|
|
|
Since version 0.7, Indium uses sourcemap files by default.
|
|
|
|
For sourcemaps to work properly with Chrome/Chromium, make sure that a
|
|
workspace is correctly set (see @ref{b,,Getting up and running}).
|
|
|
|
@cartouche
|
|
@quotation Warning
|
|
If your project uses sourcemaps, we advise you to use @code{js-mode}
|
|
with @code{js2-minor-mode} instead of @code{js2-mode}. @code{js2-mode} can
|
|
be extremely slow at parsing large files (like compiled JavaScript
|
|
files) that the debugger might open if a stack frame source is not
|
|
source-mapped. This can happen for instance when using Webpack.
|
|
@end quotation
|
|
@end cartouche
|
|
|
|
@menu
|
|
* Overriding sourcemap paths::
|
|
|
|
@end menu
|
|
|
|
@node Overriding sourcemap paths,,,Using sourcemaps
|
|
@anchor{debugger overriding-sourcemap-paths}@anchor{2e}@anchor{debugger webpack}@anchor{2f}
|
|
@subsubsection Overriding sourcemap paths
|
|
|
|
|
|
Some sourcemaps cannot be used as is and need path rewriting to map to locations on disks.
|
|
|
|
Indium provides the configuration option @code{sourceMapPathOverrides} for
|
|
providing custom sourcemap paths.
|
|
|
|
The default mapping works well for Webpack projects:
|
|
|
|
@example
|
|
@{
|
|
"webpack:///./~/": "$@{root@}/node_modules/",
|
|
"webpack:///./": "$@{root@}/",
|
|
"webpack:///": "/",
|
|
"webpack:///src/": "$@{root@}/"
|
|
@}
|
|
@end example
|
|
|
|
Overriding the @code{sourceMapPathOverrides} option will erase the default mapping.
|
|
|
|
@cartouche
|
|
@quotation Tip
|
|
If sourcemaps do not seem to work, you can see how Indium resolves
|
|
sourcemap paths using @code{M-x indium-list-sourcemap-sources}.
|
|
@end quotation
|
|
@end cartouche
|
|
|
|
@node Blackboxing scripts,,Using sourcemaps,The stepping debugger
|
|
@anchor{debugger blackboxing-scripts}@anchor{30}
|
|
@subsection Blackboxing scripts
|
|
|
|
|
|
The custom variable @code{indium-debugger-blackbox-regexps} holds a list of regular
|
|
expression of script paths to blackbox when debugging.
|
|
|
|
Blackboxed scripts are skipped when stepping in the debugger.
|
|
|
|
@node The inspector,Troublehooting,The stepping debugger,Table of contents
|
|
@anchor{inspector the-inspector}@anchor{31}@anchor{inspector inspector}@anchor{1f}@anchor{inspector doc}@anchor{32}
|
|
@section The inspector
|
|
|
|
|
|
Indium features an object inspector that can be open on any object reference
|
|
from a REPL buffer (see @ref{1c,,The REPL}), the debugger (see @ref{2a,,The stepping debugger}), or
|
|
the result of any evaluation of JavaScript code (see @ref{24,,Interaction in JS buffers}).
|
|
|
|
To inspect the result of the evaluation of an expression, press @code{C-c M-i}. An
|
|
inspector buffer will pop up. You can also press @code{RET} or left click on
|
|
object links from the REPL buffer.
|
|
|
|
@image{inspector,,,,png}
|
|
|
|
@menu
|
|
* Using the inspector::
|
|
|
|
@end menu
|
|
|
|
@node Using the inspector,,,The inspector
|
|
@anchor{inspector using-the-inspector}@anchor{33}
|
|
@subsection Using the inspector
|
|
|
|
|
|
Here is a list of available keybindings in an inspector buffer:
|
|
|
|
|
|
@multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
|
|
@headitem
|
|
|
|
Keybinding
|
|
|
|
@tab
|
|
|
|
Description
|
|
|
|
@item
|
|
|
|
@code{RET}
|
|
|
|
@tab
|
|
|
|
Follow a link to inspect the object at point
|
|
|
|
@item
|
|
|
|
@code{l}
|
|
|
|
@tab
|
|
|
|
Pop to the previous inspected object
|
|
|
|
@item
|
|
|
|
@code{g}
|
|
|
|
@tab
|
|
|
|
Update the inspector buffer
|
|
|
|
@item
|
|
|
|
@code{n} or @code{TAB}
|
|
|
|
@tab
|
|
|
|
Jump to the next object in the inspector
|
|
|
|
@item
|
|
|
|
@code{p} or @code{s-TAB}
|
|
|
|
@tab
|
|
|
|
Jump to the previous object in the inspector
|
|
|
|
@end multitable
|
|
|
|
|
|
@node Troublehooting,,The inspector,Table of contents
|
|
@anchor{troubleshooting troublehooting}@anchor{34}@anchor{troubleshooting doc}@anchor{35}
|
|
@section Troublehooting
|
|
|
|
|
|
If you run into issues with Indium, this document might help you.
|
|
|
|
@menu
|
|
* General advices before reporting issues::
|
|
* The Indium server doesn’t start::
|
|
* Breakpoints are not set (not using sourcemaps): Breakpoints are not set not using sourcemaps.
|
|
* Breakpoints and debugging do not work (using sourcemaps): Breakpoints and debugging do not work using sourcemaps.
|
|
|
|
@end menu
|
|
|
|
@node General advices before reporting issues,The Indium server doesn’t start,,Troublehooting
|
|
@anchor{troubleshooting general-advices-before-reporting-issues}@anchor{36}
|
|
@subsection General advices before reporting issues
|
|
|
|
|
|
Issues should be reported on the GitHub issue tracker@footnote{https://github.com/nicolaspetton/indium/issues}.
|
|
|
|
1. If you encounter errors, you can enable @code{debug-on-error} in Emacs using @code{M-x
|
|
toggle-debug-on-error} and report an issue with the backtrace.
|
|
|
|
2. It is also a good idea to turn on Indium’s log mode with @code{M-: (setq
|
|
indium-client-debug t)}, and attach to the issue report the contents of the
|
|
@code{*indium-debug-log*} buffer to help resolve the issue.
|
|
|
|
Attaching the contents of the @code{*indium-process*} buffer can help as well in
|
|
case an error happens in the server process.
|
|
|
|
@node The Indium server doesn’t start,Breakpoints are not set not using sourcemaps,General advices before reporting issues,Troublehooting
|
|
@anchor{troubleshooting the-indium-server-doesn-t-start}@anchor{37}
|
|
@subsection The Indium server doesn’t start
|
|
|
|
|
|
First, make sure that @code{indium} is installed as documented in the
|
|
@ref{7,,The Indium server} section.
|
|
|
|
If you encounter the error:
|
|
|
|
@example
|
|
"error in process filter: Indium server process error: env: node: No such file or directory"
|
|
@end example
|
|
|
|
Chances are that @code{node} is not in Emacs’ @code{exec-path}. In this case, you can
|
|
fix it by appending the correct directory to @code{exec-path}, or use the
|
|
exec-path-from-shell@footnote{https://melpa.org/#/exec-path-from-shell} package:
|
|
|
|
@example
|
|
(require 'exec-path-from-shell)
|
|
(exec-path-from-shell-initialize)
|
|
@end example
|
|
|
|
@node Breakpoints are not set not using sourcemaps,Breakpoints and debugging do not work using sourcemaps,The Indium server doesn’t start,Troublehooting
|
|
@anchor{troubleshooting breakpoints-are-not-set-not-using-sourcemaps}@anchor{38}
|
|
@subsection Breakpoints are not set (not using sourcemaps)
|
|
|
|
|
|
If breakpoints do not work, chances are that the project is not configured
|
|
correctly.
|
|
|
|
@cartouche
|
|
@quotation Note
|
|
Indium needs to know how to map script source urls to files on disk.
|
|
It uses the @code{root} (alias @code{webRoot}) configuration option as the
|
|
base path, as described in the @ref{12,,General configuration} page.
|
|
@end quotation
|
|
@end cartouche
|
|
|
|
Indium provides a command @code{indium-list-script-sources} to list all scripts
|
|
parsed by the backend, displaying their sources mapped to files on disk. Check
|
|
that the file where you’re trying to add a breakpoint is listed.
|
|
|
|
@node Breakpoints and debugging do not work using sourcemaps,,Breakpoints are not set not using sourcemaps,Troublehooting
|
|
@anchor{troubleshooting breakpoints-and-debugging-do-not-work-using-sourcemaps}@anchor{39}
|
|
@subsection Breakpoints and debugging do not work (using sourcemaps)
|
|
|
|
|
|
Correctly mapping sourcemaps to file locations can be tedious (see
|
|
@ref{14,,Using sourcemaps}).
|
|
|
|
Indium provides the command @code{indium-list-sourcemap-sources} to help
|
|
configuring sourcemaps correctly. This command displays a list of all
|
|
sourcemap sources in the runtime as file paths on disk. Check that your files
|
|
are listed there.
|
|
|
|
@node Indices and tables,,Table of contents,Top
|
|
@anchor{index indices-and-tables}@anchor{3a}
|
|
@chapter Indices and tables
|
|
|
|
|
|
|
|
@itemize *
|
|
|
|
@item
|
|
genindex
|
|
|
|
@item
|
|
modindex
|
|
|
|
@item
|
|
search
|
|
@end itemize
|
|
|
|
@c %**end of body
|
|
@bye
|