top | item 30884276

(no title)

ZYinMD | 3 years ago

I haven't checked the Sublime package because I'm not very familiar with Sublime (anymore), but I have some experience developing VSCode themes. Did you need to use "tokens / scopes" to hack the colors? E.g. the color theme of the IDE (whatever theme the user is using at the moment) will paint variables in a certain color, functions in another color, arguments in a third color, etc, so you use regex to parse the text file, identify things that you want to color, then set them to be variables, functions, arguments, etc, so the text editor will give them different colors?

discuss

order

jotaen|3 years ago

That’s how it works in Sublime, yes. You have a regex-based parsing engine that you configure via a YAML file, and there you assign scopes to the tokens.[1]

As a default, the [x]it! Sublime Package uses the available default scopes. The user can choose to override the associated colours in their local settings.[2]

[1]: https://github.com/jotaen/xit-sublime/blob/main/xit.sublime-...

[2]: https://github.com/jotaen/xit-sublime#syntax-highlighting--c...

ZYinMD|3 years ago

Thanks, just to confirm: if you want the users to see nice colors out of the box (no matter what theme they use) without needing to customizing anything in their settings, then you'd have to utilize common scopes like variables / functions / errors in a hacky way, correct?