(context: vscode.ExtensionContext)
| 296 | } |
| 297 | |
| 298 | async function downloadTypeDecls(context: vscode.ExtensionContext): Promise<void> { |
| 299 | const config = vscode.workspace.getConfiguration("botloader"); |
| 300 | const webHostBase: string = config.get("webHost")!; |
| 301 | const webHttps: boolean = config.get("webHttpsEnabled")!; |
| 302 | const httpHostBase = webHttps ? "https://" + webHostBase : "http://" + webHostBase; |
| 303 | const downloadPath = vscode.Uri.joinPath(vscode.Uri.parse(httpHostBase, true), "typings.tar") |
| 304 | let resp = await fetch(downloadPath.toString()); |
| 305 | |
| 306 | const outPath = vscode.Uri.joinPath(context.globalStorageUri, "/typings"); |
| 307 | console.log("downloading types to: ", outPath.fsPath, resp.status); |
| 308 | |
| 309 | let stream = tar.extract({ |
| 310 | cwd: outPath.fsPath, |
| 311 | strip: 1, |
| 312 | }); |
| 313 | |
| 314 | let body = resp.body?.pipe(stream); |
| 315 | |
| 316 | stream.on("end", () => { |
| 317 | vscode.commands.executeCommand("typescript.reloadProjects"); |
| 318 | }); |
| 319 | } |
no test coverage detected