-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[WIP] Docs on scopes #114
base: master
Are you sure you want to change the base?
[WIP] Docs on scopes #114
Conversation
👍 Having an official grammar naming convention would be great. Then there is at least a place to refer to. And the convention could be refined over time. How much does this version differ from the TextMate convention? I think until an Atom 2.0, it would need to stay somewhat close. Just because there are already lots of themes out there that are mostly based on TextMate's convention. Smaller changes are fine, just not big ones. |
The main difference is the |
I think these scopes are redundant:
These scopes don't append any information about language symbol. |
That may be true, but scopes are used for far more than just syntax highlighting - since they're what give raw text semantic structure in Atom, they're also used for things like autocomplete and static analysis. So while the distinction between single- and double-quoted strings might not really matter for syntax highlighting, it could make all the difference in other contexts. |
Agree. However we can get punctuation via |
Where would brackets, braces and parentheses go? How about a "section" category in "punctuation", I like the way language-ruby handles those characters. |
IMO // `punctuation.definition.parameters` for `(`, `)`
test(param, param) {
// `punctuation.definition.function[.brace.curly]` for `{`, `}`
...
}
|
Is this up-to-date with all the changes that the @atom/languages team have been doing? |
@MaximSokolov In addition to documenting these scopes, could you document how these scopes can be debugged for a particular grammar (e.g. when looking at a file highlighted with that grammar, when trying to find out why a particular scope was applied to a string of text, etc...)? The Hacking Atom: Debugging has laughably little to say on this. |
@MaximSokolov Didn't see this until now, we never added the punctuation scope to the documentation but we do have a spec I've posted here for reference. This is what we go by for the TextMate grammars. This isn't the most complete list but there is also completion for scopes when editing grammars in TextMate, the list of scopes completed is in this command. - Michael Sheets, TextMate Bundle Maintainer |
I noticed that this does not reference the entity scope in the textmate doc, is this intentional? for python this would be useful for "import somepackage" where "somepackage" would be entity.name.package |
Just scopes with examples.
No description yet.
Based on the Textmate docs
Refs atom/atom#8430
New scopes
\u0394
|...)\U00000394
|...)None
in Python ornull
,nil
etc. Should it be one standart scope?)#cfcddd
, ...)augmentedcompound ( += | -= | *= | %= | ... )&
in&x
)*
inint *pointer
)increment-decrement(e.g. in Java and PHP)++
in++x
andx++
)--
in--x
andx--
)function test(param1, param2)
infunction test(param1, param2){}
)functionCall(arg1, arg2)
)methodCall(arg1, arg2)
inobj.methodCall(arg1, arg2)
)(param1, param2)
infunction test(param1, param2){}
)(arg1, arg2)
infunctionCall(arg1, arg2)
,obj.methodCall(arg1, arg2)
)x
inx = 10
)x
in "#{x}")@variable
in Coffeescript)