From da18ed8b1b1fd694a241c939f901606661eb57b4 Mon Sep 17 00:00:00 2001 From: Brian Ignacio Date: Thu, 25 Jan 2024 17:28:30 +0800 Subject: [PATCH 1/4] fix tar xz installs --- src/pythonManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pythonManager.ts b/src/pythonManager.ts index bc0a67bcb..61ebe262a 100644 --- a/src/pythonManager.ts +++ b/src/pythonManager.ts @@ -40,7 +40,7 @@ export async function installEspIdfToolFromIdf( } try { const processResult = await utils.execChildProcess( - `"${pythonBinPath}" ${idfToolsPyPath} install ${toolName}@${toolVersion}`, + `"${pythonBinPath}" ${idfToolsPyPath} install ${toolName}`, idfToolsPath, channel, { cwd: idfToolsPath, env: modifiedEnv }, From 2d58ef08972b9948f6bd3e4c3c97e18b7d3ad387 Mon Sep 17 00:00:00 2001 From: Brian Ignacio Date: Thu, 25 Jan 2024 17:28:57 +0800 Subject: [PATCH 2/4] add p4 to keywords --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index dbe91ac74..bc33064bf 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "ESP32-C2", "ESP32-C3", "ESP32-H2", + "ESP32-P4", "ESP32-S2", "ESP32-S3", "esp32", @@ -45,6 +46,7 @@ "esp32h2", "esp32s2", "esp32s3", + "esp32p4", "matter", "iot", "wifi", From 26a76f495a79c0ebbbb30796d9624fd42de95469 Mon Sep 17 00:00:00 2001 From: Brian Ignacio Date: Thu, 25 Jan 2024 17:30:22 +0800 Subject: [PATCH 3/4] update progress windows with idf notificationMode --- src/checkExtensionSettings.ts | 16 +- src/common/abstractCloning.ts | 20 +- src/component-manager/panel.ts | 17 +- src/coverage/configureProject.ts | 13 +- src/espIdf/menuconfig/MenuconfigPanel.ts | 16 +- .../partition-table/partitionFlasher.ts | 13 +- src/espIdf/setTarget/index.ts | 22 +- src/espIdf/tracing/system-view/parser.ts | 12 +- src/espMatter/espMatterDownload.ts | 34 +- src/extension.ts | 301 ++++++++++++++++-- src/newProject/newProjectPanel.ts | 22 +- src/setup/SetupPanel.ts | 30 +- src/support/configurationSettings.ts | 1 + src/support/initReportObj.ts | 1 + src/support/types.ts | 1 + src/support/writeReport.ts | 1 + src/test/doctor.test.ts | 5 + 17 files changed, 463 insertions(+), 62 deletions(-) diff --git a/src/checkExtensionSettings.ts b/src/checkExtensionSettings.ts index caf1878df..7f5640a3f 100644 --- a/src/checkExtensionSettings.ts +++ b/src/checkExtensionSettings.ts @@ -21,11 +21,8 @@ import { isCurrentInstallValid, } from "./setup/setupInit"; import { Logger } from "./logger/logger"; -import { readParameter } from "./idfConfiguration"; +import { NotificationMode, readParameter } from "./idfConfiguration"; import { useIdfSetupSettings } from "./setup/setupValidation/espIdfSetup"; -import { getIdfMd5sum } from "./setup/espIdfJson"; -import { getEspIdfFromCMake } from "./utils"; -import { IdfSetup } from "./views/setup/types"; export async function checkExtensionSettings( extensionPath: string, @@ -40,10 +37,19 @@ export async function checkExtensionSettings( vscode.commands.executeCommand("espIdf.welcome.start"); return; } + const notificationMode = readParameter( + "idf.notificationMode", + workspace + ) as string; + const ProgressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: false, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Loading initial configuration...", }, async ( diff --git a/src/common/abstractCloning.ts b/src/common/abstractCloning.ts index 850c1c129..61d781c7e 100644 --- a/src/common/abstractCloning.ts +++ b/src/common/abstractCloning.ts @@ -159,10 +159,18 @@ export class AbstractCloning { Logger.infoNotify(`${resultingPath} already exist.`); return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode" + ) as string; + const progressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; await window.withProgress( { cancellable: true, - location: ProgressLocation.Notification, + location: progressLocation, title: this.name, }, async ( @@ -368,10 +376,18 @@ export class AbstractCloning { public async getSubmodules(repoRootDir: string) { const repoName = /[^/]*$/.exec(repoRootDir)[0]; OutputChannel.appendLine(`Downloading ${repoName} submodules`); + const notificationMode = idfConf.readParameter( + "idf.notificationMode" + ) as string; + const progressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; await window.withProgress( { cancellable: true, - location: ProgressLocation.Notification, + location: progressLocation, title: `Checking out ${repoName} submodules`, }, async ( diff --git a/src/component-manager/panel.ts b/src/component-manager/panel.ts index 9294a2121..6219e1644 100644 --- a/src/component-manager/panel.ts +++ b/src/component-manager/panel.ts @@ -19,7 +19,7 @@ import { join } from "path"; import { Disposable, Uri, ViewColumn, WebviewPanel, window } from "vscode"; import { ESP } from "../config"; -import { readParameter } from "../idfConfiguration"; +import { NotificationMode, readParameter } from "../idfConfiguration"; import { addDependency, createProject } from "./utils"; import * as vscode from "vscode"; @@ -87,7 +87,7 @@ export class ComponentManagerUIPanel { this.extensionPath = extensionPath; this.panel.onDidDispose(() => this.dispose(), null, this.disposable); this.panel.webview.onDidReceiveMessage( - async (message) => this.onMessage(message), + async (message) => this.onMessage(message, workspaceRoot), null, this.disposable ); @@ -97,7 +97,7 @@ export class ComponentManagerUIPanel { this.panel.webview.html = this.initWebView(url); } - private async onMessage(message: IMessage) { + private async onMessage(message: IMessage, workspaceUri: Uri) { switch (message.message) { case "install": if (!message.dependency) return; @@ -117,9 +117,18 @@ export class ComponentManagerUIPanel { if (!selectedFolder) { return; } + const notificationMode = readParameter( + "idf.notificationMode", + workspaceUri + ) as string; + const ProgressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Creating project...", cancellable: false, }, diff --git a/src/coverage/configureProject.ts b/src/coverage/configureProject.ts index 32f5c9b57..5906b45ae 100644 --- a/src/coverage/configureProject.ts +++ b/src/coverage/configureProject.ts @@ -17,7 +17,7 @@ */ import { extensionContext, getConfigValueFromSDKConfig, getEspIdfFromCMake } from "../utils"; -import { readParameter } from "../idfConfiguration"; +import { NotificationMode, readParameter } from "../idfConfiguration"; import { ConfserverProcess } from "../espIdf/menuconfig/confServerProcess"; import { env, @@ -81,10 +81,19 @@ export async function configureProjectWithGcov(workspacePath: Uri) { if (response !== "Start") { return; } + const notificationMode = readParameter( + "idf.notificationMode", + workspacePath + ) as string; + const progressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; await window.withProgress( { cancellable: true, - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF: Configuring coverage", }, async ( diff --git a/src/espIdf/menuconfig/MenuconfigPanel.ts b/src/espIdf/menuconfig/MenuconfigPanel.ts index add31ffdc..89b643151 100644 --- a/src/espIdf/menuconfig/MenuconfigPanel.ts +++ b/src/espIdf/menuconfig/MenuconfigPanel.ts @@ -19,6 +19,7 @@ import { Logger } from "../../logger/logger"; import { getWebViewFavicon } from "../../utils"; import { ConfserverProcess } from "./confServerProcess"; import { Menu } from "./Menu"; +import { NotificationMode, readParameter } from "../../idfConfiguration"; const locDic = new LocDictionary(__filename); @@ -136,7 +137,9 @@ export class MenuConfigPanel { this.panel.webview.onDidReceiveMessage(async (message) => { switch (message.command) { case "updateValue": - ConfserverProcess.setUpdatedValue(JSON.parse(message.updated_value) as Menu); + ConfserverProcess.setUpdatedValue( + JSON.parse(message.updated_value) as Menu + ); break; case "setDefault": const changesNotSavedMessage = locDic.localize( @@ -153,10 +156,19 @@ export class MenuConfigPanel { { title: noMsg, isCloseAffordance: true } ); if (selected.title === yesMsg) { + const notificationMode = readParameter( + "idf.notificationMode", + this.curWorkspaceFolder + ) as string; + const ProgressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: SDK Configuration editor", }, async ( diff --git a/src/espIdf/partition-table/partitionFlasher.ts b/src/espIdf/partition-table/partitionFlasher.ts index f7e31b14a..03e27d6a0 100644 --- a/src/espIdf/partition-table/partitionFlasher.ts +++ b/src/espIdf/partition-table/partitionFlasher.ts @@ -18,7 +18,7 @@ import { basename, join } from "path"; import { Progress, ProgressLocation, Uri, window } from "vscode"; -import { readParameter } from "../../idfConfiguration"; +import { NotificationMode, readParameter } from "../../idfConfiguration"; import { Logger } from "../../logger/logger"; import { appendIdfAndToolsToPath, spawn } from "../../utils"; import { OutputChannel } from "../../logger/outputChannel"; @@ -28,10 +28,19 @@ export async function flashBinaryToPartition( binPath: string, workspaceFolder: Uri ) { + const notificationMode = readParameter( + "idf.notificationMode", + workspaceFolder + ) as string; + const progressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; await window.withProgress( { cancellable: false, - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF: Flashing binary to device", }, async (progress: Progress<{ message: string; increment: number }>) => { diff --git a/src/espIdf/setTarget/index.ts b/src/espIdf/setTarget/index.ts index 1b8206488..5780d80b4 100644 --- a/src/espIdf/setTarget/index.ts +++ b/src/espIdf/setTarget/index.ts @@ -22,7 +22,11 @@ import { ProgressLocation, window, } from "vscode"; -import { readParameter, writeParameter } from "../../idfConfiguration"; +import { + NotificationMode, + readParameter, + writeParameter, +} from "../../idfConfiguration"; import { Logger } from "../../logger/logger"; import { OutputChannel } from "../../logger/outputChannel"; import { getBoards, getOpenOcdScripts } from "../openOcd/boardConfiguration"; @@ -38,10 +42,19 @@ export async function setIdfTarget(placeHolderMsg: string) { return; } + const notificationMode = readParameter( + "idf.notificationMode", + workspaceFolder + ) as string; + const progressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; await window.withProgress( { cancellable: false, - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF: Setting device target...", }, async (progress: Progress<{ message: string; increment: number }>) => { @@ -86,7 +99,10 @@ export async function setIdfTarget(placeHolderMsg: string) { workspaceFolder.uri ); const openOcdScriptsPath = getOpenOcdScripts(workspaceFolder.uri); - const boards = await getBoards(selectedTarget.target, openOcdScriptsPath); + const boards = await getBoards( + selectedTarget.target, + openOcdScriptsPath + ); const choices = boards.map((b) => { return { description: `${b.description} (${b.configFiles})`, diff --git a/src/espIdf/tracing/system-view/parser.ts b/src/espIdf/tracing/system-view/parser.ts index 0a9572a5a..69562686d 100644 --- a/src/espIdf/tracing/system-view/parser.ts +++ b/src/espIdf/tracing/system-view/parser.ts @@ -20,17 +20,25 @@ import { AppTraceArchiveItems } from "../tree/appTraceArchiveTreeDataProvider"; import { window, ProgressLocation } from "vscode"; import { Logger } from "../../../logger/logger"; import { SystemViewPanel } from "./panel"; -import { readJsonSync } from "fs-extra"; import { SysviewTraceProc } from "../tools/sysviewTraceProc"; +import { NotificationMode, readParameter } from "../../../idfConfiguration"; export class SystemViewResultParser { public static parseWithProgress( trace: AppTraceArchiveItems, extensionPath: string ) { + const notificationMode = readParameter( + "idf.notificationMode" + ) as string; + const progressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; window.withProgress( { - location: ProgressLocation.Notification, + location: progressLocation, cancellable: false, title: "ESP-IDF: Processing your tracing file to generate System View Report", diff --git a/src/espMatter/espMatterDownload.ts b/src/espMatter/espMatterDownload.ts index 536de195c..85512ad42 100644 --- a/src/espMatter/espMatterDownload.ts +++ b/src/espMatter/espMatterDownload.ts @@ -140,12 +140,24 @@ export class EspMatterCloning extends AbstractCloning { ); } - public async initEsp32PlatformSubmodules(espMatterDir: string) { + public async initEsp32PlatformSubmodules( + espMatterDir: string, + workspace: Uri + ) { OutputChannel.appendLine("Downloading Matter ESP32 platform submodules"); + const notificationMode = readParameter( + "idf.notificationMode", + workspace + ) as string; + const progressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; await window.withProgress( { cancellable: true, - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF: Installing ESP-Matter", }, async ( @@ -254,10 +266,19 @@ export async function installPythonReqs( confToolsPath || process.env.IDF_TOOLS_PATH || join(containerPath, ".espressif"); + const notificationMode = readParameter( + "idf.notificationMode", + workspace + ) as string; + const progressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; await window.withProgress( { cancellable: true, - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF: Installing ESP-Matter", }, async ( @@ -283,7 +304,7 @@ export async function installPythonReqs( export async function getEspMatter(workspace?: Uri) { const gitPath = (await readParameter("idf.gitPath", workspace)) || "/usr/bin/git"; - let espMatterPath; + let espMatterPath: string; const espMatterInstaller = new EspMatterCloning(gitPath, workspace); const installAllSubmodules = await window.showQuickPick( [ @@ -312,7 +333,10 @@ export async function getEspMatter(workspace?: Uri) { ); espMatterPath = readParameter("idf.espMatterPath", workspace); await espMatterInstaller.getSubmodules(espMatterPath); - await espMatterInstaller.initEsp32PlatformSubmodules(espMatterPath); + await espMatterInstaller.initEsp32PlatformSubmodules( + espMatterPath, + workspace + ); await espMatterInstaller.startBootstrap(true); } await TaskManager.runTasks(); diff --git a/src/extension.ts b/src/extension.ts index 7705b2cbc..ea8e411cc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -451,12 +451,21 @@ export async function activate(context: vscode.ExtensionContext) { vscode.window.onDidCloseTerminal(async (terminal: vscode.Terminal) => {}); registerIDFCommand("espIdf.createFiles", async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; PreCheck.perform([openFolderCheck], async () => { try { vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Creating ESP-IDF project...", }, async ( @@ -630,10 +639,20 @@ export async function activate(context: vscode.ExtensionContext) { "esptool.py" ); + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; + vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Erasing device flash memory (erase_flash)", }, async ( @@ -663,10 +682,19 @@ export async function activate(context: vscode.ExtensionContext) { registerIDFCommand("espIdf.addArduinoAsComponentToCurFolder", () => { PreCheck.perform([openFolderCheck], () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Arduino ESP32 as ESP-IDF component", }, async ( @@ -987,10 +1015,19 @@ export async function activate(context: vscode.ExtensionContext) { ); return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: false, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Project configuration", }, async ( @@ -1396,10 +1433,19 @@ export async function activate(context: vscode.ExtensionContext) { }); registerIDFCommand("espIdf.searchInEspIdfDocs", async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Documentation search results", }, async () => { @@ -1433,11 +1479,20 @@ export async function activate(context: vscode.ExtensionContext) { registerIDFCommand("espIdf.installPyReqs", () => { return PreCheck.perform([openFolderCheck], async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, - title: "ESP-IDF:", + location: ProgressLocation, + title: "ESP-IDF: Installing Python requirements", }, async ( progress: vscode.Progress<{ message: string; increment?: number }>, @@ -1497,10 +1552,19 @@ export async function activate(context: vscode.ExtensionContext) { ); } return PreCheck.perform([openFolderCheck], async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF:", }, async ( @@ -1579,10 +1643,19 @@ export async function activate(context: vscode.ExtensionContext) { Logger.error(msg, error); } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF:", }, async ( @@ -1606,10 +1679,19 @@ export async function activate(context: vscode.ExtensionContext) { registerIDFCommand("espIdf.unitTest.buildFlashUnitTestApp", () => { return PreCheck.perform([openFolderCheck], async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Building unit test app and flashing", }, async ( @@ -1756,10 +1838,19 @@ export async function activate(context: vscode.ExtensionContext) { ConfserverProcess.loadExistingInstance(); return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Menuconfig", }, async ( @@ -1836,10 +1927,19 @@ export async function activate(context: vscode.ExtensionContext) { SetupPanel.createOrShow(context); return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: false, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Configure extension", }, async ( @@ -1878,10 +1978,19 @@ export async function activate(context: vscode.ExtensionContext) { return; } try { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: false, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Loading examples", }, async ( @@ -1931,10 +2040,19 @@ export async function activate(context: vscode.ExtensionContext) { WelcomePanel.createOrShow(context.extensionPath); return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: false, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Welcome page", }, async ( @@ -1962,10 +2080,19 @@ export async function activate(context: vscode.ExtensionContext) { NewProjectPanel.createOrShow(context.extensionPath); return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: false, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: New project", }, async ( @@ -2093,11 +2220,19 @@ export async function activate(context: vscode.ExtensionContext) { IDFSizePanel.createOrShow(context); return; } - + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Size", }, async ( @@ -2246,10 +2381,19 @@ export async function activate(context: vscode.ExtensionContext) { registerIDFCommand("espIdf.qemuCommand", () => { PreCheck.perform([openFolderCheck], async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Starting ESP-IDF QEMU", }, async ( @@ -2447,10 +2591,19 @@ export async function activate(context: vscode.ExtensionContext) { }); registerIDFCommand("espIdf.doctorCommand", async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: false, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Preparing ESP-IDF extension report", }, async ( @@ -2570,10 +2723,19 @@ export async function activate(context: vscode.ExtensionContext) { return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { title: "ESP-IDF: Please wait checking with Rainmaker Cloud", - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, cancellable: false, }, async () => { @@ -2627,10 +2789,19 @@ export async function activate(context: vscode.ExtensionContext) { if (!shallDelete || shallDelete.title === "Cancel") { return; } + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { title: "ESP-IDF: Deleting node from your rainmaker account", - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, }, async () => { try { @@ -2691,10 +2862,19 @@ export async function activate(context: vscode.ExtensionContext) { newParamValue = convertTo(params.data_type, newParamValue); + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { title: "ESP-IDF: Syncing params, please wait", - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, }, async () => { try { @@ -2833,9 +3013,18 @@ export async function activate(context: vscode.ExtensionContext) { monitor.start(); }) .on("core-dump-detected", async (resp) => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, cancellable: false, title: "ESP-IDF: Core-dump detected, please wait while we parse the data received", @@ -2995,10 +3184,19 @@ export async function activate(context: vscode.ExtensionContext) { } ); registerIDFCommand("esp.efuse.summary", async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { title: "ESP-IDF: Getting eFuse summary for your chip", - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, }, async () => { try { @@ -3024,10 +3222,19 @@ export async function activate(context: vscode.ExtensionContext) { }); registerIDFCommand("espIdf.ninja.summary", async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { title: "ESP-IDF: Getting ninja build summary", - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, }, async () => { try { @@ -3113,11 +3320,20 @@ export async function activate(context: vscode.ExtensionContext) { if (uri.path === "/rainmaker" && query[0] === "code") { const code = query[1] || ""; try { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; vscode.window.withProgress( { title: "ESP-IDF: Please wait mapping your rainmaker cloud account with the VS Code Extension, this could take a little while", - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, }, async () => { await RainmakerAPIClient.exchangeCodeForTokens(code); @@ -3405,10 +3621,19 @@ function createStatusBarItem( const build = (flashType?: ESP.FlashType) => { PreCheck.perform([openFolderCheck], async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Building project", }, async ( @@ -3431,10 +3656,19 @@ const flash = ( flashType?: ESP.FlashType ) => { PreCheck.perform([webIdeCheck, openFolderCheck], async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Flashing project", }, async ( @@ -3486,10 +3720,19 @@ function createQemuMonitor( const buildFlashAndMonitor = async (runMonitor: boolean = true) => { PreCheck.perform([webIdeCheck, openFolderCheck], async () => { + const notificationMode = idfConf.readParameter( + "idf.notificationMode", + workspaceRoot + ) as string; + const ProgressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Building project", }, async ( diff --git a/src/newProject/newProjectPanel.ts b/src/newProject/newProjectPanel.ts index 2a365dc42..977b9b41e 100644 --- a/src/newProject/newProjectPanel.ts +++ b/src/newProject/newProjectPanel.ts @@ -22,6 +22,7 @@ import { copy, ensureDir, readFile, writeJSON } from "fs-extra"; import * as utils from "../utils"; import { IExample } from "../examples/Example"; import { setCurrentSettingsInTemplate } from "./utils"; +import { NotificationMode, readParameter } from "../idfConfiguration"; const locDictionary = new LocDictionary("NewProjectPanel"); @@ -207,10 +208,19 @@ export class NewProjectPanel { ) { const newProjectPath = path.join(projectDirectory, projectName); let isSkipped = false; + const notificationMode = readParameter( + "idf.notificationMode", + workspaceFolder + ) as string; + const ProgressLocation = + notificationMode === NotificationMode.All || + notificationMode === NotificationMode.Notifications + ? vscode.ProgressLocation.Notification + : vscode.ProgressLocation.Window; await vscode.window.withProgress( { cancellable: true, - location: vscode.ProgressLocation.Notification, + location: ProgressLocation, title: "ESP-IDF: Create project", }, async ( @@ -248,14 +258,20 @@ export class NewProjectPanel { } await ensureDir(newProjectPath, { mode: 0o775 }); if (template && template.path !== "") { - await utils.copyFromSrcProject(template.path, vscode.Uri.file(newProjectPath)); + await utils.copyFromSrcProject( + template.path, + vscode.Uri.file(newProjectPath) + ); } else { const boilerplatePath = path.join( this.extensionPath, "templates", "boilerplate" ); - await utils.copyFromSrcProject(boilerplatePath, vscode.Uri.file(newProjectPath)); + await utils.copyFromSrcProject( + boilerplatePath, + vscode.Uri.file(newProjectPath) + ); } await utils.updateProjectNameInCMakeLists( newProjectPath, diff --git a/src/setup/SetupPanel.ts b/src/setup/SetupPanel.ts index 8a6b02086..9a658f0f3 100644 --- a/src/setup/SetupPanel.ts +++ b/src/setup/SetupPanel.ts @@ -376,9 +376,17 @@ export class SetupPanel { context: ExtensionContext, onReqPkgs?: string[] ) { + const notificationMode = idfConf.readParameter( + "idf.notificationMode" + ) as string; + const progressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; return await window.withProgress( { - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF Setup:", cancellable: true, }, @@ -515,9 +523,17 @@ export class SetupPanel { context: ExtensionContext, onReqPkgs?: string[] ) { + const notificationMode = idfConf.readParameter( + "idf.notificationMode" + ) as string; + const progressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; return await window.withProgress( { - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF Tools Setup:", cancellable: true, }, @@ -579,9 +595,17 @@ export class SetupPanel { saveScope: ConfigurationTarget, context: ExtensionContext ) { + const notificationMode = idfConf.readParameter( + "idf.notificationMode" + ) as string; + const progressLocation = + notificationMode === idfConf.NotificationMode.All || + notificationMode === idfConf.NotificationMode.Notifications + ? ProgressLocation.Notification + : ProgressLocation.Window; return await window.withProgress( { - location: ProgressLocation.Notification, + location: progressLocation, title: "ESP-IDF Python Requirements:", cancellable: true, }, diff --git a/src/support/configurationSettings.ts b/src/support/configurationSettings.ts index 98b09ee9c..2c741d0af 100644 --- a/src/support/configurationSettings.ts +++ b/src/support/configurationSettings.ts @@ -34,6 +34,7 @@ export function getConfigurationSettings( customTerminalExecutableArgs: conf.get("idf.customTerminalExecutableArgs"), customExtraPaths: conf.get("idf.customExtraPaths"), customExtraVars: conf.get("idf.customExtraVars"), + notificationMode: conf.get("idf.notificationMode"), pythonBinPath: conf.get("idf.pythonBinPath" + winFlag), pythonPackages: [], serialPort: conf.get("idf.port" + winFlag), diff --git a/src/support/initReportObj.ts b/src/support/initReportObj.ts index 762705053..82fee7787 100644 --- a/src/support/initReportObj.ts +++ b/src/support/initReportObj.ts @@ -29,6 +29,7 @@ export function initializeReportObject() { customExtraVars: undefined, customTerminalExecutable: undefined, customTerminalExecutableArgs: undefined, + notificationMode: undefined, pythonBinPath: undefined, pythonPackages: undefined, serialPort: undefined, diff --git a/src/support/types.ts b/src/support/types.ts index 95f8a9d1e..96710b228 100644 --- a/src/support/types.ts +++ b/src/support/types.ts @@ -37,6 +37,7 @@ export class Configuration { espMatterPath: string; customExtraPaths: string; customExtraVars: { [key: string]: string }; + notificationMode: string; pythonBinPath: string; pythonPackages: pyPkgVersion[]; serialPort: string; diff --git a/src/support/writeReport.ts b/src/support/writeReport.ts index ae3144686..311f7220c 100644 --- a/src/support/writeReport.ts +++ b/src/support/writeReport.ts @@ -59,6 +59,7 @@ export async function writeTextReport( output += `OpenOCD Configs (idf.openOcdConfigs) ${reportedResult.configurationSettings.openOcdConfigs}${EOL}`; output += `ESP-IDF Tools Path (idf.toolsPath) ${reportedResult.configurationSettings.toolsPath}${EOL}`; output += `Git Path (idf.gitPath) ${reportedResult.configurationSettings.gitPath}${EOL}`; + output += `Notification Mode (idf.notificationMode) ${reportedResult.configurationSettings.notificationMode}${EOL}`; if (reportedResult.configurationSettings.customTerminalExecutable) { output += `Custom terminal executable (idf.customTerminalExecutable) ${reportedResult.configurationSettings.customTerminalExecutable}${EOL}`; } diff --git a/src/test/doctor.test.ts b/src/test/doctor.test.ts index cd67f2aeb..908800534 100644 --- a/src/test/doctor.test.ts +++ b/src/test/doctor.test.ts @@ -183,6 +183,10 @@ suite("Doctor Command tests", () => { reportObj.configurationSettings.toolsPath, settingsJsonObj["idf.toolsPath"] ); + assert.equal( + reportObj.configurationSettings.notificationMode, + settingsJsonObj["idf.notificationMode"] + ); }); test("Good debug adapter py requirements", async () => { @@ -303,6 +307,7 @@ suite("Doctor Command tests", () => { expectedOutput += `OpenOCD Configs (idf.openOcdConfigs) ${reportObj.configurationSettings.openOcdConfigs}${os.EOL}`; expectedOutput += `ESP-IDF Tools Path (idf.toolsPath) ${reportObj.configurationSettings.toolsPath}${os.EOL}`; expectedOutput += `Git Path (idf.gitPath) ${reportObj.configurationSettings.gitPath}${os.EOL}`; + expectedOutput += `Notification Mode (idf.notificationMode) ${reportObj.configurationSettings.notificationMode}${os.EOL}`; const actualReport = await writeTextReport(reportObj, mockUpContext); const subReport = actualReport.slice( 0, From 8a031539f1f2b9eacd877f6c81fb6a6d283c6ae8 Mon Sep 17 00:00:00 2001 From: Brian Ignacio Date: Thu, 25 Jan 2024 18:19:10 +0800 Subject: [PATCH 4/4] update debug task tasks json template --- templates/.vscode/tasks.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/templates/.vscode/tasks.json b/templates/.vscode/tasks.json index d72c4f681..1dc791585 100644 --- a/templates/.vscode/tasks.json +++ b/templates/.vscode/tasks.json @@ -236,13 +236,14 @@ "-e", "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf", "-s", - "${command:espIdf.getOpenOcdScriptValue}", - "-ip", - "localhost", + "$OPENOCD_SCRIPTS", "-dn", - "${config:idf.adapterTargetName}", + "esp32", "-om", - "connect_to_instance" + "connect_to_instance", + "-t", + "xtensa-esp32-elf-" + ], "windows": { "command": "${config:idf.pythonBinPathWin}",