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

Commit 37c18a0

Browse files
committed
Add clear output on build option
1 parent c9f5d10 commit 37c18a0

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ This extension provides several commands in the Command Palette (<kbd>F1</kbd> o
6262
| `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. |
6363
| `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. |
6464
| `arduino.logLevel` | CLI output log level. Could be info or verbose. The default value is `"info"`. |
65+
| `arduino.clearOutputOnBuild` | Clear the output logs before uploading or verifying |
6566
| `arduino.allowPDEFiletype` | Allow the VSCode Arduino extension to open .pde files from pre-1.0.0 versions of Ardiuno. Note that this will break Processing code. Default value is `false`. |
6667
| `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`|
6768
| `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). |

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,11 @@
467467
"verbose"
468468
]
469469
},
470+
"arduino.clearOutputOnBuild": {
471+
"type": "boolean",
472+
"default": false,
473+
"description": "Clear the output logs before uploading or verifying"
474+
},
470475
"arduino.openPDEFiletype": {
471476
"type": "boolean",
472477
"default": false,
@@ -587,4 +592,4 @@
587592
"winreg": "^1.2.3",
588593
"winston": "^2.3.1"
589594
}
590-
}
595+
}

src/arduino/arduino.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ export class ArduinoApp {
120120
}
121121

122122
arduinoChannel.show();
123+
if (VscodeSettings.getInstance().clearOutputOnBuild) {
124+
arduinoChannel.clear();
125+
}
123126
arduinoChannel.start(`Upload sketch - ${dc.sketch}`);
124127

125128
const serialMonitor = SerialMonitor.getInstance();
@@ -205,6 +208,9 @@ export class ArduinoApp {
205208
}
206209

207210
arduinoChannel.show();
211+
if (VscodeSettings.getInstance().clearOutputOnBuild) {
212+
arduinoChannel.clear();
213+
}
208214
arduinoChannel.start(`Upload sketch - ${dc.sketch}`);
209215

210216
const serialMonitor = SerialMonitor.getInstance();
@@ -262,6 +268,9 @@ export class ArduinoApp {
262268

263269
await vscode.workspace.saveAll(false);
264270

271+
if (VscodeSettings.getInstance().clearOutputOnBuild) {
272+
arduinoChannel.clear();
273+
}
265274
arduinoChannel.start(`Verify sketch - ${dc.sketch}`);
266275

267276
if (dc.prebuild) {

src/arduino/vscodeSettings.ts

Lines changed: 6 additions & 0 deletions
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",
@@ -22,6 +23,7 @@ export interface IVscodeSettings {
2223
commandPath: string;
2324
additionalUrls: string | string[];
2425
logLevel: string;
26+
clearOutputOnBuild: boolean;
2527
allowPDEFiletype: boolean;
2628
enableUSBDetection: boolean;
2729
disableTestingOpen: boolean;
@@ -59,6 +61,10 @@ export class VscodeSettings implements IVscodeSettings {
5961
return this.getConfigValue<string>(configKeys.LOG_LEVEL) || "info";
6062
}
6163

64+
public get clearOutputOnBuild(): boolean {
65+
return this.getConfigValue<boolean>(configKeys.CLEAR_OUTPUT_ON_START);
66+
}
67+
6268
public get allowPDEFiletype(): boolean {
6369
return this.getConfigValue<boolean>(configKeys.ALLOW_PDE_FILETYPE);
6470
}

src/common/outputChannel.ts

Lines changed: 4 additions & 0 deletions
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)