Skip to content

Commit

Permalink
Merge branch 'release/v1.4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Nov 23, 2018
2 parents 1b57f80 + e05b7ba commit 800e387
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## 1.4.6 (2018-11-23)

* Warn about using .INO files that leads to the spurious problems with C/C++ IntelliSense service (issue [#400](https://github.com/platformio/platformio-vscode-ide/issues/400))
* Use actual Python path when creating a virtual environment
* Shutdown all PIO Home servers when can't start a new one
* Better explanation about PIP issue on Windows

## 1.4.5 (2018-11-18)

* Reduced startup-time using extension bundling
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "platformio-ide",
"version": "1.4.5",
"version": "1.4.6",
"publisher": "platformio",
"engines": {
"vscode": "^1.24.0"
Expand Down Expand Up @@ -576,6 +576,7 @@
"devDependencies": {
"@babel/core": "^7.1.6",
"@types/node": "^8",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.0",
Expand All @@ -590,7 +591,7 @@
},
"dependencies": {
"fs-plus": "^3.0.0",
"platformio-node-helpers": "^3.5.1",
"platformio-node-helpers": "^3.5.3",
"platformio-vscode-debug": "^1.2.5"
},
"extensionDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion src/installer/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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 StateStorage from '../state-storage';
import vscode from 'vscode';


Expand Down
10 changes: 8 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import PIOHome from './home';
import PIOTerminal from './terminal';
import ProjectTasksTreeProvider from './views/project-tasks-tree';
import QuickAccessTreeProvider from './views/quick-access-tree';
import StateStorage from './state-storage';
import TaskManager from './tasks';
import path from 'path';
import vscode from 'vscode';
Expand All @@ -34,6 +35,7 @@ class PlatformIOVSCodeExtension {

async activate(context) {
this.context = context;
this.stateStorage = new StateStorage(context.globalState);
this.pioHome = new PIOHome();
this.pioTerm = new PIOTerminal();

Expand Down Expand Up @@ -89,9 +91,13 @@ class PlatformIOVSCodeExtension {

this.initToolbar({ ignoreCommands: this.getEnterpriseSetting('ignoreToolbarCommands') });
this.initProjectIndexer();
await this.startPIOHome();
misc.maybeRateExtension(this.context.globalState);
this.startPIOHome();

misc.maybeRateExtension(this.stateStorage);
misc.warnAboutConflictedExtensions();
this.subscriptions.push(
vscode.window.onDidChangeActiveTextEditor(editor => misc.warnAboutInoFile(editor, this.stateStorage))
);
}

getConfig() {
Expand Down
46 changes: 38 additions & 8 deletions src/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { CONFLICTED_EXTENSION_IDS } from './constants';
import vscode from 'vscode';


export async function maybeRateExtension(globalState) {
const momentoKey = 'rate-extension-state';
export async function maybeRateExtension(stateStorage) {
const stateKey = 'rate-extension';
const askAfterSessionNums = 13;
let state = globalState.get(momentoKey);
let state = stateStorage.getValue(stateKey);
if (state && state.done) {
return;
}
Expand All @@ -26,15 +26,15 @@ export async function maybeRateExtension(globalState) {

state.callCounter += 1;
if (state.callCounter < askAfterSessionNums) {
globalState.update(momentoKey, state);
stateStorage.setValue(stateKey, state);
return;
}

const selectedItem = await vscode.window.showInformationMessage(
'If you enjoy using PlatformIO IDE for VSCode, would you mind taking a moment to rate it? ' +
'It will not take more than one minute. Thanks for your support!',
{ title: 'Rate PlatformIO IDE Extension', isCloseAffordance: false },
{ title: 'Remind me later', isCloseAffordance: false },
{ title: 'Remind later', isCloseAffordance: false },
{ title: 'No, Thanks', isCloseAffordance: true }
);

Expand All @@ -49,7 +49,7 @@ export async function maybeRateExtension(globalState) {
default:
state.callCounter = 0;
}
globalState.update(momentoKey, state);
stateStorage.setValue(stateKey, state);
}

export async function warnAboutConflictedExtensions() {
Expand All @@ -62,10 +62,10 @@ export async function warnAboutConflictedExtensions() {
const selectedItem = await vscode.window.showWarningMessage(
`Conflicted extensions with IntelliSense service were detected (${conflicted.join(', ')}). ` +
'Code-completion, linting and navigation will not work properly. ' +
'Please disable or uninstall them.',
'Please disable or uninstall them (Menu > View > Extensions).',
{ title: 'Show extensions', isCloseAffordance: false },
{ title: 'More details', isCloseAffordance: false },
{ title: 'Remind me later', isCloseAffordance: true }
{ title: 'Remind later', isCloseAffordance: true }
);
switch (selectedItem ? selectedItem.title : undefined) {
case 'More details':
Expand All @@ -75,4 +75,34 @@ export async function warnAboutConflictedExtensions() {
vscode.commands.executeCommand('workbench.extensions.action.showEnabledExtensions');
break;
}
}

export async function warnAboutInoFile(editor, stateStorage) {
if (!editor || !editor.document || !editor.document.fileName) {
return;
}
if (!editor.document.fileName.endsWith('.ino')) {
return;
}
const stateKey = 'ino-warn-disabled';
if (stateStorage.getValue(stateKey)) {
return;
}

const selectedItem = await vscode.window.showWarningMessage(
'C/C++ IntelliSense service does not support .INO files. ' +
'It might lead to the spurious problems with code completion, linting, and debugging. ' +
'Please convert .INO sketch into the valid .CPP file.',
{ title: 'Show instruction', isCloseAffordance: false },
{ title: 'Do not show again', isCloseAffordance: false },
{ title: 'Remind later', isCloseAffordance: true }
);
switch (selectedItem ? selectedItem.title : undefined) {
case 'Show instruction':
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('http://bit.ly/ino2cpp'));
break;
case 'Do not show again':
stateStorage.setValue(stateKey, 1);
break;
}
}
2 changes: 1 addition & 1 deletion src/installer/state-storage.js → src/state-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

export default class StateStorage {

constructor(globalState, stateKey) {
constructor(globalState, stateKey='miscStates') {
this._globalState = globalState;
this._stateKey = stateKey;
}
Expand Down

0 comments on commit 800e387

Please sign in to comment.