-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
theme keys static and documented #3690
theme keys static and documented #3690
Conversation
@the-mikedavis I didn't add the theme checking but having a single source and always up to date source of truth for theme keys should make it much easier to know if a theme is up to date for maintainers, even with a manual workflow for now. I added all the rest I think, and the resulting documentation is also more searchable IMO since I can now look for |
fd1ad22
to
51a423d
Compare
eb2aafc
to
4a484db
Compare
I preferred seeing keys as "scope.scope.scope" rather than "ScopeScopeScope" - the fallback behavior was more intuitive. Is there a different way of approaching this, maybe by using a macro when getting a key from a theme? |
I could do |
We could make use of namespacing. |
I can try generating something like |
Well it's very hard in @the-mikedavis, what do you think about pub type tk = ThemeKeys; That way the usage point becomes |
4a484db
to
a573093
Compare
5f4e530
to
84729fd
Compare
This comment was marked as resolved.
This comment was marked as resolved.
84729fd
to
8ff28f9
Compare
I moved the names to |
fda58fb
to
2070048
Compare
3e9a55d
to
736fee5
Compare
736fee5
to
2cb8fe4
Compare
2cb8fe4
to
f5623d6
Compare
I don't think CI failures are related to my changes |
cdd7498
to
7375b81
Compare
What do I have to do for this to move forward ? IMO it would greatly improve documentation for theme keys, and avoid allocating strings in several places |
Are these allocations that costly? From what I can tell, we use static strings everywhere apart from parsing the theme file. This might make sense for The query validation could then be done externally: a file could essentially contain a list very similar to the macro input. We'd then use that to generate the documentation tree. A lint script could then |
The documentation benefits to know what is used in themes and what is not are nice and not to be dismissed. For example, this PR surfaces several duplications between Theming is very important to users, having a list of all keys, documented (which they would not be with a parser from the runtime queries), allows trimming down that list on our side (making theme definition easier) and correctly define new themes on the user's side. Ideally we would even document which queries are used in which language, but that would probably make the table too big for now so I left it for later, once I have a better idea for presentation. |
7375b81
to
48c6140
Compare
2e6302f
to
222e76c
Compare
7430701
to
85f73f0
Compare
@archseer @the-mikedavis I completely changed the way this is done.
|
84a658f
to
6df75fb
Compare
6df75fb
to
a8894f6
Compare
a8894f6
to
71cc54d
Compare
71cc54d
to
096b8b7
Compare
Updated to latest master, this PR is no fun to maintain 😓 |
…iglights don't add undocumented ones
096b8b7
to
00093ef
Compare
Hmm why were these closed? We were going to merge this in the next cycle |
This PR adds a
ThemeKey
type that contains as much static scopes as possible for Tree Sitterhighlight queries.
It also adds a new generated file for the book which fully documents the highlight scopes and a
new
cargo xtask
subcommand to ensure all of the default highlight queries are in the staticscopes and will not fall in
ThemeKey::OtherQuery
.Closes #3649