Skip to content

Commit 1b064c0

Browse files
committed
Merge branch 'release/v1.2.0'
2 parents c4b4757 + 8d68412 commit 1b064c0

File tree

6 files changed

+47
-100
lines changed

6 files changed

+47
-100
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes
22

3+
## 1.2.0 (2018-09-12)
4+
5+
* Added "table of contents" of PIO Home to "PlatformIO View > Quick Access" (left sidebar)
6+
* Fixed issue when CPP files were detected as Arduino
7+
38
## 1.1.1 (2018-09-07)
49

510
* Show "Project Tasks" before "Quick Access" in PlatformIO Activity Bar

package.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "platformio-ide",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"publisher": "platformio",
55
"engines": {
66
"vscode": "^1.24.0"
@@ -70,15 +70,6 @@
7070
".s"
7171
],
7272
"configuration": "./syntaxes/assembly-configuration.json"
73-
},
74-
{
75-
"id": "cpp",
76-
"extensions": [
77-
".ino"
78-
],
79-
"aliases": [
80-
"Arduino"
81-
]
8273
}
8374
],
8475
"grammars": [
@@ -96,11 +87,6 @@
9687
"language": "platformio-debug.asm",
9788
"scopeName": "source.platformio-debug-asm",
9889
"path": "./syntaxes/assembly.tmLanguage"
99-
},
100-
{
101-
"language": "cpp",
102-
"path": "./syntaxes/arduino.tmLanguage",
103-
"scopeName": "source.cpp.arduino"
10490
}
10591
],
10692
"commands": [

src/home.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,29 @@ import vscode from 'vscode';
1616

1717
export default class PIOHome {
1818

19+
static defaultStartUrl = '/';
20+
1921
constructor() {
2022
this.subscriptions = [];
2123
this._currentPanel = undefined;
24+
this._lastStartUrl = PIOHome.defaultStartUrl;
2225
}
2326

24-
async toggle() {
27+
async toggle(startUrl=PIOHome.defaultStartUrl) {
2528
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined;
2629
if (this._currentPanel) {
27-
this._currentPanel.reveal(column);
30+
if (this._lastStartUrl !== startUrl) {
31+
await this.updatePanel(startUrl);
32+
} else {
33+
this._currentPanel.reveal(column);
34+
}
2835
} else {
29-
this._currentPanel = await this.newPanel();
36+
this._currentPanel = await this.newPanel(startUrl);
3037
}
38+
this._lastStartUrl = startUrl;
3139
}
3240

33-
async newPanel() {
41+
async newPanel(startUrl) {
3442
const panel = vscode.window.createWebviewPanel(
3543
'pioHome',
3644
extension.getEnterpriseSetting('pioHomeTitle', 'PIO Home'),
@@ -44,13 +52,21 @@ export default class PIOHome {
4452
panel.iconPath = vscode.Uri.file(path.join(extension.context.extensionPath, 'resources', 'platformio-mini-logo.png'));
4553
panel.webview.html = this.getLoadingContent();
4654
try {
47-
panel.webview.html = await this.getWebviewContent();
55+
panel.webview.html = await this.getWebviewContent(startUrl);
4856
} catch (err) {
4957
notifyError('Start PIO Home Server', err);
5058
}
5159
return panel;
5260
}
5361

62+
async updatePanel(startUrl) {
63+
try {
64+
this._currentPanel.webview.html = await this.getWebviewContent(startUrl);
65+
} catch (err) {
66+
notifyError('Update PIO Home Content', err);
67+
}
68+
}
69+
5470
getTheme() {
5571
const workbench = vscode.workspace.getConfiguration('workbench') || {};
5672
return (workbench.colorTheme || '').toLowerCase().includes('light') ? 'light' : 'dark';
@@ -61,12 +77,12 @@ export default class PIOHome {
6177
return `<!DOCTYPE html>
6278
<html lang="en">
6379
<body style="background-color: ${theme === 'light' ? '#FFF' : '#1E1E1E'}">
64-
Loading...
80+
<div style="padding: 15px;">Loading...</div>
6581
</body>
6682
</html>`;
6783
}
6884

69-
async getWebviewContent() {
85+
async getWebviewContent(startUrl) {
7086
const params = await pioNodeHelpers.home.ensureServerStarted({
7187
onIDECommand: (command, params) => {
7288
if (command === 'open_project') {
@@ -79,13 +95,12 @@ export default class PIOHome {
7995
}
8096
}
8197
});
82-
const start = '/';
8398
const theme = this.getTheme();
8499
return `<!DOCTYPE html>
85100
<html lang="en">
86101
<body style="margin: 0; padding: 0; height: 100%; overflow: hidden; background-color: ${theme === 'light' ? '#FFF' : '#1E1E1E'}">
87102
<iframe src="${ pioNodeHelpers.home.getFrontendUri(params.host, params.port, {
88-
start,
103+
start: startUrl,
89104
theme,
90105
workspace: extension.getEnterpriseSetting('defaultPIOHomeWorkspace')
91106
})}"

src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class PlatformIOVSCodeExtension {
188188
this.subscriptions.push(
189189
vscode.commands.registerCommand(
190190
'platformio-ide.showHome',
191-
() => this.pioHome.toggle()
191+
(startUrl) => this.pioHome.toggle(startUrl)
192192
),
193193
vscode.commands.registerCommand(
194194
'platformio-ide.newTerminal',

src/views/quick-access-tree.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
import * as vscode from 'vscode';
1010

1111
class QuickItem extends vscode.TreeItem {
12-
constructor(label, command, collapsibleState, children) {
12+
constructor(label, command, args, collapsibleState, children) {
1313
super(label, collapsibleState);
1414
if (command) {
1515
this.command = {
1616
title: label,
17-
command
17+
command,
18+
arguments: args
1819
};
1920
}
2021
this.customChildren = children;
@@ -28,16 +29,23 @@ export default class QuickAccessTreeProvider {
2829
return element.customChildren;
2930
}
3031
return [
31-
new QuickItem('PIO Home', 'platformio-ide.showHome'),
32-
new QuickItem('New Terminal', 'platformio-ide.newTerminal'),
3332
new QuickItem('Clone Git Project', 'git.clone'),
34-
new QuickItem('Debug', undefined, vscode.TreeItemCollapsibleState.Expanded, [
33+
new QuickItem('New Terminal', 'platformio-ide.newTerminal'),
34+
new QuickItem('PIO Home', undefined, undefined, vscode.TreeItemCollapsibleState.Expanded, [
35+
new QuickItem('Open', 'platformio-ide.showHome'),
36+
new QuickItem('PIO Account', 'platformio-ide.showHome', ['/account']),
37+
new QuickItem('Libraries', 'platformio-ide.showHome', ['/libraries']),
38+
new QuickItem('Boards', 'platformio-ide.showHome', ['/boards']),
39+
new QuickItem('Platforms', 'platformio-ide.showHome', ['/platforms']),
40+
new QuickItem('Devices', 'platformio-ide.showHome', ['/device']),
41+
]),
42+
new QuickItem('Debug', undefined, undefined, vscode.TreeItemCollapsibleState.Expanded, [
3543
new QuickItem('Start Debugging', 'platformio-ide.startDebugging'),
3644
new QuickItem('Toggle Debug Console', 'workbench.debug.action.toggleRepl')
3745
]),
38-
new QuickItem('Updates', undefined, vscode.TreeItemCollapsibleState.Expanded, [
39-
new QuickItem('Update global libraries', 'platformio-ide.updateGlobalLibs'),
40-
new QuickItem('Update platforms & packages', 'platformio-ide.updatePlatforms'),
46+
new QuickItem('Updates', undefined, undefined, vscode.TreeItemCollapsibleState.Expanded, [
47+
new QuickItem('Library updates', 'platformio-ide.showHome', ['/libraries/updates']),
48+
new QuickItem('Platform updates', 'platformio-ide.showHome', ['/platforms/updates']),
4149
new QuickItem('Update PlatformIO Core packages', 'platformio-ide.updateCore'),
4250
new QuickItem('Upgrade PlatformIO Core', 'platformio-ide.upgradeCore')
4351
])

syntaxes/arduino.tmLanguage

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)