Skip to content

Commit 18d04db

Browse files
feat: Pymakr home view
1 parent c83b67d commit 18d04db

File tree

5 files changed

+324
-7
lines changed

5 files changed

+324
-7
lines changed

package-lock.json

+169-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+28-5
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,24 @@
269269
"views": {
270270
"pymakr": [
271271
{
272-
"id": "pymakr-projects-tree",
273-
"name": "Projects",
274-
"icon": "media/pycom.svg",
275-
"contextualTitle": "Pymakr"
272+
"id": "pymakr-home-view",
273+
"name": "Pymakr Home",
274+
"type": "webview"
276275
},
277276
{
278277
"id": "pymakr-devices-tree",
279278
"name": "Devices",
280279
"icon": "media/pycom.svg",
281-
"contextualTitle": "Pymakr"
280+
"contextualTitle": "Pymakr",
281+
"type": "tree"
282+
}
283+
],
284+
"explorer": [
285+
{
286+
"id": "pymakr-projects-tree",
287+
"name": "Pymakr: Projects",
288+
"icon": "media/pycom.svg",
289+
"type": "tree"
282290
}
283291
]
284292
},
@@ -358,6 +366,16 @@
358366
}
359367
],
360368
"commands": [
369+
{
370+
"command": "pymakr.openWalkthrough",
371+
"title": "Open the Pymakr walkthrough",
372+
"category": "PyMakr"
373+
},
374+
{
375+
"command": "pymakr.showMarkdownDocument",
376+
"title": "Show a markdown document",
377+
"category": "PyMakr"
378+
},
361379
{
362380
"command": "pymakr.debug.showDeviceSummary",
363381
"title": "Show device summary",
@@ -623,6 +641,10 @@
623641
],
624642
"menus": {
625643
"commandPalette": [
644+
{
645+
"command": "pymakr.showMarkdownDocument",
646+
"when": "false"
647+
},
626648
{
627649
"command": "pymakr.listDevices"
628650
},
@@ -962,6 +984,7 @@
962984
},
963985
"dependencies": {
964986
"@serialport/bindings-cpp": "^10.7.0",
987+
"@vscode/webview-ui-toolkit": "^1.0.0",
965988
"cheap-watch": "^1.0.4",
966989
"consolite": "^0.3.8",
967990
"hookar": "^0.0.7-0",

src/PyMakr.js

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const { createVSCodeHelpers } = require("./utils/vscodeHelpers");
1616
const { TextDocumentProvider } = require("./providers/TextDocumentProvider");
1717
const { createStateObject } = require("./utils/storageObj");
1818
const { Notifier } = require("./utils/Notifier");
19+
const { HomeProvider } = require("./providers/HomeProvider");
1920

2021
/**
2122
* Pymakr is the root class and scope of the extension.
@@ -81,6 +82,8 @@ class PyMakr {
8182
this.devicesProvider = new DevicesProvider(this);
8283
/** Provides device access for the file explorer */
8384
this.fileSystemProvider = new FileSystemProvider(this);
85+
/** Provides the home screen in the Pycom tab */
86+
this.homeProvider = new HomeProvider(this);
8487

8588
this.textDocumentProvider = new TextDocumentProvider(this);
8689

@@ -157,6 +160,7 @@ class PyMakr {
157160
vscode.window.registerTerminalProfileProvider("pymakr.terminal-profile", {
158161
provideTerminalProfile: () => this.getTerminalProfile(),
159162
}),
163+
vscode.window.registerWebviewViewProvider("pymakr-home-view", this.homeProvider),
160164
];
161165

162166
this.context.subscriptions.push(...disposables);

src/commands/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ class Commands {
3838
}
3939

4040
commands = {
41+
openWalkthrough: () => {
42+
vscode.commands.executeCommand(`workbench.action.openWalkthrough`, `Pycom.pymakr#pymakr-get-started`, false);
43+
},
44+
showMarkdownDocument: (path) => {
45+
const uri = vscode.Uri.joinPath(this.pymakr.context.extensionUri, path);
46+
vscode.commands.executeCommand("markdown.showPreview", uri);
47+
},
4148
/**
4249
* @param {{device: Device}} param0
4350
*/

0 commit comments

Comments
 (0)