Skip to content

Commit b7dc4f9

Browse files
committed
Improve syntax highlighting
* Add ability to customize which edition is used for highlighting (`g:rust_edition`). * Don't highlight enum variants that happen to have the same name as a prelude item. (Also applies to associated types in paths.) * Add support for `safe fn`. * Add support for `&raw const` and `&raw mut`. * Add support for `gen` keyword.[^1] * Highlight items added to the prelude in 2021 and 2024 editions. * Update list of derive macros. * Highlight keywords in positions where an item name is expected (e.g., `fn priv()`).[^2] * Allow non-ASCII characters in identifiers. * Allow `?` as a macro repetition operator (`$()?`).[^3] * Allow raw identifiers in paths and function calls. * Highlight `as` as a keyword rather than an operator.[^4] * Improve highlighting of `async`, `await`, `try`, and `dyn`. * Improve highlighting of `impl ... for ...` using proper parsing. * Improve detection of turbofish function calls (`f::<T>()`). * Improve parsing of attributes (fixes cases like `#[[]]`). * Fix parsing of `/* */*` (previously parsed as a comment containing an unclosed nested comment). * Improve detection of which Markdown code blocks should be highlighted as Rust code in doc comments. * Fix parsing of multiline attributes and macro repetition expressions (`$(x)*`) inside code blocks in doc comments. * Fix parsing of non-Rust code blocks in block doc comments (`/** */`). * Fix parsing of doc comments containing an unclosed code block. * Highlight leading `# ` in doc comment code blocks. * Add option not to highlight code in doc comments (`g:rust_highlight_doc_code`).[^5] * Reduce stale highlighting when syntactic constructs span multiple lines by setting `syn sync linebreaks` to 1. * Add a distinct syntax group for prelude structs instead of including them in `rustTrait`. * Reduce false positives in highlighting of assert and panic macros. * Remove obsolete syntax. [^1]: Fixes rust-lang#521 [^2]: Fixes rust-lang#406 [^3]: Fixes rust-lang#498 [^4]: Fixes rust-lang#493 [^5]: Fixes rust-lang#407
1 parent a28bcc3 commit b7dc4f9

1 file changed

Lines changed: 307 additions & 111 deletions

File tree

0 commit comments

Comments
 (0)