Skip to content

Commit

Permalink
Con-1037: Toggle full screen bug (#1065)
Browse files Browse the repository at this point in the history
* webview reset

* add warning

---------

Co-authored-by: Justin Milner <jmilner@jmilner-lt2.deka.local>
  • Loading branch information
justinmilner1 and Justin Milner authored Apr 4, 2024
1 parent 888a28e commit a253e7c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
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

0 comments on commit a253e7c

Please sign in to comment.