feat: add GPU-based typst previewer#2396
Conversation
Summary of ChangesHello @Myriad-Dreamin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly upgrades the Typst preview functionality by integrating a new GPU-accelerated rendering engine, Vello. This change aims to deliver a smoother and more performant preview experience for Typst documents. The new previewer operates as a standalone Rust crate, communicating with the existing language server via an enhanced websocket protocol. A new VS Code configuration option is also included to streamline the adoption and customization of this advanced preview mechanism. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new GPU-based previewer for Typst using the Vello rendering engine. This is a significant feature addition, involving a new crate tinymist-render-vello and numerous dependency updates. The new crate sets up a winit window and connects to the Tinymist server to receive and render document updates.
My review focuses on the new Rust code. I've found several areas for improvement, including potential panics, missing feature implementations (like SVG image rendering and various transforms), and some temporary workarounds that should be replaced with more robust solutions. Specifically, there's a critical issue with websocket connection handling that needs to be addressed. I've also made some suggestions to improve logging and error handling. Overall, this is a great step towards a high-performance previewer, and with these changes, it will be more stable and feature-complete.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This reverts commit 6016ee9.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new GPU-based previewer for Typst documents using the Vello rendering engine and Xilem UI framework. This is a significant feature addition, including a new tinymist-viewer crate and extensive changes to support the new rendering pipeline and communication with the previewer. The changes are well-structured, with new dependencies for graphics, a new binary for the viewer, and updates to the websocket communication to be more robust. The implementation of the viewer itself seems solid, with good use of xilem's reactive UI patterns and ezsockets for client-side websocket handling. I've found a few areas for improvement, including a potential panic, a duplicated dependency, and some minor code cleanup. Overall, this is a great step forward for providing a high-performance preview experience.
There was a problem hiding this comment.
Pull request overview
Adds a new GPU-based Typst preview path (Vello/Xilem) and extends the preview WebSocket protocol handling to support Ping/Pong, aiming to improve rendering performance and connection robustness across editor integrations.
Changes:
- Extend
WsMessageand the preview WebSocket bridge to support Ping/Pong frames. - Introduce a new
tinymist-viewercrate (CLI + library) to render Typst vector IR via Vello/Xilem. - Update workspace dependencies (graphics stack, networking, tokio bump) to support the new viewer.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/typst-preview/src/lib.rs | Adds Ping/Pong variants to WsMessage. |
| crates/typst-preview/src/actor/webview.rs | Handles Ping/Pong from the webview connection. |
| crates/tinymist/src/tool/preview.rs | Maps Ping/Pong between tungstenite Message and WsMessage. |
| crates/tinymist-world/src/font/web/mod.rs | Removes a stale commented-out line in web font loader. |
| crates/tinymist-viewer/src/render.rs | New renderer from vector IR to Vello scenes (paths/images/text). |
| crates/tinymist-viewer/src/main.rs | New viewer CLI app wiring websocket → incremental doc → UI. |
| crates/tinymist-viewer/src/lib.rs | Core scene types (VecScene, GroupScene) and render entrypoints. |
| crates/tinymist-viewer/src/incr.rs | Incremental document client → page scenes conversion. |
| crates/tinymist-viewer/src/doc.rs | Xilem/Masonry widget for painting a page scene and handling clicks. |
| crates/tinymist-viewer/dist.toml | Dist configuration for building the viewer with cli feature. |
| crates/tinymist-viewer/Cargo.toml | New crate manifest + feature flags. |
| crates/tinymist-cli/src/cmd/preview.rs | Adjusts websocket message handling in preview CLI. |
| Cargo.toml | Adds graphics + UI deps and bumps tokio; configures workspace features. |
| Cargo.lock | Locks new dependencies introduced by viewer/graphics stack. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
render with damage tracking