don't force window reload when checking beta checkbox

This commit is contained in:
Nate 2024-10-04 11:31:15 -07:00
parent f4057fbe19
commit bd9136ec4a
4 changed files with 27 additions and 5 deletions

View file

@ -97,4 +97,5 @@ export type ToWebviewOrCoreFromIdeProtocol = {
{ sessionInfo: ControlPlaneSessionInfo | undefined },
void,
];
didChangeIdeSettings: [{ settings: IdeSettings }, void];
};

View file

@ -77,7 +77,7 @@
"continue.enableContinueForTeams": {
"type": "boolean",
"default": false,
"markdownDescription": "_(Requires window reload)_ Enable Continue for teams beta features. To sign in, click the person icon in the bottom right of the sidebar."
"markdownDescription": "Enable Continue for teams beta features. To sign in, click the person icon in the bottom right of the sidebar."
},
"continue.showInlineTip": {
"type": "boolean",

View file

@ -331,6 +331,16 @@ export class VsCodeExtension {
this.ide.onDidChangeActiveTextEditor((filepath) => {
this.core.invoke("didChangeActiveTextEditor", { filepath });
});
vscode.workspace.onDidChangeConfiguration(async (event) => {
if (event.affectsConfiguration(EXTENSION_NAME)) {
const settings = this.ide.getIdeSettingsSync();
const webviewProtocol = await this.webviewProtocolPromise;
webviewProtocol.request("didChangeIdeSettings", {
settings,
});
}
});
}
static continueVirtualDocumentScheme = EXTENSION_NAME;

View file

@ -142,18 +142,29 @@ function ProfileSwitcher() {
useEffect(() => {
ideMessenger.ide.getIdeSettings().then(({ enableControlServerBeta }) => {
setControlServerBetaEnabled(enableControlServerBeta);
dispatch(setLastControlServerBetaEnabledStatus(enableControlServerBeta));
const shouldShowPopup =
!lastControlServerBetaEnabledStatus && enableControlServerBeta;
if (shouldShowPopup) {
ideMessenger.ide.showToast("info", "Continue for Teams enabled");
}
setControlServerBetaEnabled(enableControlServerBeta);
dispatch(setLastControlServerBetaEnabledStatus(enableControlServerBeta));
});
}, []);
useWebviewListener(
"didChangeIdeSettings",
async (msg) => {
const { settings } = msg;
setControlServerBetaEnabled(settings.enableControlServerBeta);
dispatch(
setLastControlServerBetaEnabledStatus(settings.enableControlServerBeta),
);
},
[],
);
useEffect(() => {
ideMessenger
.request("config/listProfiles", undefined)