Open deathaxe opened 7 years ago
Are array literals (or dictionary literals, etc) within the scope of this question? The same section
/definition
distinction has been confusing me, and this confusion may be holding up #324. If they are within the scope of the question, it might be worth retitling it to clarify; if not, I can start a new issue.
In https://github.com/sublimehq/Packages/pull/862, it has been proposed to use meta.sequence
for array-like structures. For Python, that would most likley mean we use meta.sequence.tuple
and meta.sequence.list
to allow differentiation between the two sequence literal types. For JS, one could use meta.sequence.array
, although this seems redudant since JS only has the array sequence type, afaik.
Note that this hasn't been pulled yet.
The section
/definition
distinction is a bit difficult and something that I keep wrapping my head around. For the moment, I mostly go by the rule of "if it is atomic (and can't span multiple lines), it's definition
, otherwise section
", but this isn't definitive.
As an aside, is it even possible in Python to distinguish a tuple from a parenthesized expression? Or a set from a dictionary? The starting punctuation could be immediately followed by a newline.
No, not really. Good observation. The example still works, though 👍
I am wondering how to correctly scope the several punctuations and their metas.
The Documentation wants us to use very general scopes like ...
But there are several questions with it.
punctuation.definition. ...
orpunctuation.section. ...
?punctuation.definition.brackets
orpunctuation.section.brackets
?I can't find answers to these questions from the scopes being defined in the default packages. There seems to be no standard.
Considder a simple C array.
At the moment its begin and end is scoped with
punctuation.section.brackets.begin/end
. A color scheme can't therefore target an array definition or array usage in one syntax. It can't even use syntax independent colors for arrays at all as they might be defined using parentheses / '(...)' in other languages like VBasic. I have to ask the question whether it is a good idea to use too common scope names without reference to the context of an entity's usage?I would rather prefer to scope common language entities instead of special characters. Just treat any language entities like you do with
functions
now.One scope for definition
meta.function. ...
and one for usagemeta.function-call. ...
Doing so with arrays as an example would help to show them with the same colors in all languages no matter whether an index is marked by
[
,(
or whatever.Here is an example I would scope arrays like.
C++
VBScript