Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l10n/bundle.l10n.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"Debug": "Depurar",
"[OpenOCD Server]": "[Servidor OpenOCD]",
"Open ESP-IDF Terminal": "Abrir terminal ESP-IDF",
"Open Classic Menuconfig Terminal": "Abrir terminal de configuración clásica",
"Doctor Command": "Comando médico",
"Execute Custom Task": "Ejecutar tarea personalizada",
"Wait for ESP-IDF build or flash to finish": "Espere a que finalice la compilación o la actualización de ESP-IDF",
Expand Down
1 change: 1 addition & 0 deletions l10n/bundle.l10n.pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"Debug": "Depurar",
"[OpenOCD Server]": "[Servidor OpenOCD]",
"Open ESP-IDF Terminal": "Abra o terminal ESP-IDF",
"Open Classic Menuconfig Terminal": "Abrir terminal de configuração clássica",
"Doctor Command": "Comando Médico",
"Execute Custom Task": "Executar tarefa personalizada",
"Wait for ESP-IDF build or flash to finish": "Aguarde a conclusão da compilação ou flash do ESP-IDF",
Expand Down
1 change: 1 addition & 0 deletions l10n/bundle.l10n.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"Debug": "Отладка",
"[OpenOCD Server]": "[Сервер OpenOCD]",
"Open ESP-IDF Terminal": "Открыть терминал ESP-IDF",
"Open Classic Menuconfig Terminal": "Открыть классический терминал конфигурации",
"Doctor Command": "Команда 'Доктор'",
"Execute Custom Task": "Выполнить пользовательскую задачу",
"Wait for ESP-IDF build or flash to finish": "Подождите завершения сборки или прошивки ESP-IDF",
Expand Down
1 change: 1 addition & 0 deletions l10n/bundle.l10n.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"Debug": "调试",
"[OpenOCD Server]": "[OpenOCD 服务器]",
"Open ESP-IDF Terminal": "打开 ESP-IDF 终端",
"Open Classic Menuconfig Terminal": "打开经典菜单配置终端",
"Doctor Command": "诊断命令",
"Execute Custom Task": "执行自定义任务",
"Wait for ESP-IDF build or flash to finish": "等待 ESP-IDF 构建或烧录完成",
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,11 @@
"key": "ctrl+e t",
"mac": "cmd+i t"
},
{
"command": "espIdf.createClassicMenuconfig",
"key": "ctrl+e ctrl+g",
"mac": "cmd+i cmd+g"
},
{
"command": "espIdf.selectPort",
"key": "ctrl+e p",
Expand Down Expand Up @@ -1293,6 +1298,11 @@
"title": "%espIdf.createIdfTerminal.title%",
"category": "ESP-IDF"
},
{
"command": "espIdf.createClassicMenuconfig",
"title": "%espIdf.createClassicMenuconfig.title%",
"category": "ESP-IDF"
},
{
"command": "espIdf.selectConfTarget",
"title": "%espIdf.selectConfTarget.title%",
Expand Down
3 changes: 2 additions & 1 deletion package.nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"espIdf.createDevContainer.title": "Agregar configuración de contenedor Docker",
"espIdf.createFiles.title": "Crear proyecto a partir de la plantilla de extensión",
"espIdf.createIdfTerminal.title": "Abrir terminal ESP-IDF",
"espIdf.createNewComponent.title": "Crear nuevo componente de ESP-IDF",
"espIdf.createClassicMenuconfig.title": "Abrir terminal de configuración clásica",
"espIdf.createNewComponent.title": "Crear nuevo componente ESP-IDF",
"espIdf.createSbom.title": "Ejecutar comprobación de vulnerabilidad ESP-IDF-SBOM",
"espIdf.createVsCodeFolder.title": "Agregar carpeta de configuración de vscode",
"espIdf.customTask.title": "Ejecutar tarea personalizada",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"espIdf.createDevContainer.title": "Add Docker Container Configuration",
"espIdf.createFiles.title": "Create Project from Extension Template",
"espIdf.createIdfTerminal.title": "Open ESP-IDF Terminal",
"espIdf.createClassicMenuconfig.title": "Open Classic Menuconfig Terminal",
"espIdf.createNewComponent.title": "Create New ESP-IDF Component",
"espIdf.createSbom.title": "Run ESP-IDF-SBOM Vulnerability Check",
"espIdf.createVsCodeFolder.title": "Add VS Code Configuration Folder",
Expand Down
1 change: 1 addition & 0 deletions package.nls.pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"espIdf.createDevContainer.title": "Adicionar configuração de contêiner Docker",
"espIdf.createFiles.title": "Criar projeto a partir do modelo de extensão",
"espIdf.createIdfTerminal.title": "Abra o terminal ESP-IDF",
"espIdf.createClassicMenuconfig.title": "Abrir terminal de configuração clássica",
"espIdf.createNewComponent.title": "Criar novo componente ESP-IDF",
"espIdf.createSbom.title": "Execute a verificação de vulnerabilidade ESP-IDF-SBOM",
"espIdf.createVsCodeFolder.title": "Adicionar pasta de configuração vscode",
Expand Down
1 change: 1 addition & 0 deletions package.nls.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"espIdf.createDevContainer.title": "Добавить конфигурацию Docker-контейнера",
"espIdf.createFiles.title": "Создать проект из шаблона расширения",
"espIdf.createIdfTerminal.title": "Открыть терминал ESP-IDF",
"espIdf.createClassicMenuconfig.title": "Открыть классический терминал конфигурации",
"espIdf.createNewComponent.title": "Создать новый компонент ESP-IDF",
"espIdf.createSbom.title": "Запустить проверку уязвимостей ESP-IDF-SBOM.",
"espIdf.createVsCodeFolder.title": "Добавить папку конфигурации VS Code",
Expand Down
7 changes: 4 additions & 3 deletions package.nls.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"espIdf.createDevContainer.title": "添加 Docker 容器配置",
"espIdf.createFiles.title": "基于模板创建新项目",
"espIdf.createIdfTerminal.title": "打开 ESP-IDF 终端",
"espIdf.createClassicMenuconfig.title": "打开经典菜单配置终端",
"espIdf.createNewComponent.title": "创建新 ESP-IDF 组件",
"espIdf.createSbom.title": "运行 ESP-IDF-SBOM 漏洞检查",
"espIdf.createVsCodeFolder.title": "添加 VS Code 配置文件夹",
Expand Down Expand Up @@ -120,7 +121,7 @@
"param.customTask": "自定义任务",
"param.customTerminalExecutable.title": "自定义扩展任务的可执行文件",
"param.customTerminalExecutableArgs.title": "扩展任务的自定义可执行文件的参数列表",
"param.deleteComponentsOnFullClean": "在彻底清理项目命令中删除 managed_components",
"param.deleteComponentsOnFullClean": "在"彻底清理项目"命令中删除 managed_components",
"param.enableCCache.title": "在构建任务中启用 CCache",
"param.enableIdfComponentManager.title": "在构建任务中启用 IDF 组件管理器",
"param.enableSizeTaskAfterBuildTask.title": "在构建任务完成后执行 IDF 二进制文件大小分析",
Expand Down Expand Up @@ -199,7 +200,7 @@
"view.idf.idfPartitionExplorer": "设备分区资源管理器",
"view.idf.idfSearchResults": "文档搜索结果",
"viewContainer.title": "ESP-IDF:资源管理器",
"viewWelcome.idfPartitionExplorer": "显示设备的分区列表,选择烧录二进制文件 (.bin) 的分区。\n\n选择设备串口,单击刷新分区表。",
"viewWelcome.idfSearchResults": "在任一打开的文件编辑器中选定文本,右键单击并选择ESP-IDF:在文档中搜索,搜索匹配的结果。\n\n搜索结果基于当前的 VS Code 语言以及 idf.espIdfPath 版本 (若未指定版本,则默认使用最新版 ESP-IDF)。",
"viewWelcome.idfPartitionExplorer": "显示设备的分区列表,选择烧录二进制文件 (.bin) 的分区。\n\n选择设备串口,单击"刷新分区表"。",
"viewWelcome.idfSearchResults": "在任一打开的文件编辑器中选定文本,右键单击并选择"ESP-IDF:在文档中搜索",搜索匹配的结果。\n\n搜索结果基于当前的 VS Code 语言以及 idf.espIdfPath 版本 (若未指定版本,则默认使用最新版 ESP-IDF)。",
"viewWelcome.peripheralView": "在活动调试会话中,显示 ESP-IDF SVD 文件 (路径为 idf.svdFilePath) 中包含的外设寄存器信息。"
}
8 changes: 7 additions & 1 deletion src/cmdTreeView/cmdStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface IDFCommandDescription {
export enum IDFWebCommandKeys {
Flash = "espIdfWeb.flash",
Monitor = "espIdfWeb.monitor",
FlashAndMonitor = "espIdfWeb.flashAndMonitor"
FlashAndMonitor = "espIdfWeb.flashAndMonitor",
}

export enum CommandKeys {
Expand Down Expand Up @@ -74,6 +74,7 @@ export enum AdvancedCommandKeys {
UartFlash = "espIdf.flashUart",
DfuFlash = "espIdf.flashDFU",
WebsocketMonitor = "espIdf.launchWSServerAndMonitor",
ClassicMenuconfig = "espIdf.createClassicMenuconfig",
}

export function createAdvancedCommandDictionary(): Record<
Expand Down Expand Up @@ -186,6 +187,11 @@ export function createAdvancedCommandDictionary(): Record<
iconId: "device-desktop",
tooltip: l10n.t("Launch Websocket server and IDF Monitor"),
},
[AdvancedCommandKeys.ClassicMenuconfig]: {
checkboxState: undefined,
iconId: "gear",
tooltip: l10n.t("Classic Menuconfig"),
},
};
}

