Skip to content
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

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

Open
AmjadHD opened this issue Jan 21, 2020 · 5 comments

Comments

@AmjadHD
Copy link
Contributor

AmjadHD commented Jan 21, 2020

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·

@deathaxe
Copy link
Member

Sounds like a task for JSONSchema.

@AmjadHD
Copy link
Contributor Author

AmjadHD commented Feb 22, 2020

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.

@deathaxe
Copy link
Member

They are not easy at all.

@FichteFoll
Copy link
Member

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.

@deathaxe
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants