Skip to content

Commit e2b450b

Browse files
committed
Only define netbeans_debug if not already specified
1 parent e5d1f66 commit e2b450b

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

BUILD.MD

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,25 @@ are being passed to the `code` by default:
148148
The script also instructs the system to print messages (stderr, out) to the console
149149
by adding `-J-Dnetbeans.logger.console=true` to the npm commandline.
150150
This has the same effect as `netbeans.verbose = true` settings in the vscode.
151+
Following summary is printed when using `npm run nbcode`:
152+
153+
```bash
154+
Launching `code` with following arguments:
155+
--extensionDevelopmentPath=/netbeans-vscode/vscode
156+
--user-data-dir=/netbeans-vscode/vscode/out/userdir
157+
--extensions-dir=/netbeans-vscode/vscode/out/extdir
158+
and following additional environment variables:
159+
netbeans_debug=-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
160+
```
161+
162+
With such a summary of arguments passed `code` to
163+
the code as well as environment variables additionally provided to the process one can
164+
fully understand what the script is doing. The `netbeans_debug` variable is only added
165+
if not already specified. As such one can fully control the debugging arguments by
166+
defining the variable before executing the `npm` script:
167+
```bash
168+
netbeans_debug=-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=7777 npm run nbcode
169+
```
151170

152171
<!--
153172
### NBLS userdir locations

vscode/src/nbcode.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,24 @@ if (typeof process === 'object' && typeof process.argv0 ==='string' && process.a
119119
"--user-data-dir=" + datadir,
120120
"--extensions-dir=" + extdir
121121
].concat(args);
122-
let extraEnv: NodeJS.ProcessEnv = {
122+
let extraEnv: NodeJS.ProcessEnv = env.netbeans_debug ? {
123+
// no override of netbeans_debug
124+
} : {
123125
netbeans_debug : '-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000'
124126
}
125127
console.log('Launching `code` with following arguments:');
126128
for (var arg of codeArgs) {
127129
console.log(` ${arg}`);
128130
}
129-
console.log('and following additional environment variables:');
130-
for (var name in extraEnv) {
131-
console.log(` ${name}=${extraEnv[name]}`);
131+
{
132+
let first = true;
133+
for (var name in extraEnv) {
134+
if (first) {
135+
console.log('and following additional environment variables:');
136+
first = false;
137+
}
138+
console.log(` ${name}=${extraEnv[name]}`);
139+
}
132140
}
133141

134142
let codeProc: ChildProcessByStdio<any, Readable, Readable> = spawn("code", codeArgs, {

0 commit comments

Comments
 (0)