edit icon indicating copy to clipboard operation
edit copied to clipboard

Added minimal syntax highlighting

Open Ayush2006128 opened this issue 4 weeks ago • 3 comments

Added simple tokenizer to implement basic syntax highlighting respecting the simplicity of the project

Screenshot 2025-11-26 175716 Screenshot 2025-11-26 175933

Features:

  • Improves UX or DX
  • It's generic which means works on any language
  • Simple & performant

Note: Currently it only highlights basic things like numbers, identifier, strings, comments // or # and symbols.

This is an experimental feature provide --enable-exp-highlighting flag to enable

Ayush2006128 avatar Nov 26 '25 12:11 Ayush2006128

It was a fascinating experience working on this project

Ayush2006128 avatar Nov 26 '25 12:11 Ayush2006128

Your implementation is a classic tokenizer. Unfortunately, we can't merge it because we would need flexible support for more languages. I'm super happy you liked experimenting on the project though!

(FYI I'm also working on this right now: https://github.com/microsoft/edit/pull/624#issuecomment-3566988552)

lhecker avatar Nov 26 '25 17:11 lhecker

@lhecker I was going to do the same, but wouldn’t that make it more complex and slow down the app? 🤔 Here’s a new solution: we could add language-specific highlighting only for languages like HTML, XML/XAML, YML/YAML, CSS/SCSS, and TOML. For other languages, we could have the tokenizer handle basic elements like booleans or simple keywords using LSPs. 🤷

Ayush2006128 avatar Nov 27 '25 03:11 Ayush2006128