Open FichteFoll opened 8 years ago
So far C uses entity.name.constant
. I'll update Ruby to use this scope also since I imagine users will often want to highlight constants different than types.
Currently Ruby uses variable.other.constant
for references to it. While C code usually uses uppercase for preprocessor macros, some classes are all uppercase also, and it would be odd to highlight those as constants. I feel like we will only be able to pull this off in languages that enforce formatting of variables versus constants, etc.
Ruby emits warnings when re-assigning to uppercase identifiers, so I guess that counts? I don't know how it behaves with all-uppercase class names though.
Python only mentiones this in PEP8.
For Python, via #1642, I made the minimum requirement of the identifier only consisting of upper-case letters, digits and underscores and having at least 2 consecutive letters. Imo this is heuristic is good enough, at least for Python code, but I believe this convention is followed among most languages that aren't C (or have macros in upper-case).
The scope name is variable.other.constant.python
(#1242).
(via #393)
It seems that the Ruby syntax defines
entity.name.type.constant.ruby
scopes for definitions to "constant variables". However, as with almost all other languages, this naming scheme is not enforced. Since this UPPER_CASE scheme is shared among almost all languages, it makes sense to unify this behavior for all languages. As such, I propose the following changes:variable.constant
(sounds contradicting) orconstant.other.user
or similar.entity.name.constant
.Opinions?