From: paulober <44974737+paulober@users.noreply.github.com> Date: Wed, 8 May 2024 14:31:30 +0000 (+0200) Subject: Added reload window button after SDK change X-Git-Url: https://repo.jachan.dev/pico-vscode.git/commitdiff_plain/b5ba5fc05083e35479f56069784a35f38f37ac61 Added reload window button after SDK change Signed-off-by: paulober <44974737+paulober@users.noreply.github.com> --- diff --git a/src/commands/switchSDK.mts b/src/commands/switchSDK.mts index 294b01f..d8b2062 100644 --- a/src/commands/switchSDK.mts +++ b/src/commands/switchSDK.mts @@ -1,5 +1,11 @@ import { Command } from "./command.mjs"; -import { ProgressLocation, type Uri, window, workspace } from "vscode"; +import { + ProgressLocation, + type Uri, + window, + workspace, + commands, +} from "vscode"; import type UI from "../ui.mjs"; import { updateVSCodeStaticConfigs } from "../utils/vscodeConfigUtil.mjs"; import { @@ -477,6 +483,18 @@ export default class SwitchSDKCommand extends Command { if (result) { this._ui.updateSDKVersion(selectedSDK.label.replace("v", "")); + + const reloadWindowBtn = "Reload Window"; + // notify user that reloading the window is + // recommended to update intellisense + const reload = await window.showInformationMessage( + "It is recommended to reload the window to update intellisense with the new SDK version.", + reloadWindowBtn + ); + + if (reload === reloadWindowBtn) { + commands.executeCommand("workbench.action.reloadWindow"); + } } } }