Skip to content

Commit

Permalink
Merge branch 'release/v0.14.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Apr 9, 2018
2 parents 79b7709 + ad50a99 commit c764b28
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 0.14.1 (2018-04-09)

* Temporary workaround for urgent VSCode bug in v1.22 with a broken task runner for Windows OS (issue [#97](https://github.com/platformio/platformio-vscode-ide/issues/97))

## 0.14.0 (2018-03-14)

* Intial support for PIO Enterprise
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "platformio-ide",
"version": "0.14.0",
"version": "0.14.1",
"publisher": "platformio",
"engines": {
"vscode": "^1.18.0"
Expand Down Expand Up @@ -230,7 +230,7 @@
"vscode:package": "babel src --out-dir lib && vsce package"
},
"devDependencies": {
"@types/node": "^6.0.101",
"@types/node": "^7",
"babel-cli": "^6.24.1",
"babel-eslint": "^8.0.1",
"babel-plugin-transform-class-properties": "^6.24.1",
Expand All @@ -244,7 +244,7 @@
"dependencies": {
"fs-plus": "^3.0.0",
"ini": "^1.3.4",
"platformio-node-helpers": "^0.4.3"
"platformio-node-helpers": "^0.5.1"
},
"extensionDependencies": [
"ms-vscode.cpptools",
Expand Down
2 changes: 1 addition & 1 deletion src/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class HomeContentProvider {
<iframe src="${ pioNodeHelpers.home.getFrontendUri(params.host, params.port, {
start,
theme,
workspace: extension.loadEnterpriseSettings().defaultPIOHomeWorkspace
workspace: extension.getEnterpriseSetting('defaultPIOHomeWorkspace')
}) }"
width="100%"
height="100%"
Expand Down
38 changes: 30 additions & 8 deletions src/installer/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as pioNodeHelpers from 'platformio-node-helpers';
import { PIO_CORE_MIN_VERSION } from '../constants';
import PythonPrompt from './python-prompt';
import StateStorage from './state-storage';
import { extension } from '../main';
import vscode from 'vscode';


Expand All @@ -25,14 +26,35 @@ export default class InstallationManager {
this.stateStorage = new StateStorage(globalState, this.STORAGE_STATE_KEY);

const config = vscode.workspace.getConfiguration('platformio-ide');
const defaultParams = {
pioCoreMinVersion: PIO_CORE_MIN_VERSION,
useBuiltinPIOCore: config.get('useBuiltinPIOCore'),
setUseBuiltinPIOCore: (value) => config.update('platformio-ide.useBuiltinPIOCore', value),
useDevelopmentPIOCore: config.get('useDevelopmentPIOCore'),
pythonPrompt: new PythonPrompt()
};
this.stages = [
new pioNodeHelpers.installer.PlatformIOCoreStage(this.stateStorage, this.onDidStatusChange.bind(this), {
pioCoreMinVersion: PIO_CORE_MIN_VERSION,
useBuiltinPIOCore: config.get('useBuiltinPIOCore'),
setUseBuiltinPIOCore: (value) => config.update('platformio-ide.useBuiltinPIOCore', value),
useDevelopmentPIOCore: config.get('useDevelopmentPIOCore'),
pythonPrompt: new PythonPrompt()
}),
new pioNodeHelpers.installer.PlatformIOCoreStage(
this.stateStorage,
this.onDidStatusChange.bind(this),
new Proxy(defaultParams, {
get: (obj, prop) => {
if (prop in obj) {
return obj[prop];
}
// wait a while when enterprise settings will be loaded
else if (prop === 'autorunPIOCmds') {
return [
{
args: ['home', '--host', '__do_not_start__'],
when: 'post-install',
suppressError: true
}
].concat(extension.getEnterpriseSetting('autorunPIOCoreCmds', []));
}
return undefined;
}
})),
];
}

Expand Down Expand Up @@ -75,7 +97,7 @@ export default class InstallationManager {
}

async install() {
await Promise.all(this.stages.map(stage => stage.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',
Expand Down
21 changes: 18 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class PlatformIOVSCodeExtension {

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

async activate(context) {
Expand Down Expand Up @@ -59,7 +60,7 @@ class PlatformIOVSCodeExtension {
}

this.initTasksProvider();
this.initStatusBar({ ignoreCommands: this.loadEnterpriseSettings().ignoreToolbarCommands });
this.initStatusBar({ ignoreCommands: this.getEnterpriseSetting('ignoreToolbarCommands') });
this.initProjectIndexer();
await this.startPIOHome();
}
Expand All @@ -69,13 +70,27 @@ class PlatformIOVSCodeExtension {
}

loadEnterpriseSettings() {
const ext = vscode.extensions.all.find(item => item.id.startsWith('platformio.') && item.id !== 'platformio.platformio-ide');
const ext = vscode.extensions.all.find(item =>
item.id.startsWith('platformio.')
&& item.id !== 'platformio.platformio-ide'
&& item.isActive
);
if (!ext || !ext.exports || !ext.exports.hasOwnProperty('settings')) {
return {};
return;
}
return ext.exports.settings;
}

getEnterpriseSetting(id, defaultValue=undefined) {
if (!this._enterpriseSettings) {
this._enterpriseSettings = this.loadEnterpriseSettings();
}
if (!this._enterpriseSettings || !this._enterpriseSettings.hasOwnProperty(id)) {
return defaultValue;
}
return this._enterpriseSettings[id];
}

workspaceHasPIOProject() {
return vscode.workspace.rootPath && isPIOProject(vscode.workspace.rootPath);
}
Expand Down
12 changes: 11 additions & 1 deletion src/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,24 @@ class TaskCreator {
}

create() {
let pioCmd = 'platformio';
if (IS_WINDOWS) {
pioCmd = 'platformio.exe';
process.env.PATH.split(path.delimiter).forEach(item => {
if (fs.isFileSync(path.join(item, pioCmd))) {
pioCmd = path.join(item, pioCmd);
return;
}
});
}
const task = new vscode.Task(
{
type: PIOTasksProvider.title,
args: this._args
},
this.name,
PIOTasksProvider.title,
new vscode.ProcessExecution(IS_WINDOWS ? 'platformio.exe' : 'platformio', this._args, {
new vscode.ProcessExecution(pioCmd, this._args, {
env: process.env
}),
'$platformio'
Expand Down

0 comments on commit c764b28

Please sign in to comment.