r-lib / tree-sitter-r

MIT License
115 stars 35 forks source link

Nvim-Treesitter colors for R script not showing #11

Closed ECon87 closed 3 years ago

ECon87 commented 3 years ago

Describe the bug

When in normal mode, the color highlighting is not showing in R scripts (i.e., filetype=r) for the sonokai and gruvbox-material color-schemes. However, I can see the color highlighting when I am in visual mode (see pictures below). Other color-schemes work fine with R and nvim-treesitter. The maintainer of sonokai and gruvbox-material twas able to replicate but thinks is an nvim-treesitter issue.

Finally, highlighting works fine for R with other color-schemes. So, I am not really sure what the source of the bug is. But the issue occurs both with neovim-nightly v0.6 and neovim v0.5.

To Reproduce

``` filetype off call plug#begin('~/.vim/plugged') Plug 'sainnhe/sonokai' Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update Plug 'nvim-treesitter/playground' Plug 'jalvesaq/Nvim-R', {'brach': 'stable', 'for': ['R', 'r']} call plug#end() filetype plugin indent on if has('termguicolors') set termguicolors endif let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" let &t_ZH="\e[3m" let &t_ZR="\e[23m" set background=dark let g:sonokai_style = 'atlantis' let g:sonokai_enable_italic = 1 let g:sonokai_disable_italic_comment = 1 colorscheme sonokai lua <

Output of :checkhealth nvim_treesitter

``` health#nvim_treesitter#check ======================================================================== ## Installation - OK: `tree-sitter` found 0.20.0 (parser generator, only needed for :TSInstallFromGrammar) - OK: `node` found v16.4.2 (only needed for :TSInstallFromGrammar) - OK: `git` executable found. - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl" } - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI. ## Parser/Features H L F I J - python ✓ ✓ ✓ ✓ ✓ - r ✓ ✓ . . . - query ✓ ✓ ✓ ✓ ✓ - c ✓ ✓ ✓ ✓ ✓ 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} ```

Output of nvim --version

``` NVIM v0.5.0 Build type: Release LuaJIT 2.0.5 Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim/src/neovim-0.5.0/build/config -I/build/neovim/src/neovim-0.5.0/src -I/usr/include -I/build/neovim/src/neovim-0.5.0/build/src/nvim/auto -I/build/neovim/src/neovim-0.5.0/build/include Compiled by builduser Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim" Run :checkhealth for more info ```

What I see in normal mode:

treesitter_0

What I see in visual mode:

treesitter_1

EDIT 1: The bug is present with Oceanic-next (tree-sitter compatable theme) as well. So it might have something to do with the r-module.

EDIT 2: Just to clarify the color-schemes that work in R are gruvbox, zenburn, and others that I think might not have explicit tree-sitter support.

EDIT 3: Somehow I get partial highlighting in some files now (this is the oceanic theme):

treesitter_3

ECon87 commented 3 years ago