Open verhovsky opened 1 week ago
These are JSON schema links within the same document.
It links to this definition further up that describes the structure of HighlightStyleContent
:
{
"definitions": {
"HighlightStyleContent": {
"type": "object",
"properties": {
"color": {
"default": null,
"type": ["string", "null"]
},
"font_style": {
"default": null,
"anyOf": [
{
"$ref": "#/definitions/FontStyleContent"
},
{
"type": "null"
}
]
},
"font_weight": {
"default": null,
"anyOf": [
{
"enum": [100, 200, 300, 400, 500, 600, 700, 800, 900]
},
{
"type": "null"
}
]
}
}
}
}
}
Oh right. My issue is that there's no list in the schema or the docs of the AST node types like variable
, constant
, etc.
Having looked into this more, what would've helped me is that the syntax
part on https://zed.dev/docs/extensions/themes should include an explanation that Zed uses tree sitter, that the grammars are in grammar.json and the highlight rules that group them into rules are in highlight.scm and the standard for what to name these things isn't well defined but a list can be seen in one.json and it also seems to be documented here https://github.com/zed-industries/zed/blob/6af5fdd1c27e887732e7857ba855432a57d20ced/docs/src/extensions/languages.md?plain=1#L91-L131 but saying "@title
captures titles" isn't helpful. What is a title in Python or some other language?
I would also appreciate a way to quickly see what some text's node type is. Either a copy/paste-able command (I have to piece it together myself from reading the tree-sitter docs, right now I'm just guessing, turning nodes neon green and seeing if that text lights up green, it's tedious) or just showing it in the editor.
I opened https://zed.dev/schema/themes/v0.1.0.json to see what are all the syntax nodes that can be highlighted and it just says
This definitions/HighlightStyleContent file is not linked anywhere in the docs.