TL;DR
A 27.5KB language-agnostic WebGPU syntax highlighter was developed, capable of labeling code parts without prior exposure to specific languages. It uses a model that combines local and whole-file context for accurate highlighting.
✦ Why It Matters
Consider experimenting with this syntax highlighter to enhance your code editing tools today.
Key Takeaways
How It Works
The gpu-lexer dissects source code into basic elements and employs a WebGPU model to classify these elements based on their context. This allows it to infer types without needing predefined grammar rules, making it adaptable to various programming languages.
⚠ The Catch
The model's token labeling differs from Shiki by 12.57% on unseen files, indicating potential limitations in accuracy for languages not included in its training.
Related