microsoft / microsoft/vscode

Extension API: Allow WebviewPanel to be programmatically pinned or unclosable

Open
#332,577 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

When building persistent UI views (such as a customizable user dashboard), users can accidentally close the tab. While users can manually right-click and pin a tab in VS Code, extensions currently have no way to programmatically request a pinned state or prevent accidental tab closure for persistent extension views.

So i would be nice to have an option that can fix an WebviewPanel so an user cant close it.

The reason behind this feature is i want to build an customizable user dashboard witch should stay open when the user want's that i would bind an setting to it so it can be closed but not accidentally.

Expose a fixed property on WebviewPanel and/or WebviewPanelOptions within the vscode API:
```TypeScript
export interface WebviewPanelOptions {
// Existing options...

/**
* Whether the webview tab should be created in a pinned state.
*/
readonly fixed?: boolean;
}

export interface WebviewPanel {
// Existing properties...

/**
* The pinned status of the panel.
*/
fixed: boolean;
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the TypeScript vscode API definitions for WebviewPanel and WebviewPanelOptions, then trace how extension webview panels are created and how their tab state is handled. Done means the API can request a pinned or otherwise unclosable panel, exposes its state as proposed, and prevents accidental closure for persistent views.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.