gruvbox-community / gruvbox

Retro groove color scheme for Vim - community maintained edition
MIT License
801 stars 62 forks source link

gruvbox 3.0.0 removes most Python highlighting when used with nvim-treesitter #191

Closed rouge8 closed 12 months ago

rouge8 commented 12 months ago

Summary

I updated from 2b5b1f777f0583ffb39086d6c16f39e6e37459c0 to e8b59655db4323ee3b7bfd2714e47760dcb84406 this morning and most of the Python highlighting was gone.

Given this file:

import enum
from typing import assert_never

class MyEnum(enum.Enum):
    a = "a"
    b = "b"

    @property
    def something(self) -> int:
        match self:
            case self.a:
                return 1
            case self.b:
                return 2
            case _:
                assert_never(self)

Here's what it looked like before:

before

Here's what it looks like after updating:

after

vim version

❯ nvim --version
NVIM v0.9.2
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.2/share/nvim"

Run :checkhealth for more info

Terminal

kitty 0.29.2 created by Kovid Goyal

vimrc

call plug#begin(stdpath('data') . '/plugged')

Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'gruvbox-community/gruvbox'

call plug#end()

lua <<EOF
require("nvim-treesitter.configs").setup({
    ensure_installed = {
        "python",
    },
    ignore_install = {},
    highlight = {
        enable = true,
        disable = {},
        additional_vim_regex_highlighting = false,
    },
})
EOF

set background=dark
colorscheme gruvbox

This won't exactly match the screenshots (no line numbers for example) but it is enough to reproduce the highlighting changes.

rbong commented 12 months ago

Normal variables are now white. This is consistent with many of the previous language appearances. If you'd like to change this, you can change @variable:

autocmd ColorScheme gruvbox hi! link @variable GruvboxBlue

If you'd like to know the group under the cursor so you can replace it, use :Inspect.

enum, typing, and assert_never are simply linked to @variable and can't be distinguished from normal variables, this is a TreeSitter parser problem.

@property should have distinguished highlighting when you pull changes. However, the group for @ in @property is overwritten by the property group. Not sure if this is a TreeSitter or parser problem.

self is a builtin in Python, this should now be distinguished on pull.

Here's how it looks now:

2023-09-12-131604_382x351_scrot

rouge8 commented 12 months ago

Normal variables are now white. This is consistent with many of the previous language appearances

Oh interesting. I guess I mostly used Python and Rust where variables were both blue before.

Thanks for the quick fixes in https://github.com/gruvbox-community/gruvbox/commit/bb38ea8b58994282890357a2a8f5712e15ae5f3f, that's a big improvement! For the rest I'll just have to retrain my eyes/brain

rbong commented 11 months ago

There have been some more tweaks to highlight groups, you might want to pull to make sure you're still happy with it and any customizations you made still look good, see this comment.