-
Notifications
You must be signed in to change notification settings - Fork 591
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
Annotations/Attributes Scope Naming #709
Comments
My first thought on all this: I hope, at the end, that you make this decision, because I think you're likely the best candidate to see all this at a high level. Very thoughtful points, esp about the identifier scope.
HTH |
Yes, I do plan on making the decision, but I want to gather feedback. I realize that changes to scopes do impact users the most, but also color scheme authors. My hope is that as we are making the Sublime Text world a better place, most users will be willing to put up with the hiccups along the way for the long-term benefit. So far it has been a long process, and I’ve learned a ton since early this year. Some choices have been further refined, or changed back after working on more and more syntaxes. http://www.sublimetext.com/docs/3/scope_naming.html contains guidelines based on everything I’ve learned so far. My intent is to add information from this discussion to that page. In terms of meta scopes, they are intended to be used to mark up “sections” of code that are composed of multiple tokens. For instance, the entirety of a function definition would be scoped |
I basically agree with all of your major points: the I'm not a fan of "attribute", since it feels less descriptive to me than "annotation" or "metadata", but maybe that's my JVM bias showing. The class of constructs we're describing here is really generically "metadata", and it is fundamentally different from other classes of constructs and merits its own scoping. So, from a purely clean design space standpoint, the right thing to do would be to open up a new top level scope. (as a sidebar, it appears that From the standpoint of "least terrible" relative to the ecosystem, nesting under |
Disclaimer: The languages of the discussed set that I use(d) are Python (and Java).
Regarding |
@djspiewak Thanks for your thoughts and time on this. I don't think adding a new high-level scope |
Ok, so I've decided on the following:
Thank you everyone for you time and thoughts on this. |
Adheres to conventions discussed in sublimehq#709 and sublimehq#737.
@wbond Maybe you could add the information from your last post to the scope naming guidelines? |
Yes, that is the plan |
Just for the record, these will be part of the docs with the next release |
ping @ehuss |
Adheres to conventions discussed in sublimehq#709 and sublimehq#737.
Currently the following syntaxes that are part of the default (or will become part of the default) have constructs called annotations, attributes or decorators that modify a function/class/type/etc:
They are not all 100% functionally equivalent, but all seem to generally include:
Currently the scopes are very inconsistent across syntaxes, and I'd like to get it standardized so users and color scheme authors can benefit. Here are links to some existing discussions about them:
My thoughts on the current state of annotations/attributes:
meta.annotation
ormeta.attribute
.punctuation.
scope should be applied to the leading symbolstorage.type
. The Scala PR has proposedstorage.modifier.annotation
. Rust is currently scoping as acomment.
. Python scopes the@
, but just applied ameta.
scope to the rest. I forget where C# is right now. We don't yet have Swift in the default packages.Based on this, I think the decisions that need to be made are:
meta.annotation
ormeta.attribute
as the meta scope? It seems C#, Rust, Swift use the term attribute. Java and Scala use annotation. (Python's decorator construct is slightly different, but I feel it probably makes sense to scope it similarly.)storage.type
is used too much in general.storage.modifier.annotation
feels a little too semantically strict to have this be a general-purpose scope name, but has the benefit of being implemented by existing color schemes.variable.annotation
would be consistent withvariable.function
, but the later has always felt a little odd. The other idea is to start using a new top-level scope name ofidentifier.
that allows for more fine-grained control of identifier in various contexts. The downside of this is that no color schemes currently support it.Pinging the following users for feedback, based on involvement with syntaxes discussed above, or general involvement in this repo:
The text was updated successfully, but these errors were encountered: