The behaviour of the debugger can be configured in four different ways: 1. Regular VS Code settings 2. Additional VS Code settings in .vscode/settings.json 3. Launch config in .vscode/launch.json 4. Options in R, modified using options(vsc.XXX=...)

1. Regular VS Code settings

These settings can be accessed e.g. by right-clicking on this extension in the Extensions-window and selecting Extension Settings. Current settings are:

2. Additional VS Code settings

These settings can be set by editing the settings.json, either globally or on a per workspace basis. They are useful mostly for debugging the debugger itself and their behaviour might change without notice.

3. Launch Config

3.1 Launch Requests

These configurations are specified by the entry "request": "launch". In this mode, a new R process is started in the background for each debug session and its stdin/stdout/stderr are handled by the VS Code extension. This is ideal to make the debugger as powerful and robust as possible.

The main behaviour of a debug session can be configured with the entry "debugMode", which can be one of the values "function", "file", and "workspace". The intended usecases for these modes are:

The remaining config entries are:

For config entries shared with attach requests see 3.3.

3.2 Attach Requests

These configurations are specified by the entry "request": "attach". In this mode, the debugger is attached to an already running R process. To answer the requests sent by VS Code, the function .vsc.listenForDAP() must be called manually. This mode gives the user a more direct access to the R process. However, support of breakpoints and .vsc.debugSource() is limited and might not work as expected.

This mode should work fine with the defaults, but can be finetuned with the following config entries:

3.3 Shared config entries

These configuration entries are used in both modes.

4. R Options

These options are set directly in R. The safest way to set these is using a custom .Rprofile, since all of them are accessed after executing .Rprofile if present, but some are read only once before executing any of the debugged code.

The available options might change behaviour without notice. Some of these options are only useful for debugging the R package itself.

There are no value checks when reading the options, so make sure to set them to a sensible value. If no values are set, the defaults listed below are used.



ManuelHentschel/vscDebugger documentation built on April 13, 2025, 8:59 p.m.