一个VS Code扩展,为Leptos的`view!`宏提供正确的HTML语法高亮和智能提示,克服rust-analyzer语义令牌的覆盖问题,并基于W3C/MDN数据提供准确的补全和悬停文档。

Stars

11

7 天增长

暂无数据

Fork 数

0

开放 Issue

0

开源协议

MIT

最近更新

2026-07-16

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它解决了Leptos开发者的一个长期痛点——rust-analyzer的语义令牌破坏RSX高亮——通过仅过滤标记令牌而不是完全禁用语义高亮,并用MDN文档丰富悬停信息,同时裁剪掉无用的crate级别文档。

适合谁使用

  • 使用Rust编写UI的Leptos框架用户
  • 在VS Code中进行Rust Web前端开发的开发者
  • 因`view!`宏中语法高亮混乱而困扰的开发者

典型使用场景

  • 在`view!`宏中准确着色HTML标签和属性,同时不影响闭包中的Rust高亮
  • 获得按元素分类的属性补全和值建议(例如button的type属性),附带MDN文档
  • 显示清晰的悬停信息,包含HTML文档和tachys类型信息,去除多余的Leptos crate介绍

项目优势

  • 使用与VS Code内置HTML支持相同的W3C/MDN数据,确保补全和悬停准确
  • 仅过滤RSX标记的语义令牌,在其他上下文中保留完整的Rust语义高亮
  • 若rust-analyzer中间件API发生变化,可通过装饰回退优雅降级
  • 支持Leptos特有的属性命名空间(on:、class:、prop:等)并提供使用提示

使用前须知

  • 未用大括号包裹的属性值中若包含裸露的`>`(例如`when=move || count.get() > 0`)会导致高亮混乱,需使用大括号
  • 使用`()`或`[]`作为定界符的`view!`体不会被识别

README 快速开始

Leptos RSX (HTML)

Proper HTML syntax highlighting and IntelliSense inside Leptos view! macros.

This extension is built around two core ideas:

  1. Completions and hovers driven by the same W3C/MDN HTML data and theme colors as VS Code's built-in HTML support — not a hand-typed list.

  2. Handling syntax highlighting at BOTH the semantic token layer and the TextMate grammar layer. Semantic tokens always override grammars, and view! HTML tags are implemented as functions, so rust-analyzer's tokens ruin any HTML grammars.

Problem Statement

Existing RSX extensions fail to address IDE issues with rust-analyzer enabled:

  • rust-analyzer adds semantic tokens that override extension syntax highlighting, coloring html opening tags and attributes as functions, and closing tags with the generic catch-all color:

  • Code completion is inaccurate or missing entirely for html attributes:

  • rust-analyzer hover info inside of the view! macros resolves through the WHOLE macro expansion. The result is a combo of the tachys type (useful) and ALSO the entire Leptos crate-level intro docs (useless):

Problem Resolutions

With this extension installed, you can expect:

  • Correct HTML syntax highlighting for tags and attributes, without affecting nested Rust code closures:

  • Accurate code completion, consistent with behavior inside a .html file:

  • Sane hover info, starting with the info you get in a .html file, followed by the tachys type info. Each section (HTML and rust-analyzer) is labeled for clarity:

Features

Highlighting that survives real code

  • Element tags, component tags (colored like types, including paths like my_crate::widgets::Fancy), and fragments <>…
  • Leptos attribute namespaces: on:, class:, style:, prop:, attr:, bind:, use:, node_ref
  • Attribute values and {…} text nodes re-embed real Rust highlighting, recursively — closures, method calls, format! interpolation, nested view!

IntelliSense that knows HTML

  • Tag completion after `` offers button | submit | reset; works for every value set in the HTML spec data
  • DOM events in Leptos form: on:click, on:input, … with docs
  • Leptos namespaces (class:, prop:, bind:value, …) with usage hints
  • Hover docs for tags and attributes, s

项目描述

VS Code entension providing proper HTML syntax highlighting and IntelliSense inside Leptos view! macros.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

TanStack
精选
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web 开发前端框架
14,861
vercel-labs
精选
vercel-labs GitHub avatar

scriptc

scriptc compiles ordinary TypeScript into small, fast native executables without needing Node.js, V8, or any JavaScript runtime in the binary.

开发者工具代码质量与构建
1,985
Jakubantalik
精选
Jakubantalik GitHub avatar

thinking-orbs

A React component library that renders six hand-tuned animated thought orb loading indicators on a plain 2D canvas, with two purpose-tuned sizes and automatic theme detection for AI and agent UIs.

AI 与机器学习AI 智能体
1,191