ianyepan / vscode-dark-plus-emacs-theme

An accurate port of the default Visual Studio Code Dark+ theme for Emacs
GNU General Public License v3.0
174 stars 17 forks source link

Colors are not consistent with the vscode dark+ color scheme for Python #12

Closed AMER12-max closed 3 years ago

AMER12-max commented 3 years ago

Hi, I just want to say that I love this colorscheme and it is the closest version I could find to vscode's dark+ colorscheme.

I found some minor mistakes with the syntax highlighting when it comes to Python.

This is the way which super() is colored in your version of vscode's dark+:

image

This is the way which super() is colored in vscode:

image

This is the way the function hasattr() is colored in your version of vscode's dark+:

image

This is the way the function hasattr() is colored in vscode:

image

This is the way parameters are colored in your version of vscode's dark+:

image

This is the way parameters are colored in vscode:

image

ianyepan commented 3 years ago

Thanks for opening the issue. This very problem has also come to my attention while I was creating this theme.

Unfortunately, this is due to the fundamental differences in how Emacs and Visual Studio Code parse code syntax and apply the colors. For instance, both super() and hasattr() are simply interpreted as function calls in Emacs. Whereas in VSCode, the editor has the ability to give super(), __init__() and hasattr() 3 different colors because it understands their significance within context. Microsoft has put in quite some work to perfect the syntax highlighting sophistication and experience for VScode, which frankly, Emacs just doesn't have. (Although sometimes Emacs seems to have the upper hand, for example, it recognizes self as a legit keyword). On top of that, Emacs sometimes have inconsistencies of keyword colorings between different languages that are sadly not solvable at a theme-level.

That said, I've tried my best to look at different languages and pick the right color for "the most" use cases for each keyword. I do hope you continue to enjoy using this theme!

AMER12-max commented 3 years ago

Thanks for answering. I guess you tried your best since this is limitation with emacs itself. I guess we can close the issue now.

ianyepan commented 3 years ago

@AMER12-max Traditionally Emacs uses regex for syntax parsing and highlighting (which is rather primitive). If you want a more modern and intelligent, you might wanna look into tree-sitter (it's quite amazing for syntax highlighting at least): https://ubolonton.github.io/emacs-tree-sitter/syntax-highlighting/