Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VSC-1379]Enhance/uninstall improvement #1353

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
23 changes: 23 additions & 0 deletions docs_espressif/en/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,26 @@ After installing Visual Studio Code you need to install the ESP-IDF extension fo

.. warning::
Check the :ref:`Troubleshooting <troubleshooting>` section if you have any issues during installation.

Uninstall ESP-IDF VS Code Extension
-------------------------------------

To uninstall the ESP-IDF VS Code extension, follow these steps:

1. Open Command Palette (F1) and type **ESP-IDF: Remove All ESP-IDF Settings** and select the command to remove all ESP-IDF settings.

2. Navigate to **View** > **Extensions** or use the keyboard shortcut :kbd:`Ctrl+Shift+X` in Windows/Linux or :kbd:`Shift+⌘+X` in MacOS.

3. Search for `ESP-IDF` and click on the **Uninstall** button.

4. Ensure you remove the following folders:

- Go to your `${VSCODE_EXTENSION_DIR}` and delete the ESP-IDF plugin folder.

- `${VSCODE_EXTENSION_DIR}` is the location of the extension:
- **Windows**: `%USERPROFILE%\.vscode\extensions\espressif.esp-idf-extension-VERSION\`
- **MacOS/Linux**: `$HOME/.vscode/extensions/espressif.esp-idf-extension-VERSION/`

.. note::

Make sure to replace `VERSION` with the actual version number of the ESP-IDF extension installed.
15 changes: 14 additions & 1 deletion l10n/bundle.l10n.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,18 @@
"JTAG is soft-disabled ({0} is set to an odd value: {1}).": "JTAG está deshabilitado por software ({0} se ha establecido con un valor impar: {1}).",
"JTAG selection may be affected by strapping configuration ({0} is set).": "La selección de JTAG puede verse afectada por la configuración de strapping (se ha establecido {0}).",
"JTAG is not disabled.": "JTAG no está deshabilitado.",
"IDF Version >= 4.3.x required to have eFuse view": "Se requiere IDF Versión >= 4.3.x para tener vista de e-fuse"
"IDF Version >= 4.3.x required to have eFuse view": "Se requiere IDF Versión >= 4.3.x para tener vista de e-fuse",
"No ESP-IDF settings found to remove.": "No se encontró ninguna configuración de ESP-IDF para eliminar.",
"Are you sure you want to remove all ESP-IDF settings? This will delete all idf.* configurations.": "¿Está seguro de que desea eliminar todas las configuraciones de ESP-IDF? Esto eliminará todas las configuraciones idf.*.",
"{0} settings will be removed.": "{0} configuraciones serán eliminadas.",
"Yes": "Sí",
"No": "No",
"Starting ESP-IDF settings cleanup...": "Iniciando limpieza de configuraciones ESP-IDF...",
"Removed global setting: {0}": "Configuración global eliminada: {0}",
"Removed workspace setting: {0}": "Configuración del espacio de trabajo eliminada: {0}",
"Removed workspace folder setting: {0}": "Configuración de la carpeta del espacio de trabajo eliminada: {0}",
"Warning: Could not fully remove setting {0}: {1}": "Advertencia: No se pudo eliminar completamente la configuración {0}: {1}",
"ESP-IDF settings removed successfully.": "Configuraciones de ESP-IDF eliminadas exitosamente.",
"Failed to remove settings: {0}": "Error al eliminar las configuraciones: {0}",
"Error: {0}": "Error: {0}"
}
15 changes: 14 additions & 1 deletion l10n/bundle.l10n.pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,18 @@
"JTAG is soft-disabled ({0} is set to an odd value: {1}).": "JTAG está desativado por software ({0} está definido com um valor ímpar: {1}).",
"JTAG selection may be affected by strapping configuration ({0} is set).": "A seleção JTAG pode ser afetada pela configuração de strapping ({0} está definido).",
"JTAG is not disabled.": "JTAG não está desativado.",
"IDF Version >= 4.3.x required to have eFuse view": "IDF Versão >= 4.3.x necessária para ter visualização de e-fuse"
"IDF Version >= 4.3.x required to have eFuse view": "IDF Versão >= 4.3.x necessária para ter visualização de e-fuse",
"No ESP-IDF settings found to remove.": "Nenhuma configuração do ESP-IDF encontrada para remover.",
"Are you sure you want to remove all ESP-IDF settings? This will delete all idf.* configurations.": "Tem certeza que deseja remover todas as configurações do ESP-IDF? Isso excluirá todas as configurações idf.*.",
"{0} settings will be removed.": "{0} configurações serão removidas.",
"Yes": "Sim",
"No": "Não",
"Starting ESP-IDF settings cleanup...": "Iniciando limpeza das configurações ESP-IDF...",
"Removed global setting: {0}": "Configuração global removida: {0}",
"Removed workspace setting: {0}": "Configuração do espaço de trabalho removida: {0}",
"Removed workspace folder setting: {0}": "Configuração da pasta do espaço de trabalho removida: {0}",
"Warning: Could not fully remove setting {0}: {1}": "Aviso: Não foi possível remover completamente a configuração {0}: {1}",
"ESP-IDF settings removed successfully.": "Configurações ESP-IDF removidas com sucesso.",
"Failed to remove settings: {0}": "Falha ao remover configurações: {0}",
"Error: {0}": "Erro: {0}"
}
15 changes: 14 additions & 1 deletion l10n/bundle.l10n.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,18 @@
"JTAG is soft-disabled ({0} is set to an odd value: {1}).": "JTAG программно отключен ({0} установлен на нечетное значение: {1}).",
"JTAG selection may be affected by strapping configuration ({0} is set).": "Выбор JTAG может зависеть от конфигурации стрэппинга (установлен {0}).",
"JTAG is not disabled.": "JTAG не отключен.",
"IDF Version >= 4.3.x required to have eFuse view": "Требуется IDF версии >= 4.3.x для просмотра e-fuse"
"IDF Version >= 4.3.x required to have eFuse view": "Требуется IDF версии >= 4.3.x для просмотра e-fuse",
"No ESP-IDF settings found to remove.": "Настройки ESP-IDF для удаления не найдены.",
"Are you sure you want to remove all ESP-IDF settings? This will delete all idf.* configurations.": "Вы уверены, что хотите удалить все настройки ESP-IDF? Это удалит все конфигурации idf.*.",
"{0} settings will be removed.": "{0} настроек будет удалено.",
"Yes": "Да",
"No": "Нет",
"Starting ESP-IDF settings cleanup...": "Начинается очистка настроек ESP-IDF...",
"Removed global setting: {0}": "Удалена глобальная настройка: {0}",
"Removed workspace setting: {0}": "Удалена настройка рабочего пространства: {0}",
"Removed workspace folder setting: {0}": "Удалена настройка папки рабочего пространства: {0}",
"Warning: Could not fully remove setting {0}: {1}": "Предупреждение: Не удалось полностью удалить настройку {0}: {1}",
"ESP-IDF settings removed successfully.": "Настройки ESP-IDF успешно удалены.",
"Failed to remove settings: {0}": "Не удалось удалить настройки: {0}",
"Error: {0}": "Ошибка: {0}"
}
15 changes: 14 additions & 1 deletion l10n/bundle.l10n.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,18 @@
"JTAG is soft-disabled ({0} is set to an odd value: {1}).": "JTAG 调试功能已被软禁用({0} 设置为奇数值:{1})。",
"JTAG selection may be affected by strapping configuration ({0} is set).": "JTAG 选择可能受 strapping 配置的影响(已设置 {0})。",
"JTAG is not disabled.": "JTAG 未被禁用。",
"IDF Version >= 4.3.x required to have eFuse view": "需要使用 v4.3 及以上的 IDF 版本才能查看 eFuse"
"IDF Version >= 4.3.x required to have eFuse view": "需要使用 v4.3 及以上的 IDF 版本才能查看 eFuse",
"No ESP-IDF settings found to remove.": "未找到要删除的ESP-IDF设置。",
"Are you sure you want to remove all ESP-IDF settings? This will delete all idf.* configurations.": "您确定要删除所有ESP-IDF设置吗?这将删除所有idf.*配置。",
"{0} settings will be removed.": "{0}个设置将被删除。",
"Yes": "是",
"No": "否",
"Starting ESP-IDF settings cleanup...": "正在开始清理ESP-IDF设置...",
"Removed global setting: {0}": "已删除全局设置:{0}",
"Removed workspace setting: {0}": "已删除工作区设置:{0}",
"Removed workspace folder setting: {0}": "已删除工作区文件夹设置:{0}",
"Warning: Could not fully remove setting {0}: {1}": "警告:无法完全删除设置 {0}:{1}",
"ESP-IDF settings removed successfully.": "ESP-IDF设置已成功删除。",
"Failed to remove settings: {0}": "删除设置失败:{0}",
"Error: {0}": "错误:{0}"
}
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,11 @@
}
],
"commands": [
{
"command": "espIdf.removeEspIdfSettings",
"title": "%espIdf.removeEspIdfSettings.title%",
"category": "ESP-IDF"
},
{
"command": "espIdf.openWalkthrough",
"title": "ESP-IDF: Open Get Started Walkthrough"
Expand Down
1 change: 1 addition & 0 deletions package.nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"esp_idf.tmoScaleFactor.description": "Factor de escala para el tiempo de espera de gdb [predeterminado:1]",
"esp_idf.verifyAppBinBeforeDebug.description": "Verificar binarios de la aplicación antes de depurar",
"espIdf.searchError.title": "ESP-IDF: Sugerencia de error de búsqueda",
"espIdf.removeEspIdfSettings.title": "Eliminar configuración de ESP-IDF",
"idf.flashType.description": "Método de flasheo del dispositivo, UART o JTag",
"idf.wssPort.description": "Puerto del servidor de socket web para Core Dump o GDB Stub",
"openocd.tcl.host.description": "Host para conexión tcl de Openocd",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"idf.wssPort.description": "WebSocket server port for Core Dump or GDB Stub",
"openocd.tcl.host.description": "Host for OpenOCD TCL Connection",
"openocd.tcl.port.description": "Port for OpenOCD TCL Connection",
"espIdf.removeEspIdfSettings.title": "Remove ESP-IDF Settings",
"param.adapterTargetName": "Target name for ESP-IDF Debug Adapter",
"param.buildPath": "Name of CMake build directory",
"param.cmakeCompilerArgs": "Arguments for CMake compilation task",
Expand Down
2 changes: 2 additions & 0 deletions package.nls.pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
"esp_idf.initGdbCommands.description": "Um ou mais comandos GDB a serem executados para configurar o depurador subjacente. ",
"esp_idf.tmoScaleFactor.description": "Fator de escala para tempo limite do gdb [padrão: 1]",
"esp_idf.verifyAppBinBeforeDebug.description": "Verifique os binários do aplicativo antes da depuração",
"espIdf.searchError.title": "ESP-IDF: Buscar Dica de Erro",
"espIdf.removeEspIdfSettings.title": "Remover Configurações ESP-IDF",
"idf.flashType.description": "Método flash do dispositivo, UART ou JTag",
"idf.wssPort.description": "Porta do servidor Web Socket para Core Dump ou GDB Stub",
"openocd.tcl.host.description": "Host para conexão OpenOCD tcl",
Expand Down
1 change: 1 addition & 0 deletions package.nls.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"esp_idf.tmoScaleFactor.description": "Масштабный коэффициент для тайм-аута GDB [по умолчанию: 1]",
"esp_idf.verifyAppBinBeforeDebug.description": "Проверьте двоичные файлы приложения перед отладкой",
"espIdf.searchError.title": "ESP-IDF: Подсказка об ошибке поиска",
"espIdf.removeEspIdfSettings.title": "Удалить настройки ESP-IDF",
"idf.flashType.description": "Метод прошивки устройства, UART или JTag",
"idf.wssPort.description": "Порт веб-сокет-сервера для дампа ядра или заглушки GDB",
"openocd.tcl.host.description": "Хост для подключения openocd tcl",
Expand Down
1 change: 1 addition & 0 deletions package.nls.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"openocd.tcl.host.description": "用于 OpenOCD TCL 连接的主机",
"openocd.tcl.port.description": "用于 OpenOCD TCL 连接的端口",
"param.adapterTargetName": "为 ESP-IDF 调试适配器指定目标",
"espIdf.removeEspIdfSettings.title": "删除 ESP-IDF 设置",
"param.buildPath": "CMake 构建目录的名称",
"param.cmakeCompilerArgs": "用于 CMake 编译任务的参数",
"param.coveredDarkTheme": "深色主题下 ESP-IDF 覆盖率报告中覆盖行的背景颜色",
Expand Down
9 changes: 9 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ import {
IDFWebCommandKeys,
} from "./cmdTreeView/cmdStore";
import { IdfSetup } from "./views/setup/types";
import { removeEspIdfSettings } from "./uninstall";

// Global variables shared by commands
let workspaceRoot: vscode.Uri;
Expand Down Expand Up @@ -3728,6 +3729,14 @@ export async function activate(context: vscode.ExtensionContext) {
);

checkAndNotifyMissingCompileCommands();

// Remove ESP-IDF settings
context.subscriptions.push(
radurentea marked this conversation as resolved.
Show resolved Hide resolved
vscode.commands.registerCommand(
"espIdf.removeEspIdfSettings",
removeEspIdfSettings
)
);
}

function checkAndNotifyMissingCompileCommands() {
Expand Down
148 changes: 148 additions & 0 deletions src/uninstall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import * as vscode from "vscode";
import { Logger } from "./logger/logger";
import { OutputChannel } from "./logger/outputChannel";

export async function removeEspIdfSettings() {
const config = vscode.workspace.getConfiguration();
const settingsToDelete: string[] = [];

// Helper function to recursively find idf settings
function findIdfSettings(obj: any, prefix: string = "") {
if (typeof obj === "object" && obj !== null) {
Object.keys(obj).forEach((key) => {
const fullPath = prefix ? `${prefix}.${key}` : key;
if (fullPath.startsWith("idf.") || fullPath.startsWith("esp.")) {
settingsToDelete.push(fullPath);
}
findIdfSettings(obj[key], fullPath);
});
}
}

// Get all settings directly from configuration
const allSettings = config.inspect("");

// Check values saved in each scope using a simple loop
const scopeValues = [
allSettings?.globalValue,
allSettings?.workspaceValue,
allSettings?.workspaceFolderValue,
];

for (const value of scopeValues) {
if (value) {
findIdfSettings(value);
}
}

if (settingsToDelete.length === 0) {
vscode.window.showInformationMessage(
vscode.l10n.t("No ESP-IDF settings found to remove.")
);
return;
}

// Filter out any duplicate paths
const uniqueSettingsToDelete = [...new Set(settingsToDelete)];

// Ask user for confirmation
const message = vscode.l10n.t(
"Are you sure you want to remove all ESP-IDF settings? This will delete all idf.* configurations."
);
const result = await vscode.window.showWarningMessage(
message,
{
modal: true,
detail: vscode.l10n.t(
"{0} settings will be removed.",
uniqueSettingsToDelete.length
),
},
vscode.l10n.t("Yes"),
vscode.l10n.t("No")
);

if (result !== vscode.l10n.t("Yes")) {
return;
}

// Helper function to remove setting from a specific scope
async function removeSettingFromScope(
setting: string,
target: vscode.ConfigurationTarget,
inspectionValue: any,
scopeDescription: string
) {
try {
if (inspectionValue !== undefined) {
await config.update(setting, undefined, target);
OutputChannel.appendLine(
vscode.l10n.t(`Removed ${scopeDescription} setting: {0}`, setting)
);
}
} catch (e) {
// Silently continue if we can't modify settings for this scope
}
}

try {
const message = vscode.l10n.t("Starting ESP-IDF settings cleanup...");
OutputChannel.appendLineAndShow(message);
Logger.info(message);

const scopeConfigs = [
{
target: vscode.ConfigurationTarget.Global,
property: "globalValue",
description: "global",
},
{
target: vscode.ConfigurationTarget.Workspace,
property: "workspaceValue",
description: "workspace",
},
{
target: vscode.ConfigurationTarget.WorkspaceFolder,
property: "workspaceFolderValue",
description: "workspace folder",
},
];

// Delete each setting
for (const setting of uniqueSettingsToDelete) {
try {
const inspection = config.inspect(setting);

// Try to remove from each scope
for (const { target, property, description } of scopeConfigs) {
await removeSettingFromScope(
setting,
target,
inspection?.[property],
description
);
}
} catch (settingError) {
OutputChannel.appendLine(
vscode.l10n.t(
"Warning: Could not fully remove setting {0}: {1}",
setting,
settingError.message
)
);
}
}

OutputChannel.appendLineAndShow(
vscode.l10n.t("ESP-IDF settings removed successfully.")
);
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
vscode.window.showErrorMessage(
vscode.l10n.t("Failed to remove settings: {0}"),
errorMessage
);
OutputChannel.appendLineAndShow(vscode.l10n.t("Error: {0}"), errorMessage);
Logger.error(errorMessage, error, "extension removeEspIdfSettings");
}
}
Loading