Skip to content

Debugging ​

Pragma includes a debugger that speaks the Debug Adapter Protocol. It supports JavaScript and TypeScript on Node.js, Python, and compiled Rust, C and C++ programs.

Debug adapters ​

AdapterLanguagesBased onInstalled with
nodeJavaScript, TypeScriptvscode-js-debugnpm install -g vscode-js-debug
pythonPythondebugpypip install debugpy
lldbRust, C, C++CodeLLDBDownloaded from the CodeLLDB releases

When you start a debug session and the adapter is missing, Pragma installs it automatically and shows the progress in a notification. CodeLLDB is stored in Pragma's local application data directory under adapters/.

Debug the current file ​

Open a JavaScript, TypeScript or Python file and press F5, or use Debug Current File in the Debug view of the sidebar. Pragma runs the file with node or python under the matching adapter.

Rust, C and C++ need a compiled binary, so they are debugged through a run configuration instead.

Debug a run configuration ​

Add a debug block to a configuration in .pragma/run.json. The configuration then gets a debug button in the Run menu.

json
{
  "configurations": [
    {
      "name": "dev server",
      "command": "npm run dev",
      "debug": { "adapter": "node" }
    },
    {
      "name": "django",
      "command": "python manage.py runserver",
      "debug": { "adapter": "python" }
    },
    {
      "name": "cli",
      "command": "target/debug/myapp --verbose",
      "debug": { "adapter": "lldb" }
    }
  ]
}
FieldValuesDefault
adapternode, python or lldbRequired
requestlaunch or attachlaunch

How the command is used depends on the adapter:

Adapterlaunchattach
nodeThe first word is the runtime (node, npm, pnpm), the rest are its argumentsConnects to localhost:9229
pythonThe arguments after the interpreter are the script and its arguments; -m module is supportedConnects to localhost:5678
lldbThe first word is the binary to debug, the rest are its argumentsNot supported

The cwd and env of the configuration are passed to the program as well. For attach, start your program with the debug port open first, for example node --inspect or python -m debugpy --listen 5678.

The Debug view ​

The Debug view in the sidebar shows the session while it runs:

  • Continue, Pause, Step Over, Step Into, Step Out and Stop.
  • Call Stack with the frames of the paused thread. Select a frame to see its variables.
  • Variables, expandable for objects and arrays.
  • Watch expressions, added with Add watch and evaluated whenever the program pauses.
  • Breakpoints across all files, each removable.

Set or remove a breakpoint by clicking the editor gutter next to a line, or with F9.

Shortcuts ​

ActionDefault
Start / Continue DebuggingF5
Stop DebuggingShift + F5
Step OverF10
Step IntoF11
Step OutShift + F11
Toggle BreakpointF9

Change them in Settings > Keyboard.

Released under the Apache License 2.0.