Skip to content

Commit

Permalink
Merge branch 'release/v0.16.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jun 20, 2018
2 parents 45127ba + 28e9f1f commit d2d950b
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 63 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release Notes

## 0.16.0 (2018-06-20)

**Requires VSCode 1.24 or above**

* [Custom Tasks](http://docs.platformio.org/en/latest/ide/vscode.html#custom-tasks) (issue [#89](https://github.com/platformio/platformio-vscode-ide/issues/89))
* Automatically close Serial Port Monitor before uploading/testing (issue [#49](https://github.com/platformio/platformio-vscode-ide/issues/49))
* Added new configuration option `autoCloseSerialMonitor`, which is set to `true` by default
* Added "Report a problem" action/button when error occurs
* Improved PIO Core installer using `pip` as Python module

## 0.15.2 (2018-05-30)

* Reverted back an order of PlatformIO Toolbar (issue [#114](https://github.com/platformio/platformio-vscode-ide/issues/114))
Expand All @@ -12,7 +22,7 @@

## 0.15.0 (2018-05-08)

**Requires VSCode 1.23.0 or above**
**Requires VSCode 1.23 or above**

* New UI for [PIO Unified Debugger](http://docs.platformio.org/page/plus/debugging.html):
- Conditional Breakpoints
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[PlatformIO](http://platformio.org) is an open source ecosystem for IoT development.
Cross-platform build system and unified debugger. Remote unit testing and firmware updates.

**Platforms**: Atmel AVR, Atmel SAM, Espressif 32, Espressif 8266, Freescale Kinetis, Intel ARC32, Lattice iCE40, Maxim 32, Microchip PIC32, Nordic nRF51, Nordic nRF52, NXP LPC, Silicon Labs EFM32, ST STM32, Teensy, TI MSP430, TI Tiva, WIZNet W7500
**Platforms**: Atmel AVR, Atmel SAM, Espressif 32, Espressif 8266, Freescale Kinetis, Intel ARC32, Lattice iCE40, Maxim 32, Microchip PIC32, Nordic nRF51, Nordic nRF52, NXP LPC, RISC-V, Samsung ARTIK, Silicon Labs EFM32, ST STM32, Teensy, TI MSP430, TI Tiva, WIZNet W7500

**Frameworks**: Arduino, ARTIK SDK, CMSIS, Energia, ESP-IDF, libOpenCM3, mbed, Pumbaa, Simba, SPL, STM32Cube, WiringPi

Expand Down
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "platformio-ide",
"version": "0.15.2",
"version": "0.16.0",
"publisher": "platformio",
"engines": {
"vscode": "^1.23.0"
"vscode": "^1.24.0"
},
"license": "Apache-2.0",
"displayName": "PlatformIO IDE",
"description": "Development environment for IoT, Arduino, ARM mbed, Espressif (ESP8266/ESP32), STM32, PIC32, nRF51/nRF52, FPGA, CMSIS, SPL, AVR, Samsung ARTIK, libOpenCM3",
"description": "Development environment for IoT, Arduino, ARM mbed, Espressif (ESP8266/ESP32), RISC-V, STM32, PIC32, nRF51/nRF52, FPGA, CMSIS, SPL, AVR, Samsung ARTIK, libOpenCM3",
"categories": [
"Programming Languages",
"Debuggers",
Expand Down Expand Up @@ -516,6 +516,11 @@
],
"default": "release",
"description": "Default action for 'Build' button on PIO Toolbar"
},
"platformio-ide.autoCloseSerialMonitor": {
"type": "boolean",
"default": true,
"description": "Automatically close Serial Port Monitor before uploading/testing"
}
}
}
Expand Down Expand Up @@ -543,8 +548,9 @@
"dependencies": {
"fs-plus": "^3.0.0",
"ini": "^1.3.4",
"platformio-node-helpers": "^0.5.2",
"platformio-vscode-debug": "^1.0.0"
"platformio-node-helpers": "^0.6.0",
"platformio-vscode-debug": "^1.0.0",
"querystringify": "*"
},
"extensionDependencies": [
"ms-vscode.cpptools"
Expand Down
13 changes: 9 additions & 4 deletions src/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import * as pioNodeHelpers from 'platformio-node-helpers';

import { extension } from './main';
import { notifyError } from './utils';
import vscode from 'vscode';


Expand All @@ -19,16 +20,16 @@ export default class PIOHome {
this._disposables = [];
}

toggle() {
async toggle() {
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined;
if (this._currentPanel) {
this._currentPanel.reveal(column);
} else {
this._currentPanel = this.newPanel();
this._currentPanel = await this.newPanel();
}
}

newPanel() {
async newPanel() {
const panel = vscode.window.createWebviewPanel(
'pioHome',
extension.getEnterpriseSetting('pioHomeTitle', 'PIO Home'),
Expand All @@ -40,7 +41,11 @@ export default class PIOHome {
);
panel.onDidDispose(this.onPanelDisposed.bind(this), null, this._disposables);
panel.webview.html = this.getLoadingContent();
this.getWebviewContent().then(html => panel.webview.html = html);
try {
panel.webview.html = await this.getWebviewContent();
} catch (err) {
notifyError(`PIO Home Server: ${err.toString()}`, err);
}
return panel;
}

Expand Down
15 changes: 3 additions & 12 deletions src/installer/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,14 @@ export default class InstallationManager {
}
} catch (err) {
result = false;
console.error(err);
console.warn(err);
}
}
return result;
}

async install() {
await Promise.all(this.stages.map(stage => stage.install()));

const result = await vscode.window.showInformationMessage(
'PlatformIO IDE has been successfully installed! Please reload window',
'Reload Now'
);

if (result === 'Reload Now') {
vscode.commands.executeCommand('workbench.action.reloadWindow');
}
install() {
return Promise.all(this.stages.map(stage => stage.install()));
}

destroy() {
Expand Down
1 change: 0 additions & 1 deletion src/installer/state-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default class StateStorage {
const value = this._globalState.get(this._stateKey);
return value || {};
} catch (err) {
console.error(err);
return {};
}
}
Expand Down
46 changes: 14 additions & 32 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import * as pioNodeHelpers from 'platformio-node-helpers';
import * as piodebug from 'platformio-vscode-debug';

import { getIDEVersion, isPIOProject } from './utils';
import { getIDEVersion, isPIOProject, notifyError } from './utils';

import InstallationManager from './installer/manager';
import PIOHome from './home';
Expand All @@ -26,7 +26,6 @@ class PlatformIOVSCodeExtension {
this.pioTerm = undefined;
this.pioHome = undefined;

this._isMonitorRun = false;
this._enterpriseSettings = undefined;
}

Expand Down Expand Up @@ -134,11 +133,17 @@ class PlatformIOVSCodeExtension {
im.lock();
await im.install();
outputChannel.appendLine('PlatformIO IDE installed successfully.');
const action = 'Reload Now';
const selected = await vscode.window.showInformationMessage(
'PlatformIO IDE has been successfully installed! Please reload window',
action
);
if (selected === action) {
vscode.commands.executeCommand('workbench.action.reloadWindow');
}
} catch (err) {
vscode.window.showErrorMessage(err.toString(), {
modal: true,
});
outputChannel.appendLine('Failed to install PlatformIO IDE.');
notifyError(`Installation Manager: ${err.toString()}`, err);
} finally {
im.unlock();
}
Expand All @@ -156,7 +161,7 @@ class PlatformIOVSCodeExtension {
try {
await pioNodeHelpers.home.ensureServerStarted();
} catch (err) {
console.error(err);
notifyError(`PIO Home Server: ${err.toString()}`, err);
}
vscode.commands.executeCommand('platformio-ide.showHome');
}
Expand All @@ -175,13 +180,10 @@ class PlatformIOVSCodeExtension {
));
this.context.subscriptions.push(vscode.commands.registerCommand(
'platformio-ide.upload',
async () => {
await this.terminateMonitorTask();

() => {
let task = 'PlatformIO: Upload';
if (this.getConfig().get('forceUploadAndMonitor')) {
task = 'PlatformIO: Upload and Monitor';
this._isMonitorRun = true;
}
vscode.commands.executeCommand('workbench.action.tasks.runTask', task);
}
Expand All @@ -192,22 +194,15 @@ class PlatformIOVSCodeExtension {
));
this.context.subscriptions.push(vscode.commands.registerCommand(
'platformio-ide.test',
async () => {
await this.terminateMonitorTask();
vscode.commands.executeCommand('workbench.action.tasks.runTask', 'PlatformIO: Test');
}
() => vscode.commands.executeCommand('workbench.action.tasks.runTask', 'PlatformIO: Test')
));
this.context.subscriptions.push(vscode.commands.registerCommand(
'platformio-ide.clean',
() => vscode.commands.executeCommand('workbench.action.tasks.runTask', 'PlatformIO: Clean')
));
this.context.subscriptions.push(vscode.commands.registerCommand(
'platformio-ide.serialMonitor',
async () => {
await this.terminateMonitorTask();
this._isMonitorRun = true;
vscode.commands.executeCommand('workbench.action.tasks.runTask', 'PlatformIO: Monitor');
}
() => vscode.commands.executeCommand('workbench.action.tasks.runTask', 'PlatformIO: Monitor')
));
this.context.subscriptions.push(vscode.commands.registerCommand(
'platformio-ide.newTerminal',
Expand All @@ -223,19 +218,6 @@ class PlatformIOVSCodeExtension {
));
}

async terminateMonitorTask() {
if (!this._isMonitorRun) {
return;
}
try {
await vscode.commands.executeCommand('workbench.action.tasks.terminate');
} catch (err) {
console.error(err);
}
this._isMonitorRun = false;
return new Promise(resolve => setTimeout(() => resolve(), 500));
}

initDebug() {
piodebug.activate(this.context);
}
Expand Down
10 changes: 5 additions & 5 deletions src/project/indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import * as pioNodeHelpers from 'platformio-node-helpers';

import { isPIOProject, notifyError } from '../utils';

import { AUTO_REBUILD_DELAY } from '../constants';
import { isPIOProject } from '../utils';
import path from 'path';
import vscode from 'vscode';

Expand Down Expand Up @@ -84,7 +85,7 @@ export default class ProjectIndexer {
}

} catch (err) {
console.error(err);
notifyError(`Project FileSystemWatcher: ${err.toString()}`, err);
}
}

Expand Down Expand Up @@ -121,7 +122,7 @@ export default class ProjectIndexer {
this.subscriptions.push(watcher);
this.subscriptions.push(subscription);
} catch (err) {
console.error(err);
notifyError(`Project FileSystemWatcher: ${err.toString()}`, err);
}
}

Expand Down Expand Up @@ -174,8 +175,7 @@ export default class ProjectIndexer {
vscode.window.showInformationMessage('PlatformIO: IntelliSense Index has been successfully rebuilt.');
}
} catch (err) {
console.error(err);
vscode.window.showErrorMessage(`PlatformIO: IntelliSense Index failed: ${err.toString()}`);
notifyError(`IntelliSense Index: ${err.toString()}`, err);
}
this._inProgress = false;
});
Expand Down
42 changes: 40 additions & 2 deletions src/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { IS_WINDOWS } from './constants';
import fs from 'fs-plus';
import ini from 'ini';
import { notifyError } from './utils';
import path from 'path';
import vscode from 'vscode';

Expand Down Expand Up @@ -68,6 +69,7 @@ export default class PIOTasksProvider {
this._refreshTimeout = undefined;

this.requestRefresh();
this.controlDeviceMonitorTasks();
}

dispose() {
Expand All @@ -77,6 +79,42 @@ export default class PIOTasksProvider {
this.subscriptions = [];
}

controlDeviceMonitorTasks() {
let restoreAfterTask = undefined;
let restoreTasks = [];

vscode.tasks.onDidStartTaskProcess((event) => {
if (!vscode.workspace.getConfiguration('platformio-ide').get('autoCloseSerialMonitor')) {
return;
}
if (!['upload', 'test'].some(arg => event.execution.task.execution.args.includes(arg))) {
return;
}
vscode.tasks.taskExecutions.forEach((e) => {
if (event.execution.task === e.task) {
return;
}
if (['device', 'monitor'].every(arg => e.task.execution.args.includes(arg))) {
restoreTasks.push(e.task);
}
if (e.task.execution.args.includes('monitor')) {
e.terminate();
}
});
restoreAfterTask = event.execution.task;
});

vscode.tasks.onDidEndTaskProcess((event) => {
if (event.execution.task !== restoreAfterTask) {
return;
}
restoreTasks.forEach(task => {
vscode.tasks.executeTask(task);
});
restoreTasks = [];
});
}

requestRefresh() {
if (this._refreshTimeout) {
clearTimeout(this._refreshTimeout);
Expand All @@ -86,7 +124,7 @@ export default class PIOTasksProvider {

refresh() {
this.dispose();
const provider = vscode.workspace.registerTaskProvider(PIOTasksProvider.title, {
const provider = vscode.tasks.registerTaskProvider(PIOTasksProvider.title, {
provideTasks: () => {
return this.getTasks();
},
Expand Down Expand Up @@ -116,7 +154,7 @@ export default class PIOTasksProvider {
}));

} catch (err) {
console.error(err);
notifyError(`Tasks FileSystemWatcher: ${err.toString()}`, err);
}
}

Expand Down
Loading

0 comments on commit d2d950b

Please sign in to comment.