Expand Down
147 changes: 107 additions & 40 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,10 @@ export async function activate(context: vscode.ExtensionContext) {
});
});

registerIDFCommand("espIdf.createClassicMenuconfig", () =>
createClassicMenuconfig(context.extensionPath)
);

registerIDFCommand("espIdf.saveDefSdkconfig", async () => {
const idfVersionCheck = await minIdfVersionCheck("5.0", workspaceRoot);
PreCheck.perform([idfVersionCheck, openFolderCheck], () => {
Expand Down Expand Up @@ -4424,55 +4428,118 @@ async function startFlashing(
}
}

async function createEspIdfTerminal(
extensionPath: string,
terminalName: string,
initialCommand?: string,
location?: vscode.TerminalLocation
): Promise<vscode.Terminal> {
const modifiedEnv = await utils.appendIdfAndToolsToPath(workspaceRoot);
let shellArgs = [];
if (process.platform === "win32") {
if (
vscode.env.shell.indexOf("powershell") !== -1 ||
vscode.env.shell.indexOf("pwsh") !== -1
) {
shellArgs = ["-ExecutionPolicy", "Bypass"];
}
}
let shellExecutablePath = idfConf.readParameter(
"idf.customTerminalExecutable",
workspaceRoot
) as string;
const shellExecutableArgs = idfConf.readParameter(
"idf.customTerminalExecutableArgs",
workspaceRoot
) as string[];
if (!shellExecutablePath) {
shellExecutablePath = vscode.env.shell;
}
if (shellExecutableArgs && shellExecutableArgs.length) {
shellArgs = shellExecutableArgs;
}

const espIdfTerminal = vscode.window.createTerminal({
name: terminalName,
env: modifiedEnv,
cwd: workspaceRoot.fsPath || modifiedEnv.IDF_PATH || process.cwd(),
strictEnv: true,
shellArgs,
shellPath: shellExecutablePath,
location,
});

if (process.platform === "win32") {
if (shellExecutablePath.indexOf("cmd.exe") !== -1) {
espIdfTerminal.sendText(
`call "${path.join(extensionPath, "export.bat")}"`
);
} else if (
shellExecutablePath.indexOf("powershell") !== -1 ||
shellExecutablePath.indexOf("pwsh") !== -1
) {
espIdfTerminal.sendText(
`& '${path.join(extensionPath, "export.ps1").replace(/'/g, "''")}'`
);
}
}

if (initialCommand) {
espIdfTerminal.sendText(initialCommand);
}

espIdfTerminal.show();
return espIdfTerminal;
}

function createIdfTerminal(extensionPath: string) {
PreCheck.perform([openFolderCheck], async () => {
const modifiedEnv = await utils.appendIdfAndToolsToPath(workspaceRoot);
let shellArgs = [];
if (process.platform === "win32") {
if (
vscode.env.shell.indexOf("powershell") !== -1 ||
vscode.env.shell.indexOf("pwsh") !== -1
) {
shellArgs = ["-ExecutionPolicy", "Bypass"];
}
}
let shellExecutablePath = idfConf.readParameter(
"idf.customTerminalExecutable",
await createEspIdfTerminal(extensionPath, "ESP-IDF Terminal");
});
}

function createClassicMenuconfig(extensionPath: string) {
PreCheck.perform([openFolderCheck], async () => {
// Get build directory and sdkconfig file from settings
const buildDirPath = idfConf.readParameter(
"idf.buildPath",
workspaceRoot
) as string;
const shellExecutableArgs = idfConf.readParameter(
"idf.customTerminalExecutableArgs",
const sdkconfigPath = await utils.getSDKConfigFilePath(workspaceRoot);
const sdkconfigDefaults = idfConf.readParameter(
"idf.sdkconfigDefaults",
workspaceRoot
) as string[];
if (!shellExecutablePath) {
shellExecutablePath = vscode.env.shell;

// Build the idf.py menuconfig command with optional parameters
let menuconfigCommand = "idf.py";
if (buildDirPath) {
menuconfigCommand += ` -B "${buildDirPath}"`;
}
if (shellExecutableArgs && shellExecutableArgs.length) {
shellArgs = shellExecutableArgs;
if (sdkconfigPath) {
menuconfigCommand += ` -DSDKCONFIG='${sdkconfigPath}'`;
}
const espIdfTerminal = vscode.window.createTerminal({
name: "ESP-IDF Terminal",
env: modifiedEnv,
cwd: workspaceRoot.fsPath || modifiedEnv.IDF_PATH || process.cwd(),
strictEnv: true,
shellArgs,
shellPath: shellExecutablePath,
});
if (process.platform === "win32") {
if (shellExecutablePath.indexOf("cmd.exe") !== -1) {
espIdfTerminal.sendText(
`call "${path.join(extensionPath, "export.bat")}"`
);
} else if (
shellExecutablePath.indexOf("powershell") !== -1 ||
shellExecutablePath.indexOf("pwsh") !== -1
) {
espIdfTerminal.sendText(
`& '${path.join(extensionPath, "export.ps1").replace(/'/g, "''")}'`
);
}
if (sdkconfigDefaults && sdkconfigDefaults.length > 0) {
menuconfigCommand += ` -DSDKCONFIG_DEFAULTS="${sdkconfigDefaults.join(
";"
)}"`;
}
espIdfTerminal.show();
menuconfigCommand += ` -C '${workspaceRoot.fsPath}' menuconfig`;

const currentSelectedConfig = ESP.ProjectConfiguration.store.get<string>(
ESP.ProjectConfiguration.SELECTED_CONFIG
);

const terminalName = `ESP-IDF Menuconfig${
currentSelectedConfig ? ` - (${currentSelectedConfig})` : ""
}`;

await createEspIdfTerminal(
extensionPath,
terminalName,
menuconfigCommand,
vscode.TerminalLocation.Editor
);
});
}

Expand Down