diff --git a/.vscode/launch.json b/.vscode/launch.json index 15c58c180..1f052981c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,24 +5,24 @@ "name": "Paperclip", "type": "extensionHost", "request": "launch", - "runtimeExecutable": "${execPath}/libs/vscode-extension", + "runtimeExecutable": "${execPath}/integrations/vscode", "args": [ - "--extensionDevelopmentPath=${workspaceFolder}/libs/vscode-extension" + "--extensionDevelopmentPath=${workspaceFolder}/integrations/vscode" ] }, { "name": "Paperclip Tests", "type": "extensionHost", "request": "launch", - "runtimeExecutable": "${execPath}/libs/vscode-extension", + "runtimeExecutable": "${execPath}/integrations/vscode", "args": [ - "${workspaceFolder}/libs/vscode-extension/src/test/all/fixtures", - "--extensionDevelopmentPath=${workspaceFolder}/packages/vscode-extension", - "--extensionTestsPath=${workspaceFolder}/packages/vscode-extension/lib/test" + "${workspaceFolder}/integrations/vscode/src/test/all/fixtures", + "--extensionDevelopmentPath=${workspaceFolder}/integrations/vscode", + "--extensionTestsPath=${workspaceFolder}/integrations/vscode/lib/test" ], "outFiles": [ - "${workspaceFolder}/packages/vscode-extension/lib/test/**/*-test.js" + "${workspaceFolder}/integrations/vscode/lib/test/**/*-test.js" ] } ] diff --git a/integrations/vscode/package.json b/integrations/vscode/package.json index 956f6fc18..dfd578b65 100644 --- a/integrations/vscode/package.json +++ b/integrations/vscode/package.json @@ -85,8 +85,8 @@ "lint": "eslint src", "build:watch": "concurrently \"tsc --watch --preserveWatchOutput\" \"npm run build:syntaxes:watch\"", "prepublishOnly": "npm run build", - "publish:local": "rm -rf node_modules && npm install && vsce package && vsce publish", - "publish:marketplace": "rm -rf node_modules && npm install && vsce package && vsce publish -p $VSCE_TOKEN" + "publish:local": "rm -rf node_modules && npm install && vsce package --no-yarn && vsce publish", + "publish:marketplace": "rm -rf node_modules && npm install && vsce package --no-yarn && vsce publish -p $VSCE_TOKEN" }, "author": "", "license": "MIT", diff --git a/integrations/vscode/src/extension/language/server/designer-client.ts b/integrations/vscode/src/extension/language/server/designer-client.ts index 7c00003e5..cf7ae9ad4 100644 --- a/integrations/vscode/src/extension/language/server/designer-client.ts +++ b/integrations/vscode/src/extension/language/server/designer-client.ts @@ -38,7 +38,7 @@ const startDesignServer = async () => { const binPath = await loadCLIBinPath("/tmp/paperclip"); console.log(binPath); - execa(binPath, [`designer`, `--port`, port], { + execa(binPath, [`designer`, `--port`, String(port)], { stdio: "inherit", }); diff --git a/integrations/vscode/src/extension/preview/live-window.ts b/integrations/vscode/src/extension/preview/live-window.ts index 1788fdb05..8e492c6a2 100644 --- a/integrations/vscode/src/extension/preview/live-window.ts +++ b/integrations/vscode/src/extension/preview/live-window.ts @@ -1,4 +1,4 @@ -import { window, WebviewPanel, ViewColumn } from "vscode"; +import { window, WebviewPanel, ViewColumn, env, Uri } from "vscode"; import * as path from "path"; import { ObservableMap, Store } from "@paperclip-ui/common"; import { EventEmitter } from "events"; @@ -95,7 +95,7 @@ export class LiveWindow { } }; - private _render() { + private async _render() { const state = this.getState(); this._panel.title = `⚡️ ${ @@ -105,12 +105,19 @@ export class LiveWindow { }`; this._panel.webview.html = ""; - this._panel.webview.html = this._getHTML(); + this._panel.webview.html = await this._getHTML(); } - private _getHTML() { + private async _getHTML() { const state = this.getState(); + // For Codespace + const designerHost = await env.asExternalUri( + Uri.parse(`http://localhost:${this._devServerPort}`) + ); + + console.log(`Opening preview: ${designerHost}`); + return ` @@ -167,12 +174,6 @@ export class LiveWindow { const vscode = acquireVsCodeApi(); const initialState = ${JSON.stringify(state)}; vscode.setState(initialState); - - const designServerHost = "localhost:${this._devServerPort}"; - const protocol = "http:"; - const designServerUrl = protocol + "//" + designServerHost; - - @@ -181,7 +182,7 @@ export class LiveWindow {