Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Short constant names highlighted incorrectly #135
Comments
|
So the issue is that something like Please @elprans and @1st1 weight in. Also, hearing from @pikeas (originator for #42) could be useful. |
|
Thanks for the reply. This is a tough one, for sure. I can understand the case of Below is another real world example of where an inconsistency might come up with longer names. Say we want to declare the instruction set for a CPU (CHIP-8 in this case). from enum import Enum, auto
class InstructionName(Enum):
I_0000 = auto()
I_00E0 = auto()
I_00EE = auto()
I_0NNN = auto()
I_1NNN = auto()
I_2NNN = auto()
I_3XKK = auto()
I_4XKK = auto()
I_5XY0 = auto()
I_6XKK = auto()
I_7XKK = auto()
I_8XY0 = auto()
I_8XY1 = auto()
I_8XY2 = auto()
I_8XY3 = auto()
I_8XY4 = auto()
I_8XY5 = auto()
I_8XY6 = auto()
I_8XY7 = auto()
I_8XYE = auto()
I_9XY0 = auto()
I_ANNN = auto()
I_BNNN = auto()
I_CXKK = auto()
I_DXYN = auto()
I_EX9E = auto()
I_EXA1 = auto()
I_FX07 = auto()
I_FX0A = auto()
I_FX15 = auto()
I_FX18 = auto()
I_FX1E = auto()
I_FX29 = auto()
I_FX33 = auto()
I_FX55 = auto()
I_FX65 = auto()There would be no highlighting for I guess the real problem in this ticket is to figure out what kind of contribution digits have to the constant highlighting heuristic when the two character quota for uppercased alphabets can not be met. Whether they should be considered, and if so, what kind of thresholds and constraints should be enforced with them. |
|
Chiming in since I was tagged. For names containing letters, I suggest the following rule (in pseudocode, not Python):
|
Hi.👋
Short constant names seem to be highlighted incorrectly. I got the assumption that the bug might lie in this MagicPython package. What do you guys think? I ran across this while coding a project, and thought that I should do something about it.
VSCode Example
GitHub Example
I would also like to give special mention to short constant names that end in numbers. They don't seem to be highlighted correctly, even though the same length character-based constants do.