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

Add clear output on build option #1057

Merged
merged 7 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ This extension provides several commands in the Command Palette (<kbd>F1</kbd> 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`.|
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/arduino/arduino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions src/arduino/vscodeSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -24,6 +25,7 @@ export interface IVscodeSettings {
commandPath: string;
additionalUrls: string | string[];
logLevel: string;
clearOutputOnBuild: boolean;
allowPDEFiletype: boolean;
enableUSBDetection: boolean;
disableTestingOpen: boolean;
Expand Down Expand Up @@ -63,6 +65,10 @@ export class VscodeSettings implements IVscodeSettings {
return this.getConfigValue<string>(configKeys.LOG_LEVEL) || "info";
}

public get clearOutputOnBuild(): boolean {
return this.getConfigValue<boolean>(configKeys.CLEAR_OUTPUT_ON_START);
}

public get allowPDEFiletype(): boolean {
return this.getConfigValue<boolean>(configKeys.ALLOW_PDE_FILETYPE);
}
Expand Down
4 changes: 4 additions & 0 deletions src/common/outputChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ export const arduinoChannel = {
hide() {
this.channel.hide();
},

clear() {
this.channel.clear();
},
};