sainnhe / gruvbox-material

Gruvbox with Material Palette
MIT License
1.83k stars 164 forks source link

gruvbox_material_better_performance breaks highlight for markdown <http://link> with treesitter #184

Closed misaflo closed 2 months ago

misaflo commented 11 months ago

I have done the following steps before reporting this issue:

Operating system/version

Arch Linux

Terminal emulator/version

alacritty 0.12.2

$TERM environment variable

alacritty

Tmux version

No response

Feature matrix

==============================================================================
lazy: require("lazy.health").check()

lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found

==============================================================================
nvim: require("nvim.health").check()

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: /usr/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- OK Up to date

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=\177`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $COLORTERM="truecolor"

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v20.5.1 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 13.2.1 20230801
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.4.12-arch1-1",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Thu, 24 Aug 2023 00:38:14 +0000"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - comment             ✓ . . . .
  - css                 ✓ . ✓ ✓ ✓
  - git_config          ✓ . . . .
  - git_rebase          ✓ . . . ✓
  - gitattributes       ✓ . . . ✓
  - gitcommit           ✓ . . . ✓
  - gitignore           ✓ . . . .
  - json                ✓ ✓ ✓ ✓ .
  - jsonc               ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - puppet              ✓ ✓ ✓ ✓ ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - ruby                ✓ ✓ ✓ ✓ ✓
  - toml                ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - yaml                ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: wl-copy

Python 3 provider (optional) ~
- `g:python3_host_prog` is not set.  Searching for python3 in the environment.
- Executable: /usr/bin/python3
- Python version: 3.11.3
- pynvim version: 0.4.3
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- Ruby: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
- WARNING `neovim-ruby-host` not found.
  - ADVICE:
    - Run `gem install neovim` to ensure the neovim RubyGem is installed.
    - Run `gem environment` to ensure the gem bin directory is in $PATH.
    - If you are using rvm/rbenv/chruby, try "rehashing".
    - See :help |g:ruby_host_prog| for non-standard gem installations.
    - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim

Node.js provider (optional) ~
- Node.js: v20.5.1
- WARNING Missing "neovim" npm (or yarn, pnpm) package.
  - ADVICE:
    - Run in shell: npm install -g neovim
    - Run in shell (if you use yarn): yarn global add neovim
    - Run in shell (if you use pnpm): pnpm install -g neovim
    - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /home/florent/.local/state/nvim/lsp.log
- Log size: 9624 KB

vim.lsp: Active Clients ~
- No active clients

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: bash       ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/bash.so
- OK Parser: comment    ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/comment.so
- OK Parser: css        ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/css.so
- OK Parser: git_config ABI: 13, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/git_config.so
- OK Parser: git_rebase ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/git_rebase.so
- OK Parser: gitattributes ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/gitattributes.so
- OK Parser: gitcommit  ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/gitcommit.so
- OK Parser: gitignore  ABI: 13, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/gitignore.so
- OK Parser: json       ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/json.so
- OK Parser: jsonc      ABI: 13, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/jsonc.so
- OK Parser: lua        ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/lua.so
- OK Parser: markdown   ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/markdown_inline.so
- OK Parser: puppet     ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/puppet.so
- OK Parser: python     ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/python.so
- OK Parser: ruby       ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/ruby.so
- OK Parser: toml       ABI: 13, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/toml.so
- OK Parser: vim        ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/vimdoc.so
- OK Parser: yaml       ABI: 13, path: /home/florent/.local/share/nvim/lazy/nvim-treesitter/parser/yaml.so

Minimal vimrc that can reproduce this bug.

local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable', -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  -- Color scheme
  {
    'sainnhe/gruvbox-material',
    lazy = false,
    priority = 1000,
    config = function()
      vim.g.gruvbox_material_better_performance = true
      vim.cmd 'colorscheme gruvbox-material'
    end,
  },

  {
    'nvim-treesitter/nvim-treesitter',
    build = ':TSUpdate',
    config = function()
      require('nvim-treesitter.configs').setup {
        ensure_installed = { 'markdown', 'markdown_inline' },
        highlight = {
          enable = true,
        },
      }
    end,
  },
 })

Steps to reproduce this bug using minimal vimrc

Open a Markdown file with a .

Expected behavior

should be highlighted. It works without gruvbox_material_better_performance. ### Actual behavior is not highlighted.
antoineco commented 11 months ago

Thanks for the detailed issue report!

If I'm not mistaken, lazy.nvim does not support runtimepath:

There is however a workaround suggested in that same issue (in the comment right below the one I linked), with a combination of init and config, and I remember it working for some syntax related issue. Could you please try that and report? If it works, I'm going to document the workaround in gruvbox-material, since lazy.nvim is very popular.

misaflo commented 11 months ago

Thanks, I try this:

  {
    'sainnhe/gruvbox-material',
    lazy = false,
    priority = 1000,
    config = function(plugin)
      vim.opt.rtp:append(plugin.dir .. '/after/syntax')
      require('lazy.core.loader').packadd(plugin.dir .. '/after/syntax')
      vim.g.gruvbox_material_better_performance = true
      vim.cmd 'colorscheme gruvbox-material'
    end,
    init = function(plugin)
      require('lazy.core.loader').ftdetect(plugin.dir .. '/after/syntax')
    end,
  },

But that changes nothing.

antoineco commented 2 months ago

This was fixed in commit 0322d59d7cafdeeef57b828b56a4649bb5fe5847