Packages: Default scope for class names?

Created on 1 Jun 2016  路  4Comments  路  Source: sublimehq/Packages

The discussion here https://github.com/wesbos/cobalt2/issues/104 led me to this https://github.com/wesbos/cobalt2/issues/103 regarding ES6 class highlighting in JavaScript.

Examining the scope name used by a handful of the default syntaxes for class names it looks like they are split between entity.name.class.xxx (e.g. C++ and PHP) and entity.name.type.class.xxx (e.g. JavaScript, Java, Python). Is there a reason for this difference? If not, perhaps it would be a good idea to standardize on one scope name or the other?

question

Most helpful comment

My intent is to standardize on entity.name.class. I guess I missed Python, and JavaScript was early on before I started a lot of the standardization work.

In general, my recommendation will be to have color schemes highlight the following selectors:

  • entity.name (this will include .constant, .namespace, .macro, .function, .class, .struct, .union, .impl, .trait, .interface, .enum, .type, .val, .package etc)
  • entity.name.tag (HTML and XML tags, various markup syntaxes)
  • entity.name.label (Various syntaxes)
  • entity.name.section (LaTeX, Markdown)

There is one instance of entity.name.other in YAML that could perhaps be something like entity.name.section or entity.name.label.

To keep more strict adherence with old syntaxes and color schemes we could put everything from entity.name other than entity.name.function as a sub-scope of entity.name.type, but I don't think that is all that accurate, especially with things like .constant, .namespace and .package.

All 4 comments

My intent is to standardize on entity.name.class. I guess I missed Python, and JavaScript was early on before I started a lot of the standardization work.

In general, my recommendation will be to have color schemes highlight the following selectors:

  • entity.name (this will include .constant, .namespace, .macro, .function, .class, .struct, .union, .impl, .trait, .interface, .enum, .type, .val, .package etc)
  • entity.name.tag (HTML and XML tags, various markup syntaxes)
  • entity.name.label (Various syntaxes)
  • entity.name.section (LaTeX, Markdown)

There is one instance of entity.name.other in YAML that could perhaps be something like entity.name.section or entity.name.label.

To keep more strict adherence with old syntaxes and color schemes we could put everything from entity.name other than entity.name.function as a sub-scope of entity.name.type, but I don't think that is all that accurate, especially with things like .constant, .namespace and .package.

Out of curiosity, is there any non-entity.name entity scope?

Edit: there's entity.other.inherited-class and entity.other.attribute-name, and some other exotics.

@wbond: Thanks for the information. I prefer entity.name.class myself, so I would be happy with the official syntaxes going in that direction (though of course just standardizing on one or the other seems more important). And I don't really like the idea of putting everything in entity.name other than function under .type.

From the list @FichteFoll provided it looks like in the color schemes he checked entity.name.class is targeted twice as often as entity.name.type.class is as well.

This has been resolved for all of the syntaxes we've worked on rewriting recently. Work will continue on others and I will document entity.name.class as the standard in the official docs once I get to that.

Was this page helpful?
0 / 5 - 0 ratings