-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlighting of keys in dictionary literals when using the official Python syntax definition #49
Comments
The way it works now is that a dict key, regardless of whether it's a variable or string literal, is colored light green. A value is actually supposed to be light blue as well, for variables and string literals, but it looks like I missed defining a color for variables. I wanted to clearly differentiate between keys and values, regardless of what type of entity they are. From what you're saying, you'd like to have strings differentiated from variables, right? Let me see if I can come up with a way to keep a visually similar, but not identical, element to all keys and all values, yet still have a difference between string literals and variables. |
Yeah, I would just want string literals and a variables in the key portion to be more easily distinguishable. I often prefer single quotes, which are even tinier than the double quotes in the example above, so variable and constant parts of dictionary keys visually blend together. Here's a real world example: They don't have to be highlighted exactly like with other color schemes. I actually really like this color and the way it looks with bold values :) |
OK, I see what you mean, thanks! I've never really used MagicPython. A number of years ago the regular Python syntax was pretty bad, so in response I wrote |
Both options are already perfectly acceptable, though I personally prefer the second (more muted) version. Just a thought, would it look slightly better if this background was expanded to the surrounding quotes as well? Similar to the way curly braces in But I can definitely live with the proposed solution, so the rest is completely up to you :P |
Or, rather, it might be better to add this background to variables and leave string literals as is -- now that I think about it, the absolute majority of dictionary literals that I see in the real world use only string literals for keys. In other words, it'd be better to keep the style that already works well in by far the most common case and add small tweaks to improve it for less common cases |
If I use the Neon color scheme (version 3.2.2) and Sublime Text's official Python syntax definition (build 4126), I get dictionary literals highlighted like this:
This looks somewhat confusing, because the only distinction between constant and non-constant parts of expressions used as keys are quotes, which are tiny and too easy to miss.
If I use Sublime Text's built-in color schemes (like Monokai), dictionary keys are highlighted as expected:
I'm not exactly sure where the problem is. FWIW I never noticed this problem while using the MagicPython syntax definition, but it's not listed as supported by Neon color scheme.
The text was updated successfully, but these errors were encountered: