by hyperhello · 3y ago · 0 comments
The hard part is likely doing it efficiently, and standardizing on a set of token names such that a theme ecosystem can exist.
TextMate grammar is the only syntax highlighting tool I'm familiar with. I'm curious why these others might be preferred. I only know TextMate since it is what VS Code supports.
`5 + 3 = ${5 + 3}`;
const foo = async () => {}
const foo = async function () {}
const foo = { 'PI': 3.14 }
// etc.
And then also remember that HTML can embed that, and CSS. And then highlighting something like TSX which can highlight HTML etc. It quickly becomes a recursive nightmare.And all this is coming from someone who thought similarly to you. And now about 3 weeks of full time work (plus using a pre-built library oniguruma to do a lot of heavy lifting) and I just barely have a performant syntax highlighter. There are still a lot of edge cases I'm working through though.