Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

fix: vscode-remote support #83

Merged
merged 6 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:

env:
Expand All @@ -27,15 +28,15 @@ jobs:
rust-target: aarch64-pc-windows-msvc
platform: win32
arch: arm64
- os: ubuntu-latest
- os: ubuntu-20.04
rust-target: x86_64-unknown-linux-gnu
platform: linux
arch: x64
- os: ubuntu-latest
- os: ubuntu-20.04
rust-target: aarch64-unknown-linux-gnu
platform: linux
arch: arm64
- os: ubuntu-latest
- os: ubuntu-20.04
rust-target: arm-unknown-linux-gnueabihf
platform: linux
arch: armhf
Expand Down
8 changes: 6 additions & 2 deletions addons/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ export async function getCliPath(extensionPath?: string): Promise<string> {
}

vscode.window.showWarningMessage(
`Failed to find ${state.BINARY_NAME} executable at ${bundledPath},` +
`maybe we didn't ship it for your platform? Using ${state.BINARY_NAME} from PATH`);
`${state.BINARY_NAME} executable at ${bundledPath} not working,` +
`maybe we didn't ship it for your platform or it cannot run due to library issues?` +
`In this case you need compile and add ${state.BINARY_NAME} to your PATH.`);
return state.BINARY_NAME;
};

Expand Down Expand Up @@ -310,6 +311,9 @@ const launchPreview = async (task: LaunchInBrowserTask | LaunchInWebViewTask) =>
.toString()}/typst-webview-assets`
);
panel.webview.html = html.replace("ws://127.0.0.1:23625", `ws://127.0.0.1:${dataPlanePort}`);
// 虽然配置的是 http,但是如果是桌面客户端,任何 tcp 连接都支持,这也就包括了 ws
// https://code.visualstudio.com/api/advanced-topics/remote-extensions#forwarding-localhost
await vscode.env.asExternalUri(vscode.Uri.parse(`http://127.0.0.1:${dataPlanePort}`));
activeTask.set(bindDocument, {
panel,
addonΠserver,
Expand Down
Loading