(context)
| 46 | } |
| 47 | |
| 48 | async function resolveSimulatorUrl(context) { |
| 49 | const serverUrl = getServerUrl(); |
| 50 | if (await isServerHealthy(serverUrl)) { |
| 51 | return serverUrl; |
| 52 | } |
| 53 | |
| 54 | const serviceUrl = await resolveExistingServiceUrl(serverUrl); |
| 55 | if (serviceUrl) { |
| 56 | outputChannel.appendLine(`Using existing SimDeck service at ${serviceUrl}`); |
| 57 | return serviceUrl; |
| 58 | } |
| 59 | |
| 60 | const config = vscode.workspace.getConfiguration("simdeck"); |
| 61 | const autoStart = getAutoStartService(config); |
| 62 | if (!autoStart) { |
| 63 | throw new Error( |
| 64 | `SimDeck is not reachable at ${serverUrl} or ${DEFAULT_SERVICE_URL}. Enable auto-start or launch the service manually.`, |
| 65 | ); |
| 66 | } |
| 67 | |
| 68 | return await startProjectService(context); |
| 69 | } |
| 70 | |
| 71 | async function resolveExistingServiceUrl(preferredUrl) { |
| 72 | for (const serviceUrl of serviceUrlCandidates(preferredUrl)) { |
no test coverage detected