(serverUrl)
| 175 | } |
| 176 | |
| 177 | function openSimulatorPanel(serverUrl) { |
| 178 | if (simulatorPanel) { |
| 179 | simulatorPanel.dispose(); |
| 180 | simulatorPanel = undefined; |
| 181 | } |
| 182 | |
| 183 | simulatorPanel = vscode.window.createWebviewPanel( |
| 184 | "simdeck.simulator", |
| 185 | "Simulator View", |
| 186 | vscode.ViewColumn.Beside, |
| 187 | { |
| 188 | enableScripts: true, |
| 189 | retainContextWhenHidden: true, |
| 190 | }, |
| 191 | ); |
| 192 | |
| 193 | simulatorPanel.webview.html = getWebviewHtml(serverUrl); |
| 194 | simulatorPanel.webview.onDidReceiveMessage((message) => { |
| 195 | if (message?.type === "simdeck.openSource") { |
| 196 | openSourceLocation(message).catch((error) => { |
| 197 | outputChannel.appendLine( |
| 198 | `Unable to open source location: ${error instanceof Error ? error.message : String(error)}`, |
| 199 | ); |
| 200 | }); |
| 201 | } |
| 202 | }); |
| 203 | simulatorPanel.onDidDispose(() => { |
| 204 | simulatorPanel = undefined; |
| 205 | }); |
| 206 | } |
| 207 | |
| 208 | async function openSourceLocation(message) { |
| 209 | const file = typeof message.file === "string" ? message.file : ""; |
no test coverage detected