diff --git a/README.md b/README.md index af2fb77b..88c23c3e 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,8 @@ This extension provides several commands in the Command Palette (F1 o | `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. | | `arduino.additionalUrls` | Additional Boards Manager URLs for 3rd party packages. You can have multiple URLs in one string with a comma(`,`) as separator, or have 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.allowPDEFiletype` | Allow the VSCode Arduino extension to open .pde files from pre-1.0.0 versions of Arduino. Note that this will break Processing code. Default value is `false`. | +| `arduino.clearOutputOnBuild` | Clear the output logs before uploading or verifying. Default value is `false`. | +| `arduino.allowPDEFiletype` | Allow the VSCode Arduino extension to open .pde files from pre-1.0.0 versions of Arduino. Note that this will break Processing code. Default value is `false`. | | `arduino.enableUSBDetection` | Enable/disable USB detection from the VSCode Arduino extension. The default value is `true`. When your device is plugged in to your computer, it will pop up a message "`Detected board ****, Would you like to switch to this board type`". After clicking the `Yes` button, it will automatically detect which serial port (COM) is connected a USB device. If your device does not support this feature, please provide us with the PID/VID of your device; the code format is defined in `misc/usbmapping.json`.To learn more about how to list the vid/pid, use the following tools: https://github.com/EmergingTechnologyAdvisors/node-serialport `npm install -g serialport` `serialport-list -f jsonline`| | `arduino.disableTestingOpen` | Enable/disable automatic sending of a test message to the serial port for checking the open status. The default value is `false` (a test message will be sent). | | `arduino.skipHeaderProvider` | Enable/disable the extension providing completion items for headers. This functionality is included in newer versions of the C++ extension. The default value is `false`.| diff --git a/package.json b/package.json index c677c34a..06d42122 100644 --- a/package.json +++ b/package.json @@ -496,6 +496,11 @@ "verbose" ] }, + "arduino.clearOutputOnBuild": { + "type": "boolean", + "default": false, + "description": "Clear the output logs before uploading or verifying." + }, "arduino.openPDEFiletype": { "type": "boolean", "default": false, diff --git a/src/arduino/arduino.ts b/src/arduino/arduino.ts index 97112f2e..ca60eb73 100644 --- a/src/arduino/arduino.ts +++ b/src/arduino/arduino.ts @@ -650,6 +650,9 @@ export class ArduinoApp { // we prepare the channel here since all following code will // or at leas can possibly output to it arduinoChannel.show(); + if (VscodeSettings.getInstance().clearOutputOnBuild) { + arduinoChannel.clear(); + } arduinoChannel.start(`${buildMode} sketch '${dc.sketch}'`); if (buildDir || dc.output) { diff --git a/src/arduino/vscodeSettings.ts b/src/arduino/vscodeSettings.ts index 74f7bedb..ce512189 100644 --- a/src/arduino/vscodeSettings.ts +++ b/src/arduino/vscodeSettings.ts @@ -8,6 +8,7 @@ const configKeys = { ARDUINO_COMMAND_PATH: "arduino.commandPath", ADDITIONAL_URLS: "arduino.additionalUrls", LOG_LEVEL: "arduino.logLevel", + CLEAR_OUTPUT_ON_START: "arduino.clearOutputOnBuild", AUTO_UPDATE_INDEX_FILES: "arduino.autoUpdateIndexFiles", ALLOW_PDE_FILETYPE: "arduino.allowPDEFiletype", ENABLE_USB_DETECTION: "arduino.enableUSBDetection", @@ -24,6 +25,7 @@ export interface IVscodeSettings { commandPath: string; additionalUrls: string | string[]; logLevel: string; + clearOutputOnBuild: boolean; allowPDEFiletype: boolean; enableUSBDetection: boolean; disableTestingOpen: boolean; @@ -63,6 +65,10 @@ export class VscodeSettings implements IVscodeSettings { return this.getConfigValue(configKeys.LOG_LEVEL) || "info"; } + public get clearOutputOnBuild(): boolean { + return this.getConfigValue(configKeys.CLEAR_OUTPUT_ON_START); + } + public get allowPDEFiletype(): boolean { return this.getConfigValue(configKeys.ALLOW_PDE_FILETYPE); } diff --git a/src/common/outputChannel.ts b/src/common/outputChannel.ts index cb0db494..2399c551 100644 --- a/src/common/outputChannel.ts +++ b/src/common/outputChannel.ts @@ -33,4 +33,8 @@ export const arduinoChannel = { hide() { this.channel.hide(); }, + + clear() { + this.channel.clear(); + }, };