Resolve webview viewColumn after creating ViewColumn.Beside panel#315506
Open
yogeshwaran-c wants to merge 1 commit into
Open
Resolve webview viewColumn after creating ViewColumn.Beside panel#315506yogeshwaran-c wants to merge 1 commit into
yogeshwaran-c wants to merge 1 commit into
Conversation
Editor events fired during openWebview run before the new webview's handle is registered with addWebviewInput, so updateWebviewViewStates can't find the handle and never sends the resolved viewColumn to the extension host. Push the view state explicitly after registering the handle so symbolic columns (ViewColumn.Beside, ViewColumn.Active) resolve to a concrete column immediately, matching showTextDocument behavior. Fixes microsoft#233448
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a race in the workbench ↔ extension-host synchronization for newly created webview panels opened with symbolic columns (notably ViewColumn.Beside), ensuring webviewPanel.viewColumn resolves to a concrete column immediately after creation.
Changes:
- After registering the webview handle, explicitly pushes a view-state update so the extension host receives the resolved editor column for the new webview panel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #233448
When an extension calls
vscode.window.createWebviewPanel(id, title, vscode.ViewColumn.Beside),webviewPanel.viewColumnkeeps returningundefinedinstead of resolving to the concrete column the panel was placed in.Cause
MainThreadWebviewPanels.$createWebviewPaneldoes:_webviewWorkbenchService.openWebview(...)— actually creates and places the webview, which fires editor-service events.addWebviewInput(handle, webview, ...)— registers the handle for the new input.The events from step 1 trigger
updateWebviewViewStates, but at that moment the new webview is not yet in_webviewInputs, sogetHandleForInputreturnsundefinedand the resolved view state is never pushed to the extension host. The ext-host getter therefore continues to see the symbolic value (-2forBeside) and returnsundefined.Fix
After registering the handle, explicitly call
updateWebviewViewStates(activeEditor)once. This causes the resolved column to be pushed back to the extension host immediately, so symbolic columns (ViewColumn.Beside,ViewColumn.Active) resolve to a concrete column right after creation. This matches the documented behavior ofTextEditor.viewColumn, which the user explicitly compared against in the issue.The change is a one-call addition; existing event-driven updates remain in place for subsequent group/visibility changes.