sainnhe / sonokai

High Contrast & Vivid Color Scheme based on Monokai Pro
MIT License
1.65k stars 119 forks source link

Installed nvim-treesitter, but after installing printf, the C file is not highlighted #101

Closed IC0hO closed 3 months ago

IC0hO commented 3 months ago

image nvim-treesitter I installed the two parsers, C and printf. After printf is installed, the parameters should be highlighted, but this color scheme does not.

Here is another color scheme: image

antoineco commented 3 months ago

That's probably because these two tokens have the same color in Sonokai (yellow). I agree that we should optimize this in C/C++ files.

Could you please:

  1. Move your cursor over the word "Enter" inside the call to printf(), then call the Neovim command :Inspect and post the output?
  2. Then do the same with your cursor over "%d".
IC0hO commented 3 months ago

1.image 2.image The above are the outputs of 1 and 2 respectively

IC0hO commented 3 months ago

Also, is it better to use white for brackets, commas, and semicolons in C/C++ files? They were originally white, but after using treesitter they became gray.

antoineco commented 3 months ago

This is now fixed on master. Thanks for reporting!

Screenshot 2024-06-25 110615

antoineco commented 3 months ago

Also, is it better to use white for brackets, commas, and semicolons in C/C++ files? They were originally white, but after using treesitter they became gray.

The Tree-sitter style (grey) is the intended one. Unfortunately, we cannot achieve the same result in the Vim syntax because the built-in c syntax defines cParen, cBracket and cBlock as regions, not as matches. Those regions are used to pinpoint imbalances between opening/blosing brackets, but cannot be used out of the box for highlighting punctuation.

For more context about why sainnhe made different design choices between the Vim and Tree-sitter syntaxes, please refer to https://github.com/sainnhe/everforest/issues/128.

IC0hO commented 3 months ago

Ok no problem, thank you for solving this issue.