slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.68k stars 612 forks source link

Improper syntax highlighting #6323

Open Enyium opened 2 months ago

Enyium commented 2 months ago

The following syntax highlighting in VS Code looks off:

1

2 (% should probably be colored like the digits, because this is also the case with units like px.)

3

ogoffart commented 2 months ago
component F {
   font-size: 1.5rem;
   width: 100%;
   property <color> my-color-1: true ? white : black;
   property <color> my-color-1: true ? black : white;
}

Can be reproduced with github on this snippet, so this is a bug in the textmate grammar. (https://github.com/slint-ui/slint/blob/master/editors/vscode/slint.tmLanguage.json)

hunger commented 2 months ago

VSCode seems to be working towards supporting tree-sitter (microsoft/vscode#207416)... that is a way better way to support syntax highlighting than the textmate, Slint supports it and it works fine there:

image

Maybe we can just switch to tree-sitter soon?

tronical commented 2 months ago

Relevant in VS Code might be https://github.com/microsoft/vscode/issues/210475 . It looks like right now they're using the grammars compiled to WASM and it's not extensible yet. Very promising though :)

ogoffart commented 2 months ago

Regardless, we'll still want to maintain the textmate grammar for other things that uses it like the GitHub.

hunger commented 2 months ago

With #6355 applied this is what the example from above looks like in VSCode:

image

using the default dark theme...