Skip to content

Commit

Permalink
Added reload window button after SDK change
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed May 8, 2024
1 parent 8a76ebe commit b5ba5fc
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/commands/switchSDK.mts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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");
}
}
}
}

0 comments on commit b5ba5fc

Please sign in to comment.