ellisonleao / gruvbox.nvim

Lua port of the most famous vim colorscheme
MIT License
1.96k stars 210 forks source link

Treesitter highlighting doesn't seem to work #170

Closed JwanKhalaf closed 1 year ago

JwanKhalaf commented 2 years ago

Describe the bug

Here is what I am currently getting when opening an AWS CDK (Go) file:

image

To Reproduce

My config is here.

Expected behavior

With Treesitter, I expect good highlighting like I get in GoLand.

image

I don't mean the colours should match, I mean the bits that are highlighted should be roughly the same so that the code is easier to digest.

ellisonleao commented 2 years ago

Are you using latest stable version of Neovim?

JwanKhalaf commented 2 years ago

I'm using:

image

ellisonleao commented 2 years ago

Weird, I am on the latest stable version (with also the latest tree-sitter-go installed) and I can't reproduce it. Here's what it looks like here:

image

JwanKhalaf commented 2 years ago

hmm, can you try with AWS CDK code please?

cdk init app --language go          

And then open the file containing the Stack code and send a screenshot?

Yours is looking so much nicer!

JwanKhalaf commented 2 years ago

By the way, all I have in terms of settings is:

vim.o.background = "dark"
command[[colorscheme gruvbox]]

Am I supposed to have this too?

image

I assumed not, cause it states "Additional", meaning they're not mandatory!

ellisonleao commented 2 years ago

@JwanKhalaf you are correct, there is no need to call the setup command unless you want to override some configs. Can you paste that go code in a text format so I can test on my side?

JwanKhalaf commented 2 years ago

Here is the CDK code: https://gist.github.com/JwanKhalaf/5a3a5549feb5e88177447bb79bcb7364

bamonroe commented 2 years ago

I think I'm having a similar problem. I can't see many of the highlight groups defined here when I use the hl command in nvim. In particular, for latex documents, the argument of \textit{arg} belongs to the highlight group "@text.emphasis", which should have the italic property. I can see this properly defined in the groups.lua file, but it just doesn't make its way into any file for me. If I manually type lua vim.api.nvim_set_hl(0, "@text.emphasis", {italic = true}), I get the correct italics, so I don't think there is something particularly wrong with my setup.

What's more, I added a "vim.pretty_print('hello')" to this line, and removed colorscheme gruvbox from my init.lua. So now when I start nvim, I have the default colorscheme, but when I type colorscheme gruvbox I figure I should see hello in the messages, but I don't. So it looks to me like something isn't loading correctly. Happy to troubleshoot if it helps, I really enjoy the colorscheme.

Edit: Also @text.environment and @text.environment.name, although defined in the groups configuration, don't get applied in the buffer. If I set them manually, they show

ellisonleao commented 2 years ago

On my side i have the highlights:

image

JwanKhalaf commented 2 years ago

Man I am so jealous right now, I do not get that.

When you have that code open, if you run :LspInfo what do you see? I get:

image

ellisonleao commented 2 years ago

same thing. For the sake of removing extra possibilities I would try to test this code in the stable version and check if the issue remains

LucasTavaresA commented 2 years ago

print_30_14:26

i also have something similar, you can test with diff file1 file2 | nvim, it goes normal when i disable treesitter highlighting

JwanKhalaf commented 2 years ago

I went ahead and installed the stable release, and it still doesn't work :(

All my config is on GitHub.

image

bamonroe commented 2 years ago

Just to add here: I made a fake root environment on Arch with nothing but the base packages, neovim, and git, and set neovim up with a bare init.lua that only included the code for packer and for packer to install nvim-tree-sitter and gruvbox. In this chroot environment, I don't get the highlighting issue I point out above. This leads me to believe there is some plugin interfering with gruvbox somehow.

JwanKhalaf commented 2 years ago

Very good way to test things out! Nice one @bamonroe. If you do figure out what plugin is the cause, please let me know.

I'll also do some experiments from my end. Right now, I have the following plugins:

return require('packer').startup(function(use)
  -- allow packer (the plugin manager) to manage itself
  use 'wbthomason/packer.nvim'

  use 'ellisonleao/gruvbox.nvim'
  use 'itchyny/lightline.vim'
  use 'frazrepo/vim-rainbow'
  use 'nvim-lua/popup.nvim'
  use 'nvim-lua/plenary.nvim'
  use 'nvim-telescope/telescope.nvim'
  use 'nvim-telescope/telescope-fzy-native.nvim'
  use 'prettier/vim-prettier'
  use 'tpope/vim-surround'
  use 'tpope/vim-commentary'
  use 'christoomey/vim-system-copy'
  use 'mattn/emmet-vim'
  use 'neovim/nvim-lspconfig'
  use 'kyazdani42/nvim-web-devicons'
  use 'nvim-treesitter/nvim-treesitter'
  use 'hrsh7th/cmp-nvim-lua'
  use 'hrsh7th/cmp-nvim-lsp'
  use 'hrsh7th/cmp-buffer'
  use 'hrsh7th/cmp-path'
  use 'hrsh7th/cmp-cmdline'
  use 'hrsh7th/nvim-cmp'
  use 'L3MON4D3/LuaSnip'
  use 'saadparwaiz1/cmp_luasnip'
end)
bamonroe commented 1 year ago

@JwanKhalaf I found that removing all the other color-schemes from my plugin config fixed the issue for me. Unfortunately I think you're best bet is to disable your plugins one at a time and see if it resolves the issue. Of the plugins you list above, I also use the following, so they seem unlikely to be the problem:

  use 'wbthomason/packer.nvim'
  use 'ellisonleao/gruvbox.nvim'
  use 'nvim-lua/plenary.nvim'
  use 'nvim-telescope/telescope.nvim'
  use 'tpope/vim-surround'
  use 'neovim/nvim-lspconfig'
  use 'kyazdani42/nvim-web-devicons'
  use 'nvim-treesitter/nvim-treesitter'
  use 'hrsh7th/cmp-nvim-lua'
  use 'hrsh7th/cmp-nvim-lsp'
  use 'hrsh7th/cmp-buffer'
  use 'hrsh7th/cmp-path'
  use 'hrsh7th/cmp-cmdline'
  use 'hrsh7th/nvim-cmp'
  use 'L3MON4D3/LuaSnip'
  use 'saadparwaiz1/cmp_luasnip'
ellisonleao commented 1 year ago

Yep, will close this since it's not likely to be an issue with the plugin