Skip to content

Commit 4fd0e70

Browse files
Merge pull request #95 from ManuelHentschel/attach
Attach
2 parents be72778 + 39706d9 commit 4fd0e70

18 files changed

+759
-305
lines changed

.vscode/launch.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@
3535
],
3636
"smartStep": true,
3737
"preLaunchTask": "npm:watch"
38-
},
39-
{
40-
"name": "Extension Tests",
41-
"type": "extensionHost",
42-
"request": "launch",
43-
"runtimeExecutable": "${execPath}",
44-
"args": [
45-
"--extensionDevelopmentPath=${workspaceFolder}",
46-
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
47-
],
48-
"outFiles": [
49-
"${workspaceFolder}/out/test/**/*.js"
50-
],
51-
"preLaunchTask": "npm:watch"
5238
}
5339
]
5440
}

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"out": true // set this to false to include "out" folder in search results
88
},
99
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10-
"typescript.tsc.autoDetect": "off"
10+
"typescript.tsc.autoDetect": "off",
11+
"terminal.integrated.env.windows": {
12+
"VSCODE_R_DEBUGGER_TERMINAL_ID": "3"
13+
}
1114
}

configuration.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ in the Extensions-window and selecting `Extension Settings`.
1414
Current settings are:
1515
* `rdebugger.rterm.XXX (string)`: The path to the R executable itself (not just the directory!).
1616
Can usually be left empty on a windows installation with the default settings.
17-
* `rdebugger.startupTimeout (number)`: The maximum time in ms that is waited for R to startup.
17+
* `rdebugger.timeouts.startup (number)`: The maximum time in ms that is waited for R to startup.
1818
Can be set to a larger value if launching the debugger fails with a notification
1919
"R path not valid".
20+
* `rdebugger.timeouts.terminate (number)`: The time in ms that is waited when terminating.
21+
Is used to allow messages etc. to appear before terminating the debugger.
22+
* `rdebugger.timeouts.prompt (number)`: The time in ms that is waited before handling input prompts on stdout.
23+
Might be helpful to avoid async issues between stdout/stderr/sockets.
2024
* `rdebugger.checkVersion ("none"|"required"|"recommended")`:
2125
Whether to check the version of the R package vscDebugger before launching the debugger.
2226
The debugger always checks if the package is present at all.
@@ -28,15 +32,17 @@ They are useful mostly for debugging the debugger itself and their behaviour mig
2832
* `rdebugger.logLevelRuntime`, `rdebugger.logLevelSession`, `rdebugger.logLevelRSession`
2933
(`"silent"|"info"|"debug"`):
3034
Log level of the debugger itself
31-
(visible e.g. in the 'parent session' when running the debugger from code)
32-
* `rdebugger.waitBetweenRCommands (boolean)`:
33-
Time in ms that is waited before sending commands to the R process.
34-
Can be useful when debugging async issues.
35+
(visible e.g. in the 'parent session' when running the debugger from code).
3536
* `rdebugger.packageURL`: Overwrite for the URL used to download the R package when installing it automatically.
3637
* `rdebugger.printStdout`, `rdebugger.printStderr`, `rdebugger.printSinkSocket` (`"nothing"|"all"|"filtered"`):
3738
To what extent output by the R process is printed to the debug console.
3839

3940
## 3. Launch Config
41+
### 3.1 Launch Requests
42+
These configurations are specified by the entry `"request": "launch"`.
43+
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.
44+
This is ideal to make the debugger as powerful and robust as possible.
45+
4046
The main behaviour of a debug session can be configured with the entry `"debugMode"`,
4147
which can be one of the values `"function"`, `"file"`, and `"workspace"`.
4248
The intended usecases for these modes are:
@@ -62,6 +68,28 @@ The R process is always launched in the workspace folder (reading the `.Rprofile
6268
The name of the main function to be debugged. Must be callable without arguments.
6369
* `"allowGlobalDebugging"`: Whether to keep the R session running after debugging and evaluate expressions from the debug console.
6470
Essential for debug moge `"workspace"`, optional for `"file"`, usually not sensible for `"function"`.
71+
72+
### 3.2 Attach Requests
73+
These configurations are specified by the entry `"request": "attach"`.
74+
In this mode, the debugger is attached to an already running R process.
75+
To answer the requests sent by VS Code, the function `.vsc.listenForDAP()` must be called manually.
76+
This mode is ideal to give the user a more direct access to the R process.
77+
78+
This mode should work fine with the defaults, but can be finetuned with the following config entries:
79+
80+
* `"port"`: Port number where vscDebugger is listening for DAP messages. Defaults to 18721.
81+
* `"host"`: Host name where vscDebugger is listening for DAP messages. Defaults to "localhost".
82+
* `"useCustomSocket"`:
83+
Whether to use a separate socket for custom events.
84+
Is necessary to allow flow control (stepping through code).
85+
* `"customPort"`: Port number of custom socket. Leave emtpy/0 to assign automatically.
86+
* `"customHost"`: Host name of custom socket. Leave empty to use localhost.
87+
* `"splitOverwrittenOutput"`:
88+
Whether to show the overwritten output in the normal stdout/stderr as well.
89+
90+
91+
### 3.3 Shared config entries
92+
These configuration entries are used in both modes.
6593
* `"setBreakpointsInPackages"`:
6694
Whether to try and set breakpoints in exported functions from ALL packages.
6795
Very slow!
@@ -116,6 +144,6 @@ If no values are set, the defaults listed below are used.
116144
* `"vsc.showEvaluateName" = TRUE`: Whether to include an evaluate name to copy variables to another R session. Can be disabled for performance reasons when working with large variables/lists/vectors.
117145
* `"vsc.showInternalFrames" = FALSE`: Whether to show the frames on the bottom of the stack that belong to the R package
118146
* `"vsc.supportSetVariable" = TRUE`: Whether to enable support for settings the value of variables from the variables window
119-
* `"vsc.supportTerminateRequest" = TRUE`: Whether to try and exit only the main function/file when stop (Shift+F5) is used, preserving the R session itself.
147+
* `"vsc.supportTerminateRequest" = FALSE`: Whether to try and exit only the main function/file when stop (Shift+F5) is used, preserving the R session itself.
120148
* `"vsc.trySilent" = TRUE`: Whether to hide error messages that are expected and caught by the R package
121149
* `"vsc.verboseVarInfos" = FALSE`: Whether to print debug info when retrieving info about variables

images/Rlogo.png

21.9 KB
Loading

0 commit comments

Comments
 (0)