Skip to content

feat: add GPU-based typst previewer#2396

Merged
Myriad-Dreamin merged 25 commits intomainfrom
vello-previewer
Feb 12, 2026
Merged

feat: add GPU-based typst previewer#2396
Myriad-Dreamin merged 25 commits intomainfrom
vello-previewer

Conversation

@Myriad-Dreamin
Copy link
Owner

@Myriad-Dreamin Myriad-Dreamin commented Feb 6, 2026

  • render text, shapes, images.
  • render gradient
  • render tiling
  • render scrollbar
  • window rescaling
  • support bidirectional jump
  • render with damage tracking
  • hardware: detect and adjust according to physical dpi
  • subpixel rendering
  • (optional) optimize performance

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 GPU-based Previewer: A new tinymist-render-vello crate has been introduced, providing a GPU-accelerated previewer for Typst documents leveraging the Vello rendering engine.
  • Vello Integration: The new previewer integrates Vello, wgpu, and winit to enable efficient, hardware-accelerated rendering of Typst documents, supporting text, shapes, and images.
  • Incremental Rendering: The IncrVelloDocClient is implemented to handle incremental updates, ensuring that only the changed parts of the document are re-rendered for improved performance.
  • Websocket Protocol Enhancements: The websocket communication between the previewer and the language server has been improved to correctly handle Ping/Pong messages, enhancing connection stability and compliance.
  • VS Code Extension Customization: A new VS Code configuration setting, tinymist.previewExtension, has been added, allowing users to specify a custom extension for previewing, which facilitates the use of the new Vello-based previewer.

🧠 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
  • Cargo.lock
    • Added numerous new dependencies for Vello, wgpu, winit, and related graphics/UI libraries.
    • Updated existing dependencies for websocket handling and other components.
  • crates/tinymist-render-vello/Cargo.toml
    • New crate definition for the Vello-based renderer, including its dependencies and features.
  • crates/tinymist-render-vello/src/incr.rs
    • Implemented IncrVec2VelloPass and IncrVelloDocClient for incremental rendering logic from Typst's vector intermediate representation to Vello scenes.
  • crates/tinymist-render-vello/src/lib.rs
    • Defined core data structures (VecPage, VecScene, GroupScene) for Vello scene representation and rendering.
  • crates/tinymist-render-vello/src/main.rs
    • Added the main application logic for the GPU previewer, including websocket client setup and winit event loop management for display.
  • crates/tinymist-render-vello/src/render.rs
    • Implemented the Renderer and RenderStack logic to convert Typst vector elements (paths, images, glyphs) into Vello scene commands.
  • crates/tinymist/src/tool/preview.rs
    • Enhanced websocket message handling in bind_streams to correctly process Ping/Pong messages and categorize unsupported message types.
  • crates/typst-preview/src/actor/render.rs
    • Adjusted logging levels from trace/debug to info for RenderActor messages to provide clearer insights into its activity.
  • crates/typst-preview/src/actor/webview.rs
    • Improved websocket message processing to respond to Ping with Pong and ignore Pong messages, enhancing protocol compliance.
  • crates/typst-preview/src/lib.rs
    • Extended the WsMessage enum with Ping(Bytes) and Pong(Bytes) variants to support new websocket message types.
  • editors/vscode/package.json
    • Added a new configuration setting tinymist.previewExtension to allow users to specify a custom VS Code extension for previewing.
  • locales/tinymist-vscode.toml
    • Added localization strings for the new tinymist.previewExtension setting in English and Chinese.
Activity
  • A new tinymist-render-vello crate was added, containing the core logic for the GPU-based previewer.
  • Extensive new dependencies were introduced in Cargo.lock to support the Vello rendering ecosystem.
  • Websocket communication handling was refined across tinymist and typst-preview to improve stability and protocol adherence.
  • Logging verbosity for the RenderActor was adjusted to provide more informative output.
  • A new VS Code configuration option was added, along with its localization, to enable customization of the preview extension.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Myriad-Dreamin
Copy link
Owner Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Myriad-Dreamin Myriad-Dreamin marked this pull request as ready for review February 12, 2026 00:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WsMessage and the preview WebSocket bridge to support Ping/Pong frames.
  • Introduce a new tinymist-viewer crate (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.

Myriad-Dreamin and others added 2 commits February 12, 2026 08:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Myriad-Dreamin Myriad-Dreamin merged commit 1f26aa0 into main Feb 12, 2026
48 checks passed
@Myriad-Dreamin Myriad-Dreamin deleted the vello-previewer branch February 12, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments