(preserveFocus: boolean = false, viewColumn: vscode.ViewColumn = vscode.ViewColumn.Two)
| 91 | |
| 92 | // retrieves the stored webview or creates a new one if the webview was closed |
| 93 | private getWebview(preserveFocus: boolean = false, viewColumn: vscode.ViewColumn = vscode.ViewColumn.Two): vscode.Webview { |
| 94 | // create webview if necessary |
| 95 | if (!this.panel) { |
| 96 | const webViewOptions: vscode.WebviewOptions & vscode.WebviewPanelOptions = { |
| 97 | enableScripts: true, |
| 98 | enableFindWidget: true, |
| 99 | enableCommandUris: true, |
| 100 | retainContextWhenHidden: true // keep scroll position when not focussed |
| 101 | }; |
| 102 | const showOptions = { |
| 103 | viewColumn: viewColumn, |
| 104 | preserveFocus: preserveFocus |
| 105 | }; |
| 106 | this.panel = vscode.window.createWebviewPanel('rhelp', 'R Help', showOptions, webViewOptions); |
| 107 | this.initializePanel(); |
| 108 | } |
| 109 | |
| 110 | this.panel.reveal(undefined, preserveFocus); |
| 111 | void this.setContextValues(); |
| 112 | |
| 113 | return this.panel.webview; |
| 114 | } |
| 115 | |
| 116 | private initializePanel(): void { |
| 117 | if (!this.panel) { |
no test coverage detected