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.
Item access not only with variables #205
Comments
|
I can use a trick similar to the one for detecting function calls and kwargs when they aren't preceded by a plain function name. So I should be able to distinguish the array literals from item access that way in most cases. |
Using item access with anything other than a variable isn't recognized as item access.
I have set "punctuation.definition.arguments" to a custom color in order to highlight brackets and parenthesis only if they are used for item access and function call respectively. However, it doesn't work in all cases when item access is actually done.
Expectation here is that all cases of
[0]should have colored brackets.I can see that solving this might be tricky, but highly appreciated.
Afterthought: Seems like detecting item accessing can be done by the rule "if
['s first preceding non-blank character is present and is not operator". All other cases of[is a list creation. However, capturing object which items are accessed is challenging with regular expressions.