mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Add WebviewView.description
Allow configuring the description for webview views. This is rendered next to the title in a less prominently in the title
This commit is contained in:
@@ -29,13 +29,15 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
|
||||
}
|
||||
|
||||
public $setWebviewViewTitle(handle: extHostProtocol.WebviewHandle, value: string | undefined): void {
|
||||
const webviewView = this._webviewViews.get(handle);
|
||||
if (!webviewView) {
|
||||
throw new Error('unknown webview view');
|
||||
}
|
||||
const webviewView = this.getWebviewView(handle);
|
||||
webviewView.title = value;
|
||||
}
|
||||
|
||||
public $setWebviewViewDescription(handle: extHostProtocol.WebviewHandle, value: string | undefined): void {
|
||||
const webviewView = this.getWebviewView(handle);
|
||||
webviewView.description = value;
|
||||
}
|
||||
|
||||
public $registerWebviewViewProvider(viewType: string, options?: { retainContextWhenHidden?: boolean }): void {
|
||||
if (this._webviewViewProviders.has(viewType)) {
|
||||
throw new Error(`View provider for ${viewType} already registered`);
|
||||
@@ -89,5 +91,13 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
|
||||
provider.dispose();
|
||||
this._webviewViewProviders.delete(viewType);
|
||||
}
|
||||
|
||||
private getWebviewView(handle: string): WebviewView {
|
||||
const webviewView = this._webviewViews.get(handle);
|
||||
if (!webviewView) {
|
||||
throw new Error('unknown webview view');
|
||||
}
|
||||
return webviewView;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user