From b5ba5fc05083e35479f56069784a35f38f37ac61 Mon Sep 17 00:00:00 2001 From: paulober <44974737+paulober@users.noreply.github.com> Date: Wed, 8 May 2024 16:31:30 +0200 Subject: [PATCH] Added reload window button after SDK change Signed-off-by: paulober <44974737+paulober@users.noreply.github.com> --- src/commands/switchSDK.mts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/commands/switchSDK.mts b/src/commands/switchSDK.mts index 294b01fa..d8b2062e 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"); + } } } }