Repository navigation
Conversation
Niox1337
force-pushed
the
feat/limn-highlighting-899
branch
from
December 4, 2026 06:05
7a011bb to
a5e06f1
Compare
0.5.0 splits the grammars into nine features. Enable the eight that contain the grammars Winc maps to limn. Contextual keywords such as Java record and when, Groovy trait and Scala given are now keywords only where the grammar allows them, so the tests check them in declarations instead of as bare words.
limn gives JSX child text and plain identifiers the same kind, so the capitalized type pass colored words such as Hello in element text. Track tags, children and brace expressions from the punctuation limn emits and skip the pass inside child text.
limn takes Nix escapes as more than one character, so "\u{" leaks a
string into the following lines. It also interpolates $${ and lets a
path swallow a following indented string. The DFA rules handle all of
these, so the tests assert every original expectation again.
limn treats %{ and %} on their own lines as line comments, so the
lines between them are colored as code. The DFA rules color the whole
block. They need the compiler's if-value action again.
Niox1337
force-pushed
the
feat/limn-highlighting-899
branch
from
December 4, 2026 23:22
a5e06f1 to
c30716e
Compare
CPU-JIA
reviewed
Dec 5, 2026
CPU-JIA
left a comment
Contributor
There was a problem hiding this comment.
Bounded review of the incremental syntax cache at c30716e36bf4b986c4e3e4f469c9314278b38fed. Two minimal regressions and an incremental-vs-fresh differential probe fail on the original head. With temporary local changes to the two guards described inline, both minimal cases and the differential probe (Rust, TSX, HTML, Python, Ruby, YAML, C++ and Go; 48 edit batches each) pass; existing winc-syntax unit tests also pass: 85 passed / 2 ignored. Tested on Windows with Rust 1.99.1 and exact LF fixture bytes, without blessing snapshots. The temporary changes have been reverted; no commits or pushes were made to this PR. This does not claim full workspace, UI or performance validation.
Niox1337
force-pushed
the
feat/limn-highlighting-899
branch
from
December 5, 2026 22:14
c30716e to
15c6e8b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #899
Every language is now highlighted by limn (
limn-hl0.7.0, MIT, no dependencies of its own). That covers all 81 built-in definitions, including HTML, Astro, Vue, Svelte, PHP, Shell, SQL, XML, LaTeX, Typst, Mermaid, Nix and MATLAB. The DFA engine and its compiled tables are removed. Languages can still be defined in the existing.syntaxformat at runtime, compiled lazily off the UI thread and run through limn as custom grammars.###separated HTTP requests, dotenv values and dates and UUIDs in logs use limn too, after Perl: heredoc bodies are tokenized as code ekesti/limn#14 to log: UUIDs and syslog dates are only partly highlighted ekesti/limn#19 were fixed. CSV and TSV stay plain text with column colors. Verilog and SystemVerilog are new. Godot scenes, resources andproject.godotopen as INI. The new extensions are registered in the Windows installers and the macOS bundle. These also cover the earlier requests [Feature]: 增加对 verilog/systemverilog 的高亮显示 #849, [Feature]: 希望考虑支持 Godot 项目常用文件(特别是 .gd / GDScript)的语法高亮 #881, [Feature]: NuShell language supports #756 and [Feature]: 文件高亮配色能支持更多文件,或者支持自定义配色吗 #524.winc-syntaxcaches limn tokens per line in compact spans and keeps the checkpoints limn reports at line starts. After an edit, scanning resumes from the last checkpoint before the changed line and stops once a checkpoint matches the cached one again, so an edit rescans only the lines it affects. Exact scanning extends at most 512 KiB past the last exact checkpoint. Farther jumps scan aligned windows with lookback on demand and the result is approximate, so no scan grows with the size of the file.LanguageRegistrytakes.syntaxdefinitions at runtime. Each mode compiles to aregex-automatahybrid DFA (already in the binary throughregex, so no new crate) with the old match semantics: anchored, longest match, rule order on ties, word boundary look-behind and end of input. The grammar reports a checkpoint at every line start with a 4 byte state, so runtime languages share the line cache, checkpoint resume and window limits of built-in ones.embedcan delegate to any limn grammar or another runtime language. Compilation starts on a background thread the first time a document needs tokens, the document shows plain text until then and redraws once it is ready. Definitions are capped at 64 KiB, 128 modes, 512 rules and 64 KiB per automaton, and every error is a value withfile:line. The registry is a value the caller owns, so the plugins module can keep one per window. Replacing or removing a definition drops its automata and the cached tokens of documents that use it. Ignore files are the first user.<wxs>blocks and Astro frontmatter.rules.bin(128,900 bytes on dev), the dense and sparse table readers and the table compiler incargo xtask syntaxare removed. The.syntaxparser moves from xtask intowinc-syntax, and xtask uses it to generate the language metadata. The highlight snapshots and lexer tests of languages on limn are removed, since their colors now come from limn. Tests of the cache, checkpoint resume, embedded regions and the auto pairing features stay. The GDScript and Nushell definitions and snapshots the DFA produced are kept as runtime fixtures, and the runtime engine reproduces them exactly.Visible differences
Decorators, tags, attributes, CSS selectors, interpolation delimiters and Rust lifetimes get the color limn assigns. Regular expressions in JavaScript, TypeScript and Ruby are colored by their parts instead of as one string. Variables and properties follow the kinds limn reports. Markdown
==highlight==is plain text, since limn has no token for it. Known limit: comment toggling treats a standalone---as the end of Astro frontmatter even inside a comment or template string.Performance
cargo xtask benchon macOS (Apple silicon) against dev 5fac00c, in two passes: dev, branch, branch, dev and then branch, dev, dev, branch. Each cell is the median of the four runs with the range in brackets.Vim key to frame p95 is 16.4 ms in every run on both builds, over budget on dev as well on this machine.
Change type
Verification
cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo xtask test --allScreenshots
Left is before, right is after.
Existing languages (TypeScript, Rust, Vue)
New languages (SystemVerilog, GDScript, Nushell, Device Tree)
Checklist
cargo xtask benchwhen in doubt).