PackageDev icon indicating copy to clipboard operation
PackageDev copied to clipboard

[Themes] Suggest only properties and attributes that are supported by the class

Open AmjadHD opened this issue 6 years ago • 5 comments

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·

AmjadHD avatar Jan 21 '20 21:01 AmjadHD

Sounds like a task for JSONSchema.

deathaxe avatar Feb 22 '20 10:02 deathaxe

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.

AmjadHD avatar Feb 22 '20 23:02 AmjadHD

They are not easy at all.

deathaxe avatar Feb 23 '20 09:02 deathaxe

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.

FichteFoll avatar Feb 26 '20 16:02 FichteFoll

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.

deathaxe avatar Feb 26 '20 18:02 deathaxe