Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes that will allow an array of envFile locations to be defined #1506

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 16
node-version: 20

- name: Install Node.js modules
run: npm install
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 16
node-version: 20

- name: Install Node.js modules
run: npm install
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 16
node-version: 20

- name: Install Node.js modules
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ In case you want to manually edit the configuration, below are the explanation a
}
```

- `envFile` - Absolute path to a file containing environment variable definitions.
- `envFile` - Absolute path to a file containing environment variable definitions. Multiple files can be specified by providing an array of absolute paths
```json
{
"version": "0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
- `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.
- `cwd` - The working directory of the program. Defaults to `${workspaceFolder}`.
- `env` - The extra environment variables for the program.
- `envFile` - Absolute path to a file containing environment variable definitions.
- `envFile` - Absolute path to a file containing environment variable definitions. Multiple files can be specified by providing an array of absolute paths
- `stopOnEntry` - Automatically pause the program after launching.
- `console` - The specified console to launch the program. If not specified, use the console specified by the `java.debug.settings.console` user setting.
- `internalConsole` - VS Code debug console (input stream not supported).
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,10 @@
"default": {}
},
"envFile": {
"type": "string",
"type": [
"array",
"string"
],
"description": "%java.debugger.launch.envFile.description%",
"default": "${workspaceFolder}/.env"
},
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"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.",
"java.debugger.launch.cwd.description": "The working directory of the program. Defaults to the current workspace root.",
"java.debugger.launch.env.description": "The extra environment variables for the program.",
"java.debugger.launch.envFile.description": "Absolute path to a file containing environment variable definitions.",
"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.",
"java.debugger.launch.stopOnEntry.description": "Automatically pause the program after launching.",
"java.debugger.launch.internalConsole.description": "VS Code debug console (input stream not supported).",
"java.debugger.launch.integratedTerminal.description": "VS Code integrated terminal.",
Expand Down
18 changes: 14 additions & 4 deletions src/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,20 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
let result = baseEnv;
if (config.envFile) {
try {
result = {
...baseEnv,
...readEnvFile(config.envFile),
};
if (typeof config.envFile === 'string') {
result = {
...result,
...readEnvFile(config.envFile)
};
}
if (Array.isArray(config.envFile)) {
config.envFile.forEach((f) => {
result = {
...result,
...readEnvFile(f)
};
});
}
} catch (e) {
throw new utility.UserError({
message: "Cannot load environment file.",
Expand Down
Loading