[Themes] Suggest only properties and attributes that are supported by the class
As defined in https://www.sublimetext.com/docs/3/themes.html#elements, each class supports only a set of attributes and propeties, and not all of them. PackageDev provides all properties and attributes regardless of whether the class actually supports them. It would be handy if PacckageDev limited the suggestion provided in a rule to the properties and attributes supported by the class. For example
{
"class": "tab_label",
"attributes": |
}
It should suggest transient and hover.
{
"class": "tab_label",
"attributes": ["transient"]
|
}
It should provide shadow and font properties and fg·
Sounds like a task for JSONSchema.
I already implemented some json schemas for common sublime formats https://github.com/AmjadHD/sublime_json_schemas, but theme files are not easy with the current json schema draft.
They are not easy at all.
It's probably easier to implement this with Python code and ST's API and lexing of our syntax file, similar to how we handle other formats in our plugin in. It's fairly low priority for me, however.
The biggest part here is to collect the information about the structure of themes. Means the list of properties supported by certain classes. This is what jsonschema does.
What I had in mind was a general completion engine, which can handle all kinds of json files. Sure, I'd prefere a python plugin doing so rather than a LSP-json running JavaScript junk. Would like the same same for XML like data, btw.
But it's not a trivial job then.