MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / openSimulatorPanel

Function openSimulatorPanel

packages/vscode-extension/extension.js:177–206  ·  view source on GitHub ↗
(serverUrl)

Source from the content-addressed store, hash-verified

175}
176
177function 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
208async function openSourceLocation(message) {
209 const file = typeof message.file === "string" ? message.file : "";

Callers 1

activateFunction · 0.85

Calls 2

getWebviewHtmlFunction · 0.85
openSourceLocationFunction · 0.85

Tested by

no test coverage detected