Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typst Preview fails on VSCode web and others. #382

Closed
tani opened this issue Jul 8, 2024 · 4 comments · Fixed by #575
Closed

Typst Preview fails on VSCode web and others. #382

tani opened this issue Jul 8, 2024 · 4 comments · Fixed by #575
Labels
document-preview Features about the builtin preview support enhancement New feature or request good first issue Good for newcomers

Comments

@tani
Copy link
Contributor

tani commented Jul 8, 2024

Describe the bug
Typst Preview uses the address of the local host to communicate with the server for preview, so VSCode used from a web browser, such as Gitpod, VSCode web or Coder, will cause address mismatch and the preview will fail.

Package/Software version:

VSCode version(Help -> About):

Gitpod Code
Version: 1.90.2
Commit: dc0e7217f8f11d3249dcd2cd1d2152a2fdb45f3e
Date: 2024-06-20T12:06:32.291Z (2 wks ago)
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0

tinymist extension version: v0.11.0. Get it by tinymist --version in terminal.

Typst Version:       0.11.1

Additional context

https://github.com/Enter-tainer/typst-preview/blob/971dbc7f63ba12af4497204e7c433e0ed62d89a4/addons/frontend/src/main.js#L40

Enter-tainer/typst-preview#292

@Myriad-Dreamin Myriad-Dreamin added the enhancement New feature or request label Jul 8, 2024
@Myriad-Dreamin
Copy link
Owner

In browser environment, you should use the official app, https://typst.app. Regard to this, we may not develop this feature very actively.

@Myriad-Dreamin Myriad-Dreamin added the good first issue Good for newcomers label Jul 8, 2024
@tani
Copy link
Contributor Author

tani commented Jul 8, 2024

Noted. Anyhow thanks for the great lsp and extension. I will use it. However, would you mind to review and accept pull request if I could write it in the near future?

@Myriad-Dreamin
Copy link
Owner

Myriad-Dreamin commented Jul 8, 2024

However, would you mind to review and accept pull request if I could write it in the near future?

Glad that you have feeling to contribute this project. I'll review it for sure. 😃

@tani
Copy link
Contributor Author

tani commented Jul 9, 2024

I have investigated this problem and found it to be difficult to solve. I share my conclusions with future colleagues with the same problem.

https://github.com/Enter-tainer/typst-preview/blob/971dbc7f63ba12af4497204e7c433e0ed62d89a4/addons/vscode/src/extension.ts#L502-L505

The obstacle is that WebSockets are not supported when port forwarding is being used here. This is a problem on the VSCode side. To bypass this, it is necessary to use HTTP Polling or similar instead of WebSocket. However, I have not found a way to bypass this in the RXJS WebSocket client. I will continue to investigate and share any findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
document-preview Features about the builtin preview support enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants