Skip to content

Commit

Permalink
Merge branch 'release/v1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Oct 2, 2018
2 parents af81edb + 5493b2e commit 5ee0739
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes

## 1.3.1 (2018-10-02)

* Added "Update All (libraries, platforms, and packages)" and "Upgrade PlatformIO Core" tasks to global VSCode Task Manager (issue [#335]
* Improvements for [PIO Unified Debugger](http://docs.platformio.org/page/plus/debugging.html):
- Fixed an issue with empty call stack when initial breakpoint is disabled using [debug_init_break](http://docs.platformio.org/en/latest/projectconf/section_env_debug.html#debug-init-break)

## 1.3.0 (2018-09-21)

* Configure time in milliseconds after which reopen Serial Port Monitor using new option `platformio-ide.reopenSerialMonitorDelay`
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "platformio-ide",
"version": "1.3.0",
"version": "1.3.1",
"publisher": "platformio",
"engines": {
"vscode": "^1.24.0"
Expand Down Expand Up @@ -419,7 +419,7 @@
"views": {
"platformio": [
{
"id": "platformio-activitybar.tasks",
"id": "platformio-activitybar.projectTasks",
"name": "Project Tasks",
"when": "pioCoreReady"
},
Expand Down Expand Up @@ -579,7 +579,7 @@
"devDependencies": {
"@types/node": "^8",
"babel-cli": "^6.24.1",
"babel-eslint": "^9.0.0",
"babel-eslint": "^10.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.0",
"esformatter": "^0.10.0",
Expand All @@ -590,8 +590,8 @@
},
"dependencies": {
"fs-plus": "^3.0.0",
"platformio-node-helpers": "^3.1.2",
"platformio-vscode-debug": "^1.2.1"
"platformio-node-helpers": "^3.2.0",
"platformio-vscode-debug": "^1.2.2"
},
"extensionDependencies": [
"ms-vscode.cpptools"
Expand Down
14 changes: 7 additions & 7 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import PIOHome from './home';
import PIOTerminal from './terminal';
import QuickAccessTreeProvider from './views/quick-access-tree';
import TaskManager from './tasks';
import TasksTreeProvider from './views/tasks-tree';
import ProjectTasksTreeProvider from './views/project-tasks-tree';
import { maybeRateExtension } from './misc';
import path from 'path';
import vscode from 'vscode';
Expand Down Expand Up @@ -65,10 +65,10 @@ class PlatformIOVSCodeExtension {
this.initDebug();
this.registerGlobalCommands();

// workaround: init empty Tasks view to keep it above QuickAccess
// workaround: init empty Project Tasks view to keep it above QuickAccess
this.taskSubscriptions.push(
vscode.window.registerTreeDataProvider('platformio-activitybar.tasks',
new TasksTreeProvider([]))
vscode.window.registerTreeDataProvider('platformio-activitybar.projectTasks',
new ProjectTasksTreeProvider([]))
);
this.subscriptions.push(
vscode.window.registerTreeDataProvider('platformio-activitybar.quickAccess',
Expand Down Expand Up @@ -270,11 +270,11 @@ class PlatformIOVSCodeExtension {

initTasks() {
const manager = new TaskManager();
this.subscriptions.push(manager, manager.onDidTasksUpdated(tasks => {
this.subscriptions.push(manager, manager.onDidProjectTasksUpdated(tasks => {
this.disposeTaskSubscriptions();
this.taskSubscriptions.push(
vscode.window.registerTreeDataProvider('platformio-activitybar.tasks',
new TasksTreeProvider(tasks))
vscode.window.registerTreeDataProvider('platformio-activitybar.projectTasks',
new ProjectTasksTreeProvider(tasks))
);
}));
manager.registerProvider();
Expand Down
35 changes: 23 additions & 12 deletions src/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default class TaskManager {
constructor() {
this.subscriptions = [];
this.internalSubscriptions = [];
this.onDidTasksUpdatedCallbacks = [];
this.onDidProjectTasksUpdatedCallbacks = [];

this._projectDir = undefined;
this._refreshTimeout = undefined;
this._tasks = undefined;
this._projecTasks = undefined;

this.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(
() => this.checkActiveProjectDir())
Expand All @@ -37,12 +37,23 @@ export default class TaskManager {
}

async getTasks() {
if (this._tasks) {
return this._tasks;
return [...(await this.getProjectTasks()), ...this.getServiceTasks()];
}

async getProjectTasks() {
if (this._projecTasks) {
return this._projecTasks;
}
const pt = new pioNodeHelpers.project.ProjectTasks(this._projectDir, 'vscode');
this._tasks = await pt.getTasks();
return this._tasks;
this._projecTasks = await pt.getTasks();
return this._projecTasks;
}

getServiceTasks() {
return [
new pioNodeHelpers.project.TaskItem('Update All (libraries, platforms, and packages)', undefined, ['update']),
new pioNodeHelpers.project.TaskItem('Upgrade PlatformIO Core', undefined, ['upgrade'])
];
}

toVSCodeTask(projectTask) {
Expand Down Expand Up @@ -91,14 +102,14 @@ export default class TaskManager {
this.requestRefresh();
}

onDidTasksUpdated(callback) {
this.onDidTasksUpdatedCallbacks.push(callback);
return new vscode.Disposable(() => pioNodeHelpers.misc.arrayRemove(this.onDidTasksUpdatedCallbacks, callback));
onDidProjectTasksUpdated(callback) {
this.onDidProjectTasksUpdatedCallbacks.push(callback);
return new vscode.Disposable(() => pioNodeHelpers.misc.arrayRemove(this.onDidProjectTasksUpdatedCallbacks, callback));
}

disposeInternal() {
pioNodeHelpers.misc.disposeSubscriptions(this.internalSubscriptions);
this._tasks = undefined;
this._projecTasks = undefined;
}

dispose() {
Expand Down Expand Up @@ -128,8 +139,8 @@ export default class TaskManager {
this.addProjectConfigWatcher(this._projectDir);
this.controlDeviceMonitorTasks();
}
const tasks = await this.getTasks();
this.onDidTasksUpdatedCallbacks.forEach(cb => cb(tasks));
const projectTasks = await this.getProjectTasks();
this.onDidProjectTasksUpdatedCallbacks.forEach(cb => cb(projectTasks));
}

addProjectConfigWatcher(projectDir) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import TaskManager from '../tasks';
import { extension } from '../main';
import path from 'path';

export default class TasksTreeProvider {
export default class ProjectTasksTreeProvider {

constructor(tasks) {
this.tasks = tasks;
Expand Down

0 comments on commit 5ee0739

Please sign in to comment.