From d735e76989c18b8332a9c8a3209bc9484360a032 Mon Sep 17 00:00:00 2001
From: andreamah
Date: Mon, 24 Feb 2020 16:47:41 -0800
Subject: [PATCH 1/9] initial popup example
---
src/extension.ts | 20 +++++++++++++++++++-
src/service/PopupService.ts | 26 ++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 src/service/PopupService.ts
diff --git a/src/extension.ts b/src/extension.ts
index 21c9b31d5..5b37fd142 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -23,6 +23,7 @@ import { SimulatorDebugConfigurationProvider } from "./simulatorDebugConfigurati
import TelemetryAI from "./telemetry/telemetryAI";
import { UsbDetector } from "./usbDetector";
import { VSCODE_MESSAGES_TO_WEBVIEW, WEBVIEW_MESSAGES } from "./view/constants";
+import { PopupService } from "./service/PopupService"
let currentFileAbsPath: string = "";
let currentTextDocument: vscode.TextDocument;
@@ -118,6 +119,7 @@ export async function activate(context: vscode.ExtensionContext) {
await updateCurrentFileIfPython(document, currentPanel);
}
);
+ PopupService.OPEN_RELEASE_NOTE()
const openWebview = () => {
if (currentPanel) {
@@ -892,6 +894,22 @@ export async function activate(context: vscode.ExtensionContext) {
}
);
+ const showReleaseNote = vscode.commands.registerCommand(
+ "deviceSimulatorExpress.",
+ (port, showWarning = true) => {
+ if (serialMonitor) {
+ telemetryAI.runWithLatencyMeasure(() => {
+ serialMonitor.closeSerialMonitor(port, showWarning);
+ }, TelemetryEventName.CPX_COMMAND_SERIAL_MONITOR_CLOSE);
+ } else {
+ vscode.window.showErrorMessage(
+ CONSTANTS.ERROR.NO_FOLDER_OPENED
+ );
+ console.info("Serial monitor is not defined.");
+ }
+ }
+ );
+
UsbDetector.getInstance().initialize(context.extensionPath);
UsbDetector.getInstance().startListening();
@@ -1026,7 +1044,7 @@ const updateCurrentFileIfPython = async (
if (
currentTextDocument &&
utils.getActiveEditorFromPath(currentTextDocument.fileName) ===
- undefined
+ undefined
) {
await vscode.window.showTextDocument(
currentTextDocument,
diff --git a/src/service/PopupService.ts b/src/service/PopupService.ts
new file mode 100644
index 000000000..6f0cea588
--- /dev/null
+++ b/src/service/PopupService.ts
@@ -0,0 +1,26 @@
+// import { Webview } from "vscode";
+import * as vscode from "vscode";
+
+export class PopupService {
+ public static OPEN_RELEASE_NOTE() {
+ const panel = vscode.window.createWebviewPanel(
+ 'catCoding',
+ 'Cat Coding',
+ vscode.ViewColumn.One,
+ {}
+ );
+
+ // And set its HTML content
+ panel.webview.html = `
+
+
+
+
+ Cat Coding
+
+
+
+
+ `;
+ }
+}
\ No newline at end of file
From 35e4be322c99ad92cf4097496216efdaeaf184ea Mon Sep 17 00:00:00 2001
From: andreamah
Date: Tue, 25 Feb 2020 21:58:22 -0800
Subject: [PATCH 2/9] release note programming done, just needs content
---
src/extension.ts | 11 +++++++++--
src/release_notes/release_note_2020-02-25.html | 12 ++++++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
create mode 100644 src/release_notes/release_note_2020-02-25.html
diff --git a/src/extension.ts b/src/extension.ts
index 5b37fd142..83fa1aa9b 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -24,6 +24,7 @@ import TelemetryAI from "./telemetry/telemetryAI";
import { UsbDetector } from "./usbDetector";
import { VSCODE_MESSAGES_TO_WEBVIEW, WEBVIEW_MESSAGES } from "./view/constants";
import { PopupService } from "./service/PopupService"
+import getPackageInfo from "./telemetry/getPackageInfo";
let currentFileAbsPath: string = "";
let currentTextDocument: vscode.TextDocument;
@@ -78,7 +79,7 @@ const sendCurrentDeviceMessage = (currentPanel: vscode.WebviewPanel) => {
// Extension activation
export async function activate(context: vscode.ExtensionContext) {
console.info(CONSTANTS.INFO.EXTENSION_ACTIVATED);
-
+ console.log(context.workspaceState)
telemetryAI = new TelemetryAI(context);
let currentPanel: vscode.WebviewPanel | undefined;
let childProcess: cp.ChildProcess | undefined;
@@ -119,7 +120,13 @@ export async function activate(context: vscode.ExtensionContext) {
await updateCurrentFileIfPython(document, currentPanel);
}
);
- PopupService.OPEN_RELEASE_NOTE()
+
+ const currVersionReleaseName = "release_note_" + getPackageInfo(context).extensionVersion
+ const viewedReleaseNote = context.workspaceState.get(currVersionReleaseName,false)
+ if (!viewedReleaseNote) {
+ PopupService.OPEN_RELEASE_NOTE()
+ context.workspaceState.update(currVersionReleaseName,true)
+ }
const openWebview = () => {
if (currentPanel) {
diff --git a/src/release_notes/release_note_2020-02-25.html b/src/release_notes/release_note_2020-02-25.html
new file mode 100644
index 000000000..c1628ad6d
--- /dev/null
+++ b/src/release_notes/release_note_2020-02-25.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Cat Coding
+
+
+ yeet
+
+
+
\ No newline at end of file
From 4795b7e4f7c46dc1dfbf3c2f887064c17080c97c Mon Sep 17 00:00:00 2001
From: andreamah
Date: Wed, 26 Feb 2020 12:10:40 -0800
Subject: [PATCH 3/9] release note
---
src/extension.ts | 5 +--
src/latest_release_note.ts | 63 +++++++++++++++++++++++++++++++++++++
src/service/PopupService.ts | 14 ++-------
3 files changed, 68 insertions(+), 14 deletions(-)
create mode 100644 src/latest_release_note.ts
diff --git a/src/extension.ts b/src/extension.ts
index 83fa1aa9b..183cf5eb9 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -122,10 +122,11 @@ export async function activate(context: vscode.ExtensionContext) {
);
const currVersionReleaseName = "release_note_" + getPackageInfo(context).extensionVersion
- const viewedReleaseNote = context.workspaceState.get(currVersionReleaseName,false)
+ const viewedReleaseNote = context.globalState.get(currVersionReleaseName, false)
+
if (!viewedReleaseNote) {
PopupService.OPEN_RELEASE_NOTE()
- context.workspaceState.update(currVersionReleaseName,true)
+ context.globalState.update(currVersionReleaseName, true)
}
const openWebview = () => {
diff --git a/src/latest_release_note.ts b/src/latest_release_note.ts
new file mode 100644
index 000000000..dc5308197
--- /dev/null
+++ b/src/latest_release_note.ts
@@ -0,0 +1,63 @@
+// TODO: find a better way of loading html into a string
+export const LATEST_RELEASE_NOTE = `Device Simulator Express Release Notes π©πΎβπ» π¨πΎβπ» (Feb. 27, 2020)
+
+ Welcome to the first update to the Device Simulator Express! Please feel free to enable our feature flag in
+ Settings
+ (under the setting titled βdeviceSimulatorExpress.previewModeβ in the User settings).
+
+Changes
+
+
Fixes (enabled by default):
+
+ - Enabled support for βfrom adafruit_circuitplayground import cpβ as an import statement for the CPX and
+ changed
+ βNew Fileβ template to use this format.
+
+ - State for sensor selection persists.
+ - More reliable dependency installation and more informative setup fail information.
+ - Fixes to Serial Monitor for CPX device deployment.
+ - More robust debugger functionality.
+ - Fixed spelling and clarity errors in documentation and pop-up messages.
+
+ New features (only available with feature flag enabled):
+
+ - BBC Micro:bit simulator and debugger β open up a new Micro:bit file, write code for the Micro:bit and
+ test it out!
+
+ - Ability to interact with LEDs, buttons, and sensors.
+ - Includes autocompletion and error flagging.
+ - Supports the following:
+
+ - Classes:
+
+ - display
+ - image
+ - accelerometer
+ - button
+
+
+
+ - Global static functions:
+
+ - sleep()
+ - running_time()
+ - temperature()
+
+
+
+
+ - Includes accessibility considerations for simulation.
+
+ - Has ability to use keyboard for button presses and navigation.
+
+
+
+
+
+Happy Hacking! β¨β¨πππ°
+       - The Device Simulator Express Team
`
\ No newline at end of file
diff --git a/src/service/PopupService.ts b/src/service/PopupService.ts
index 6f0cea588..25512f042 100644
--- a/src/service/PopupService.ts
+++ b/src/service/PopupService.ts
@@ -1,5 +1,6 @@
// import { Webview } from "vscode";
import * as vscode from "vscode";
+import { LATEST_RELEASE_NOTE } from "../latest_release_note"
export class PopupService {
public static OPEN_RELEASE_NOTE() {
@@ -10,17 +11,6 @@ export class PopupService {
{}
);
- // And set its HTML content
- panel.webview.html = `
-
-
-
-
- Cat Coding
-
-
-
-
- `;
+ panel.webview.html = LATEST_RELEASE_NOTE;
}
}
\ No newline at end of file
From e15f0ff369beafb012136358c62bdda719fcdbd2 Mon Sep 17 00:00:00 2001
From: andreamah
Date: Wed, 26 Feb 2020 12:12:01 -0800
Subject: [PATCH 4/9] formatting
---
src/extension.ts | 18 +++++++++++-------
src/latest_release_note.ts | 2 +-
src/service/PopupService.ts | 8 ++++----
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/extension.ts b/src/extension.ts
index 183cf5eb9..f21b2be2f 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -23,7 +23,7 @@ import { SimulatorDebugConfigurationProvider } from "./simulatorDebugConfigurati
import TelemetryAI from "./telemetry/telemetryAI";
import { UsbDetector } from "./usbDetector";
import { VSCODE_MESSAGES_TO_WEBVIEW, WEBVIEW_MESSAGES } from "./view/constants";
-import { PopupService } from "./service/PopupService"
+import { PopupService } from "./service/PopupService";
import getPackageInfo from "./telemetry/getPackageInfo";
let currentFileAbsPath: string = "";
@@ -79,7 +79,7 @@ const sendCurrentDeviceMessage = (currentPanel: vscode.WebviewPanel) => {
// Extension activation
export async function activate(context: vscode.ExtensionContext) {
console.info(CONSTANTS.INFO.EXTENSION_ACTIVATED);
- console.log(context.workspaceState)
+ console.log(context.workspaceState);
telemetryAI = new TelemetryAI(context);
let currentPanel: vscode.WebviewPanel | undefined;
let childProcess: cp.ChildProcess | undefined;
@@ -121,12 +121,16 @@ export async function activate(context: vscode.ExtensionContext) {
}
);
- const currVersionReleaseName = "release_note_" + getPackageInfo(context).extensionVersion
- const viewedReleaseNote = context.globalState.get(currVersionReleaseName, false)
+ const currVersionReleaseName =
+ "release_note_" + getPackageInfo(context).extensionVersion;
+ const viewedReleaseNote = context.globalState.get(
+ currVersionReleaseName,
+ false
+ );
if (!viewedReleaseNote) {
- PopupService.OPEN_RELEASE_NOTE()
- context.globalState.update(currVersionReleaseName, true)
+ PopupService.OPEN_RELEASE_NOTE();
+ context.globalState.update(currVersionReleaseName, true);
}
const openWebview = () => {
@@ -1052,7 +1056,7 @@ const updateCurrentFileIfPython = async (
if (
currentTextDocument &&
utils.getActiveEditorFromPath(currentTextDocument.fileName) ===
- undefined
+ undefined
) {
await vscode.window.showTextDocument(
currentTextDocument,
diff --git a/src/latest_release_note.ts b/src/latest_release_note.ts
index dc5308197..500d18d79 100644
--- a/src/latest_release_note.ts
+++ b/src/latest_release_note.ts
@@ -60,4 +60,4 @@ export const LATEST_RELEASE_NOTE = `Device Simulator Express Release Notes
Happy Hacking! β¨β¨πππ°
-       - The Device Simulator Express Team
`
\ No newline at end of file
+       - The Device Simulator Express Team`;
diff --git a/src/service/PopupService.ts b/src/service/PopupService.ts
index 25512f042..b2f8493b3 100644
--- a/src/service/PopupService.ts
+++ b/src/service/PopupService.ts
@@ -1,16 +1,16 @@
// import { Webview } from "vscode";
import * as vscode from "vscode";
-import { LATEST_RELEASE_NOTE } from "../latest_release_note"
+import { LATEST_RELEASE_NOTE } from "../latest_release_note";
export class PopupService {
public static OPEN_RELEASE_NOTE() {
const panel = vscode.window.createWebviewPanel(
- 'catCoding',
- 'Cat Coding',
+ "catCoding",
+ "Cat Coding",
vscode.ViewColumn.One,
{}
);
panel.webview.html = LATEST_RELEASE_NOTE;
}
-}
\ No newline at end of file
+}
From 4afc2e02421cef51e8b7ab378200e076282569cb Mon Sep 17 00:00:00 2001
From: andreamah
Date: Wed, 26 Feb 2020 12:18:39 -0800
Subject: [PATCH 5/9] fixed title
---
src/service/PopupService.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/service/PopupService.ts b/src/service/PopupService.ts
index b2f8493b3..021dd3c97 100644
--- a/src/service/PopupService.ts
+++ b/src/service/PopupService.ts
@@ -5,8 +5,8 @@ import { LATEST_RELEASE_NOTE } from "../latest_release_note";
export class PopupService {
public static OPEN_RELEASE_NOTE() {
const panel = vscode.window.createWebviewPanel(
- "catCoding",
- "Cat Coding",
+ "releaseNote",
+ "Release Note",
vscode.ViewColumn.One,
{}
);
From b9f3afab51e4cfc8d3a3a97200a6f71c6feb5446 Mon Sep 17 00:00:00 2001
From: andreamah
Date: Wed, 26 Feb 2020 12:20:49 -0800
Subject: [PATCH 6/9] detailed fix
---
src/extension.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/extension.ts b/src/extension.ts
index f21b2be2f..8d2391e24 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -79,7 +79,7 @@ const sendCurrentDeviceMessage = (currentPanel: vscode.WebviewPanel) => {
// Extension activation
export async function activate(context: vscode.ExtensionContext) {
console.info(CONSTANTS.INFO.EXTENSION_ACTIVATED);
- console.log(context.workspaceState);
+
telemetryAI = new TelemetryAI(context);
let currentPanel: vscode.WebviewPanel | undefined;
let childProcess: cp.ChildProcess | undefined;
@@ -1056,7 +1056,7 @@ const updateCurrentFileIfPython = async (
if (
currentTextDocument &&
utils.getActiveEditorFromPath(currentTextDocument.fileName) ===
- undefined
+ undefined
) {
await vscode.window.showTextDocument(
currentTextDocument,
From ea2dfcf2d1f7c6b69a6945946484ee506ff4c0aa Mon Sep 17 00:00:00 2001
From: andreamah
Date: Wed, 26 Feb 2020 12:36:06 -0800
Subject: [PATCH 7/9] formatting
---
src/extension.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extension.ts b/src/extension.ts
index 8d2391e24..d8db82e76 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -1056,7 +1056,7 @@ const updateCurrentFileIfPython = async (
if (
currentTextDocument &&
utils.getActiveEditorFromPath(currentTextDocument.fileName) ===
- undefined
+ undefined
) {
await vscode.window.showTextDocument(
currentTextDocument,
From 807fd0b1002289e2b955b8b592b43d0e79a74cd4 Mon Sep 17 00:00:00 2001
From: andreamah
Date: Wed, 26 Feb 2020 13:11:48 -0800
Subject: [PATCH 8/9] pr feedback
---
src/extension.ts | 2 +-
src/release_notes/release_note_2020-02-25.html | 12 ------------
src/service/PopupService.ts | 2 +-
3 files changed, 2 insertions(+), 14 deletions(-)
delete mode 100644 src/release_notes/release_note_2020-02-25.html
diff --git a/src/extension.ts b/src/extension.ts
index d8db82e76..416169896 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -129,7 +129,7 @@ export async function activate(context: vscode.ExtensionContext) {
);
if (!viewedReleaseNote) {
- PopupService.OPEN_RELEASE_NOTE();
+ PopupService.openReleaseNote();
context.globalState.update(currVersionReleaseName, true);
}
diff --git a/src/release_notes/release_note_2020-02-25.html b/src/release_notes/release_note_2020-02-25.html
deleted file mode 100644
index c1628ad6d..000000000
--- a/src/release_notes/release_note_2020-02-25.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
- Cat Coding
-
-
- yeet
-
-
-
\ No newline at end of file
diff --git a/src/service/PopupService.ts b/src/service/PopupService.ts
index 021dd3c97..9bff8ba5b 100644
--- a/src/service/PopupService.ts
+++ b/src/service/PopupService.ts
@@ -3,7 +3,7 @@ import * as vscode from "vscode";
import { LATEST_RELEASE_NOTE } from "../latest_release_note";
export class PopupService {
- public static OPEN_RELEASE_NOTE() {
+ public static openReleaseNote() {
const panel = vscode.window.createWebviewPanel(
"releaseNote",
"Release Note",
From b3dfaa81afbe9636c14b05dab8cf395695b32be7 Mon Sep 17 00:00:00 2001
From: andreamah
Date: Wed, 26 Feb 2020 18:48:45 -0800
Subject: [PATCH 9/9] formatting
---
src/extension.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extension.ts b/src/extension.ts
index 4a9f509b1..4bdf1d9cf 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -1073,7 +1073,7 @@ const updateCurrentFileIfPython = async (
if (
currentTextDocument &&
utils.getActiveEditorFromPath(currentTextDocument.fileName) ===
- undefined
+ undefined
) {
await vscode.window.showTextDocument(
currentTextDocument,