Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 130aa64

Browse files
authored
Merge pull request #1057 from rferrese/ClearOutputOnBuild
Add clear output on build option
2 parents 67c0ee1 + 9cb1b39 commit 130aa64

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ This extension provides several commands in the Command Palette (<kbd>F1</kbd> o
7474
| `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. |
7575
| `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. |
7676
| `arduino.logLevel` | CLI output log level. Could be info or verbose. The default value is `"info"`. |
77-
| `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`. |
77+
| `arduino.clearOutputOnBuild` | Clear the output logs before uploading or verifying. Default value is `false`. |
78+
| `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`. |
7879
| `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`|
7980
| `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). |
8081
| `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`.|

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@
496496
"verbose"
497497
]
498498
},
499+
"arduino.clearOutputOnBuild": {
500+
"type": "boolean",
501+
"default": false,
502+
"description": "Clear the output logs before uploading or verifying."
503+
},
499504
"arduino.openPDEFiletype": {
500505
"type": "boolean",
501506
"default": false,

src/arduino/arduino.ts

+3
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ export class ArduinoApp {
650650
// we prepare the channel here since all following code will
651651
// or at leas can possibly output to it
652652
arduinoChannel.show();
653+
if (VscodeSettings.getInstance().clearOutputOnBuild) {
654+
arduinoChannel.clear();
655+
}
653656
arduinoChannel.start(`${buildMode} sketch '${dc.sketch}'`);
654657

655658
if (buildDir || dc.output) {

src/arduino/vscodeSettings.ts

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const configKeys = {
88
ARDUINO_COMMAND_PATH: "arduino.commandPath",
99
ADDITIONAL_URLS: "arduino.additionalUrls",
1010
LOG_LEVEL: "arduino.logLevel",
11+
CLEAR_OUTPUT_ON_START: "arduino.clearOutputOnBuild",
1112
AUTO_UPDATE_INDEX_FILES: "arduino.autoUpdateIndexFiles",
1213
ALLOW_PDE_FILETYPE: "arduino.allowPDEFiletype",
1314
ENABLE_USB_DETECTION: "arduino.enableUSBDetection",
@@ -24,6 +25,7 @@ export interface IVscodeSettings {
2425
commandPath: string;
2526
additionalUrls: string | string[];
2627
logLevel: string;
28+
clearOutputOnBuild: boolean;
2729
allowPDEFiletype: boolean;
2830
enableUSBDetection: boolean;
2931
disableTestingOpen: boolean;
@@ -63,6 +65,10 @@ export class VscodeSettings implements IVscodeSettings {
6365
return this.getConfigValue<string>(configKeys.LOG_LEVEL) || "info";
6466
}
6567

68+
public get clearOutputOnBuild(): boolean {
69+
return this.getConfigValue<boolean>(configKeys.CLEAR_OUTPUT_ON_START);
70+
}
71+
6672
public get allowPDEFiletype(): boolean {
6773
return this.getConfigValue<boolean>(configKeys.ALLOW_PDE_FILETYPE);
6874
}

src/common/outputChannel.ts

+4
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ export const arduinoChannel = {
3333
hide() {
3434
this.channel.hide();
3535
},
36+
37+
clear() {
38+
this.channel.clear();
39+
},
3640
};

0 commit comments

Comments
 (0)