diff --git a/Configuration.md b/Configuration.md index b4498c0..47b63ef 100644 --- a/Configuration.md +++ b/Configuration.md @@ -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 provided an array of absolute paths ```json { "version": "0.2.0", diff --git a/README.md b/README.md index 649e918..b29e53b 100644 --- a/README.md +++ b/README.md @@ -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 provided 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). diff --git a/src/configurationProvider.ts b/src/configurationProvider.ts index c43dfca..5b4ce38 100644 --- a/src/configurationProvider.ts +++ b/src/configurationProvider.ts @@ -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.",