Skip to content
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

Python syntax highlighting is worse after the latest update #82

Open
dgudim opened this issue Oct 25, 2023 · 19 comments
Open

Python syntax highlighting is worse after the latest update #82

dgudim opened this issue Oct 25, 2023 · 19 comments

Comments

@dgudim
Copy link

dgudim commented Oct 25, 2023

Before (variables, function calls and definitions are kinda separated)
image

After (everything is blue and yellow now, even less separation)
image

@song-dog
Copy link

@dgudim I just spent the last 3 hours banging my head against the wall trying to figure out why all of a sudden my syntax highlighting had suddenly changed. I believe I finally traced the culprit back to this extension, and specifially the update from yesterday re: semantic highlighting. Once i switched that setting from "configuredByTheme" to "false", everything went back to normal.
semanticHighlighting-0
Alternatively you can override the semantic highlighting rules yourself if you prefer.
semanticHighlighting-1

@dgudim
Copy link
Author

dgudim commented Oct 26, 2023

@song-dog oh my god, thanks. The theme is probably missing colors for semantic token scopes

@jdinhify
Copy link
Owner

jdinhify commented Oct 26, 2023

@song-dog @dgudim apologies for the inconvenience

there's another PR to enhance these semantic token, but I think it won't address your issue

so could you please try either these settings and let me know which would be more helpful to you 🙏

"editor.semanticTokenColorCustomizations": {
  "rules": {
    "builtinConstant": "#d3869b",
    "property": "#8ec07c",
    "parameter": "#83a598",
    "variable": "#ebdbb2",
    "magicFunction": "#fe8019",
    "function": "#fe8019",
    "method": "#fe8019"
  }
},
Screen Shot 2023-10-26 at 6 37 04 pm
"editor.semanticTokenColorCustomizations": {
  "rules": {
    "builtinConstant": "#d3869b",
    "property": "#ebdbb2",
    "parameter": "#83a598",
    "variable": "#8ec07c",
    "magicFunction": "#fe8019",
    "function": "#fe8019",
    "method": "#fe8019"
  }
},
Screen Shot 2023-10-26 at 6 37 32 pm

@dgudim
Copy link
Author

dgudim commented Oct 26, 2023

@jdinhify The first one looks better IMO

@jdinhify
Copy link
Owner

jdinhify commented Oct 26, 2023

#83 has been merged & published

@dgudim
Copy link
Author

dgudim commented Oct 26, 2023

Can we differentiate between 'magic' and regular functions? (file and main) for example?

@jdinhify
Copy link
Owner

Can we differentiate between 'magic' and regular functions? (file and main) for example?

I work mainly with JS/TS & don't see these magic functions often (or ever) so not sure about the importance of the distinction. In python, looks like the __ wrappers are already used to differentiate?

What would you think is a good colour if have to choose? Colours to pick below - I tried them and thought that the current setting (same colour) is the most ok:

fb4934
fabd2f
83a598
d3869b
8ec07c
fe8019

@dgudim
Copy link
Author

dgudim commented Oct 27, 2023

Ok, maybe leave it as default then, I'll change it locally, probably to darker orange or dark magenta

@dgudim
Copy link
Author

dgudim commented Oct 27, 2023

I have 1 more question though, even without semantic highlighting
image

Some of the stuff is orange now, format string was red, number was purple and False was purple

@dgudim
Copy link
Author

dgudim commented Oct 27, 2023

And this is also orange now, was red. Although both variants look bad
image

@jdinhify
Copy link
Owner

I have 1 more question though, even without semantic highlighting image

Some of the stuff is orange now, format string was red, number was purple and False was purple

There a new version published, it should be more aligned with pre-semantic highlighting, please have another try 🙏

@jdinhify
Copy link
Owner

And this is also orange now, was red. Although both variants look bad image

there was never a background set for matchHighlight in peekView
a new version has been published, using gray as background for more neutral highlighting

@dgudim
Copy link
Author

dgudim commented Oct 28, 2023

@jdinhify
It's almost perfect ❤️
I have some suggestions though

  1. Make modules a different shade of yellow, maybe a little darker
  2. Make magic functions/variables different color from regular functions/variables (or maybe italic?)

image

And also, where can I donate?

@alecdwm
Copy link

alecdwm commented Oct 30, 2023

I wasn't a huge fan of the new colours in the v1.16.0 version of Gruvbox for Typescript JSX, so I added two overrides:

"editor.semanticTokenColorCustomizations": {
  "[Gruvbox Dark Medium]": {
    // use the same variable and function colors for semantic syntax highlighting `on` and `off`
    "rules": { "variable": "#83a598", "function": "#fabd2f" }
  }
},
Screenshot 2023-10-31 at 02 38 05

semantic highlighting disabled


Screenshot 2023-10-31 at 02 38 25

semantic highlighting enabled (default colors)


Screenshot 2023-10-31 at 02 38 34

semantic highlighting enabled (with color overrides)

@dgudim
Copy link
Author

dgudim commented Oct 30, 2023

That's not python though

@alecdwm
Copy link

alecdwm commented Oct 30, 2023

Yeah! My comment is only relevant to the new syntax highlighting, not specifically how it affects python.
That being said, the changes should apply to any language.

@jdinhify
Copy link
Owner

thanks @alecdwm

there's a discussion for TS in #85 , let's discuss over there

I found out in the past few days that semantic tokens colouring can be applied to specific languages, and I'm not a python user so I'd respect the input of python users, so will try to make changes to TS (probably the default since I'm using TS too) while not affecting python as requested here

@jdinhify
Copy link
Owner

jdinhify commented Oct 30, 2023

@jdinhify It's almost perfect ❤️ I have some suggestions though

  1. Make modules a different shade of yellow, maybe a little darker
  2. Make magic functions/variables different color from regular functions/variables (or maybe italic?)

image

And also, where can I donate?

thanks @dgudim ,

  1. I'm not familiar with python, what are these "modules"? Could you provide an example snippet
  2. Would you think a darker version of functions would be ok? Variables might be trickier since vscode doesn't have a magicVariable, just builtin so it will affect all builtin variables, but I guess builtin are magic. If we're using a darker version for magic functions, I think we'll probably use a darker version for builtin variables too

@dgudim
Copy link
Author

dgudim commented Oct 31, 2023

@jdinhify
1.
image
Here are the modules
2. I was thinking an italic version with the same color for magic functions and italic purple for magic variables. As for the scope, there is support.variable.magic.python textmate scope, but maybe coloring all builtins would also be fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants