Skip to content

Commit 53ba640

Browse files
hildoEd Hillmann
and
Ed Hillmann
authored
Changes that will allow an array of envFile locations to be defined (#1506)
* Changes that will allow an array of envFile locations to be defined * Tweak the doco * Update NodeJS to version 20 * Required changes after review comments --------- Co-authored-by: Ed Hillmann <edward.p.hillmann@boeing.com>
1 parent 4a903c4 commit 53ba640

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup Node.js environment
3030
uses: actions/setup-node@v2
3131
with:
32-
node-version: 16
32+
node-version: 20
3333

3434
- name: Install Node.js modules
3535
run: npm install
@@ -65,7 +65,7 @@ jobs:
6565
- name: Setup Node.js environment
6666
uses: actions/setup-node@v2
6767
with:
68-
node-version: 16
68+
node-version: 20
6969

7070
- name: Install Node.js modules
7171
run: npm install
@@ -101,7 +101,7 @@ jobs:
101101
- name: Setup Node.js environment
102102
uses: actions/setup-node@v2
103103
with:
104-
node-version: 16
104+
node-version: 20
105105

106106
- name: Install Node.js modules
107107
run: npm install

Configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ In case you want to manually edit the configuration, below are the explanation a
115115
}
116116
```
117117

118-
- `envFile` - Absolute path to a file containing environment variable definitions.
118+
- `envFile` - Absolute path to a file containing environment variable definitions. Multiple files can be specified by providing an array of absolute paths
119119
```json
120120
{
121121
"version": "0.2.0",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
7171
- `projectName` - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. This setting also works when the debugger looks for the specified main class when launching a program. It is required when the workspace has multiple java projects, otherwise the expression evaluation and conditional breakpoint may not work.
7272
- `cwd` - The working directory of the program. Defaults to `${workspaceFolder}`.
7373
- `env` - The extra environment variables for the program.
74-
- `envFile` - Absolute path to a file containing environment variable definitions.
74+
- `envFile` - Absolute path to a file containing environment variable definitions. Multiple files can be specified by providing an array of absolute paths
7575
- `stopOnEntry` - Automatically pause the program after launching.
7676
- `console` - The specified console to launch the program. If not specified, use the console specified by the `java.debug.settings.console` user setting.
7777
- `internalConsole` - VS Code debug console (input stream not supported).

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,10 @@
486486
"default": {}
487487
},
488488
"envFile": {
489-
"type": "string",
489+
"type": [
490+
"array",
491+
"string"
492+
],
490493
"description": "%java.debugger.launch.envFile.description%",
491494
"default": "${workspaceFolder}/.env"
492495
},

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"java.debugger.launch.encoding.description": "The file.encoding setting for the JVM. Possible values can be found in https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html.",
1919
"java.debugger.launch.cwd.description": "The working directory of the program. Defaults to the current workspace root.",
2020
"java.debugger.launch.env.description": "The extra environment variables for the program.",
21-
"java.debugger.launch.envFile.description": "Absolute path to a file containing environment variable definitions.",
21+
"java.debugger.launch.envFile.description": "Absolute path to a file containing environment variable definitions. Multiple files can be specified by providing an array of absolute paths.",
2222
"java.debugger.launch.stopOnEntry.description": "Automatically pause the program after launching.",
2323
"java.debugger.launch.internalConsole.description": "VS Code debug console (input stream not supported).",
2424
"java.debugger.launch.integratedTerminal.description": "VS Code integrated terminal.",

src/configurationProvider.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,20 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
187187
let result = baseEnv;
188188
if (config.envFile) {
189189
try {
190-
result = {
191-
...baseEnv,
192-
...readEnvFile(config.envFile),
193-
};
190+
if (typeof config.envFile === 'string') {
191+
result = {
192+
...result,
193+
...readEnvFile(config.envFile)
194+
};
195+
}
196+
if (Array.isArray(config.envFile)) {
197+
config.envFile.forEach((f) => {
198+
result = {
199+
...result,
200+
...readEnvFile(f)
201+
};
202+
});
203+
}
194204
} catch (e) {
195205
throw new utility.UserError({
196206
message: "Cannot load environment file.",

0 commit comments

Comments
 (0)