Skip to content

Commit

Permalink
Merge branch 'release/v1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Sep 12, 2018
2 parents c4b4757 + 8d68412 commit 1b064c0
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 100 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## 1.2.0 (2018-09-12)

* Added "table of contents" of PIO Home to "PlatformIO View > Quick Access" (left sidebar)
* Fixed issue when CPP files were detected as Arduino

## 1.1.1 (2018-09-07)

* Show "Project Tasks" before "Quick Access" in PlatformIO Activity Bar
Expand Down
16 changes: 1 addition & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "platformio-ide",
"version": "1.1.1",
"version": "1.2.0",
"publisher": "platformio",
"engines": {
"vscode": "^1.24.0"
Expand Down Expand Up @@ -70,15 +70,6 @@
".s"
],
"configuration": "./syntaxes/assembly-configuration.json"
},
{
"id": "cpp",
"extensions": [
".ino"
],
"aliases": [
"Arduino"
]
}
],
"grammars": [
Expand All @@ -96,11 +87,6 @@
"language": "platformio-debug.asm",
"scopeName": "source.platformio-debug-asm",
"path": "./syntaxes/assembly.tmLanguage"
},
{
"language": "cpp",
"path": "./syntaxes/arduino.tmLanguage",
"scopeName": "source.cpp.arduino"
}
],
"commands": [
Expand Down
33 changes: 24 additions & 9 deletions src/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,29 @@ import vscode from 'vscode';

export default class PIOHome {

static defaultStartUrl = '/';

constructor() {
this.subscriptions = [];
this._currentPanel = undefined;
this._lastStartUrl = PIOHome.defaultStartUrl;
}

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

async newPanel() {
async newPanel(startUrl) {
const panel = vscode.window.createWebviewPanel(
'pioHome',
extension.getEnterpriseSetting('pioHomeTitle', 'PIO Home'),
Expand All @@ -44,13 +52,21 @@ export default class PIOHome {
panel.iconPath = vscode.Uri.file(path.join(extension.context.extensionPath, 'resources', 'platformio-mini-logo.png'));
panel.webview.html = this.getLoadingContent();
try {
panel.webview.html = await this.getWebviewContent();
panel.webview.html = await this.getWebviewContent(startUrl);
} catch (err) {
notifyError('Start PIO Home Server', err);
}
return panel;
}

async updatePanel(startUrl) {
try {
this._currentPanel.webview.html = await this.getWebviewContent(startUrl);
} catch (err) {
notifyError('Update PIO Home Content', err);
}
}

getTheme() {
const workbench = vscode.workspace.getConfiguration('workbench') || {};
return (workbench.colorTheme || '').toLowerCase().includes('light') ? 'light' : 'dark';
Expand All @@ -61,12 +77,12 @@ export default class PIOHome {
return `<!DOCTYPE html>
<html lang="en">
<body style="background-color: ${theme === 'light' ? '#FFF' : '#1E1E1E'}">
Loading...
<div style="padding: 15px;">Loading...</div>
</body>
</html>`;
}

async getWebviewContent() {
async getWebviewContent(startUrl) {
const params = await pioNodeHelpers.home.ensureServerStarted({
onIDECommand: (command, params) => {
if (command === 'open_project') {
Expand All @@ -79,13 +95,12 @@ export default class PIOHome {
}
}
});
const start = '/';
const theme = this.getTheme();
return `<!DOCTYPE html>
<html lang="en">
<body style="margin: 0; padding: 0; height: 100%; overflow: hidden; background-color: ${theme === 'light' ? '#FFF' : '#1E1E1E'}">
<iframe src="${ pioNodeHelpers.home.getFrontendUri(params.host, params.port, {
start,
start: startUrl,
theme,
workspace: extension.getEnterpriseSetting('defaultPIOHomeWorkspace')
})}"
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class PlatformIOVSCodeExtension {
this.subscriptions.push(
vscode.commands.registerCommand(
'platformio-ide.showHome',
() => this.pioHome.toggle()
(startUrl) => this.pioHome.toggle(startUrl)
),
vscode.commands.registerCommand(
'platformio-ide.newTerminal',
Expand Down
24 changes: 16 additions & 8 deletions src/views/quick-access-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import * as vscode from 'vscode';

class QuickItem extends vscode.TreeItem {
constructor(label, command, collapsibleState, children) {
constructor(label, command, args, collapsibleState, children) {
super(label, collapsibleState);
if (command) {
this.command = {
title: label,
command
command,
arguments: args
};
}
this.customChildren = children;
Expand All @@ -28,16 +29,23 @@ export default class QuickAccessTreeProvider {
return element.customChildren;
}
return [
new QuickItem('PIO Home', 'platformio-ide.showHome'),
new QuickItem('New Terminal', 'platformio-ide.newTerminal'),
new QuickItem('Clone Git Project', 'git.clone'),
new QuickItem('Debug', undefined, vscode.TreeItemCollapsibleState.Expanded, [
new QuickItem('New Terminal', 'platformio-ide.newTerminal'),
new QuickItem('PIO Home', undefined, undefined, vscode.TreeItemCollapsibleState.Expanded, [
new QuickItem('Open', 'platformio-ide.showHome'),
new QuickItem('PIO Account', 'platformio-ide.showHome', ['/account']),
new QuickItem('Libraries', 'platformio-ide.showHome', ['/libraries']),
new QuickItem('Boards', 'platformio-ide.showHome', ['/boards']),
new QuickItem('Platforms', 'platformio-ide.showHome', ['/platforms']),
new QuickItem('Devices', 'platformio-ide.showHome', ['/device']),
]),
new QuickItem('Debug', undefined, undefined, vscode.TreeItemCollapsibleState.Expanded, [
new QuickItem('Start Debugging', 'platformio-ide.startDebugging'),
new QuickItem('Toggle Debug Console', 'workbench.debug.action.toggleRepl')
]),
new QuickItem('Updates', undefined, vscode.TreeItemCollapsibleState.Expanded, [
new QuickItem('Update global libraries', 'platformio-ide.updateGlobalLibs'),
new QuickItem('Update platforms & packages', 'platformio-ide.updatePlatforms'),
new QuickItem('Updates', undefined, undefined, vscode.TreeItemCollapsibleState.Expanded, [
new QuickItem('Library updates', 'platformio-ide.showHome', ['/libraries/updates']),
new QuickItem('Platform updates', 'platformio-ide.showHome', ['/platforms/updates']),
new QuickItem('Update PlatformIO Core packages', 'platformio-ide.updateCore'),
new QuickItem('Upgrade PlatformIO Core', 'platformio-ide.upgradeCore')
])
Expand Down
67 changes: 0 additions & 67 deletions syntaxes/arduino.tmLanguage

This file was deleted.

0 comments on commit 1b064c0

Please sign in to comment.