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

Con-1037: Toggle full screen bug #1065

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 17 additions & 5 deletions extensions/vscode/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,12 @@ const commandsMap: (
const fullScreenTab = getFullScreenTab();

// Check if the active editor is the Continue GUI View
if (fullScreenTab && fullScreenTab.isActive) {
vscode.commands.executeCommand("workbench.action.closeActiveEditor");
vscode.commands.executeCommand("continue.focusContinueInput");
if (fullScreenTab && fullScreenTab.isActive) { //Full screen open and focused - close it
vscode.commands.executeCommand("workbench.action.closeActiveEditor"); //this will trigger the onDidDispose listener below
return;
}

if (fullScreenTab) {
if (fullScreenTab) { //Full screen open, but not focused - focus it
// Focus the tab
const openOptions = {
preserveFocus: true,
Expand All @@ -395,15 +394,21 @@ const commandsMap: (
return;
}

//Full screen not open - open it

// Close the sidebar.webviews
// vscode.commands.executeCommand("workbench.action.closeSidebar");
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
// vscode.commands.executeCommand("workbench.action.toggleZenMode");
const panel = vscode.window.createWebviewPanel(

//create the full screen panel
let panel = vscode.window.createWebviewPanel(
"continue.continueGUIView",
"Continue",
vscode.ViewColumn.One,
);

//Add content to the panel
panel.webview.html = sidebar.getSidebarContent(
extensionContext,
panel,
Expand All @@ -414,6 +419,13 @@ const commandsMap: (
undefined,
true,
);

//When panel closes, reset the webview and focus
panel.onDidDispose(() => {
sidebar.resetWebviewProtocolWebview();
vscode.commands.executeCommand("continue.focusContinueInput");
}, null, extensionContext.subscriptions);

},
"continue.selectFilesAsContext": (
firstUri: vscode.Uri,
Expand Down
8 changes: 8 additions & 0 deletions extensions/vscode/src/debugPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ export class ContinueGUIWebviewViewProvider
return this._webview;
}

public resetWebviewProtocolWebview(): void {
if (this._webview) {
this.webviewProtocol.webview = this._webview;
} else{
console.warn("no webview found during reset")
}
}

sendMainUserInput(input: string) {
this.webview?.postMessage({
type: "userInput",
Expand Down