diff --git a/README.md b/README.md index 26950106..7042965c 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ This extension provides several commands in the Command Palette (F1 o | `arduino.useArduinoCli` | Whether to use the Arduino CLI (`true`) or the legacy Arduino IDE (`false`) -- defaults to `false`. If using `true`, either leave the `arduino.path` and `arduino.commandPath` values unset to use the bundled version of Arduino CLI, or point them at a custom version of Arduino CLI. Note that a future version of the extension will change this default to `true` and remove support for legacy Arduino IDE. | | `arduino.path` | Path to the Arduino installation. You can use a custom version of Arduino by modifying this setting to include the full path. Example: `C:\\Program Files\\Arduino` for Windows, `/Applications` for Mac, `/home//Downloads/arduino-1.8.1` for Linux. (Requires a restart after change). The default value is automatically detected from your legacy Arduino IDE installation path. To use the Arduino CLI, use the path that contains the `arduino-cli` executable (e.g. `/usr/local/bin`), or leave it unset to use the bundled version of Arduino CLI. | | `arduino.commandPath` | Path to an executable (or script) relative to `arduino.path`. The default value is `arduino_debug.exe` for Windows, `Contents/MacOS/Arduino` for Mac and `arduino` for Linux, You also can use a custom launch script to run Arduino by modifying this setting. (Requires a restart after change) Example: `run-arduino.bat` for Windows, `Contents/MacOS/run-arduino.sh` for Mac and `bin/run-arduino.sh` for Linux. To use the bundled version of Arduino CLI, leave this option unset. To use a custom version of Arduino CLI, use `arduino-cli`. | +| `arduino.additionalCliArguments` | Additional arguments to append at the tail of the build command. | | `arduino.additionalUrls` | Additional Boards Manager URLs for 3rd party packages as a string array. The default value is empty. | | `arduino.logLevel` | CLI output log level. Could be info or verbose. The default value is `"info"`. | | `arduino.clearOutputOnBuild` | Clear the output logs before uploading or verifying. Default value is `false`. | diff --git a/package.json b/package.json index 4c98a64b..bb71fb05 100644 --- a/package.json +++ b/package.json @@ -222,6 +222,13 @@ "default": "", "description": "Path to a script relative to 'arduino.path', you can use a custom launch script to run Arduino by modifying this setting. Example: 'run-arduino.bat' for Windows, 'Contents/MacOS/run-arduino.sh' for Mac, 'bin/run-arduino.sh' for Linux. (Requires a restart after change)" }, + "arduino.additionalCliArguments": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Additional arguments to append at the tail of the build command." + }, "arduino.additionalUrls": { "type": "array", "items": { diff --git a/src/arduino/arduino.ts b/src/arduino/arduino.ts index 6d6f27b6..8e67c044 100644 --- a/src/arduino/arduino.ts +++ b/src/arduino/arduino.ts @@ -759,6 +759,10 @@ export class ArduinoApp { UsbDetector.getInstance().pauseListening(); } + for (const additionalArg in VscodeSettings.getInstance().additionalCliArguments) { + args.push(additionalArg); + } + // Push sketch as last argument args.push(path.join(ArduinoWorkspace.rootPath, dc.sketch)); diff --git a/src/arduino/vscodeSettings.ts b/src/arduino/vscodeSettings.ts index 09e3a180..33ed000c 100644 --- a/src/arduino/vscodeSettings.ts +++ b/src/arduino/vscodeSettings.ts @@ -20,11 +20,13 @@ const configKeys = { DISABLE_INTELLISENSE_AUTO_GEN: "arduino.disableIntelliSenseAutoGen", ANALYZE_ON_OPEN: "arduino.analyzeOnOpen", ANALYZE_ON_SETTING_CHANGE: "arduino.analyzeOnSettingChange", + ADDITIONAL_CLI_ARGUMENTS: "arduino.additionalCliArguments", }; export interface IVscodeSettings { arduinoPath: string; commandPath: string; + additionalCliArguments: string[]; additionalUrls: string[]; logLevel: string; clearOutputOnBuild: boolean; @@ -71,6 +73,10 @@ export class VscodeSettings implements IVscodeSettings { return this.setConfigValue(configKeys.ARDUINO_COMMAND_PATH, value, true); } + public get additionalCliArguments(): string[] { + return this.getConfigValue(configKeys.ADDITIONAL_CLI_ARGUMENTS); + } + public get additionalUrls(): string[] { const value = this.getConfigValue(configKeys.ADDITIONAL_URLS);