From f6df9ee45a25d64919a3c401d18685932fa066a8 Mon Sep 17 00:00:00 2001 From: Ed Hillmann Date: Thu, 22 Aug 2024 15:25:01 +1000 Subject: [PATCH 1/4] Changes that will allow an array of envFile locations to be defined --- Configuration.md | 2 +- README.md | 2 +- src/configurationProvider.ts | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Configuration.md b/Configuration.md index b4498c04..47b63ef5 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 649e918e..b29e53bd 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 c43dfca3..5b4ce384 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.", From 453ff8c232bc0d53c62b81b1d7a0b7ebc6b216cf Mon Sep 17 00:00:00 2001 From: Ed Hillmann Date: Thu, 22 Aug 2024 15:54:41 +1000 Subject: [PATCH 2/4] Tweak the doco --- Configuration.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Configuration.md b/Configuration.md index 47b63ef5..12e07c21 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. Multiple files can be specified by provided an array of absolute paths +- `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", diff --git a/README.md b/README.md index b29e53bd..54e122f1 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. Multiple files can be specified by provided an array of absolute paths +- `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). From a821e3006c365c6962431434da20a212bfa6fd9e Mon Sep 17 00:00:00 2001 From: Ed Hillmann Date: Wed, 28 Aug 2024 13:11:36 +1000 Subject: [PATCH 3/4] Update NodeJS to version 20 --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb5e1163..659a2557 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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 From 56fdcd95fa0c4a2da0bd50b5289419793b1cd9fc Mon Sep 17 00:00:00 2001 From: Ed Hillmann Date: Mon, 2 Sep 2024 12:13:02 +1000 Subject: [PATCH 4/4] Required changes after review comments --- package.json | 5 ++++- package.nls.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fad8bd25..5f11af45 100644 --- a/package.json +++ b/package.json @@ -486,7 +486,10 @@ "default": {} }, "envFile": { - "type": "string", + "type": [ + "array", + "string" + ], "description": "%java.debugger.launch.envFile.description%", "default": "${workspaceFolder}/.env" }, diff --git a/package.nls.json b/package.nls.json index 0ca0ce3c..3bd72991 100644 --- a/package.nls.json +++ b/package.nls.json @@ -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.",