mhartington / oceanic-next

Oceanic Next theme for neovim
Other
1.13k stars 141 forks source link

Wrong colors on ruby with treesitter #105

Closed dansdantas closed 1 year ago

dansdantas commented 3 years ago

Warning: I will close the issue without the minimal vimrc and the reproduce ways.

Problems summary

Colors on ruby files does not match what is expected, but on javascript it's the opposite.

Expected

Correct colors on both javascript and ruby files

Environment Information

Provide a minimal vim rc with less than 50 lines (Required!)

call plug#begin('~/.config/nvim/plugged')
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}

Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-rails'

Plug 'mhartington/oceanic-next'
call plug#end()

lua << EOF
require('nvim-treesitter.configs').setup({
  ensure_installed = "maintained",
  highlight = {
    enable = true,
  },
})
EOF

set termguicolors
set background=dark
syntax enable
colorscheme OceanicNext

The reproduce ways from neovim starting

  1. Open ruby file
  2. Open javascript file
  3. Open new terminal
  4. Remove line loading treesitter config
  5. Load new neovim instance
  6. Open ruby file
  7. Open javascript file

Screen shot (if possible)

Without treesitter

Ruby: image

Javascript(vue): image

With treesitter

Ruby: image

Javascript(vue): image

dansdantas commented 3 years ago

I did a couple of changes on which color should be used for each class on treesitter and now looks almost like on sublime and vscode. At least on javascript.

(neo)vim: image

sublime: image

vscode: image

At least compared to the last print, it looks way better, what do you think?

dansdantas commented 3 years ago

Patch if someone is interested.

diff --git a/colors/OceanicNext.vim b/colors/OceanicNext.vim
index 8b2cf41..d2e69be 100644
--- a/colors/OceanicNext.vim
+++ b/colors/OceanicNext.vim
@@ -128,12 +128,12 @@ endfunction
   call s:hi('Function',                           s:blue,   '',       '',          '')

   call s:hi('Identifier',                         s:cyan,   '',       '',          '')
-  call s:hi('Include',                            s:blue,   '',       '',          '')
+  call s:hi('Include',                            s:purple, '',       '',          '')
   call s:hi('Keyword',                            s:purple, '',       '',          '')

   call s:hi('Label',                              s:yellow, '',       '',          '')
   call s:hi('Number',                             s:orange, '',       '',          '')
-  call s:hi('Operator',                           s:base05, '',       '',          '')
+  call s:hi('Operator',                           s:orange, '',       '',          '')
   call s:hi('PreProc',                            s:yellow, '',       '',          '')
   call s:hi('Repeat',                             s:yellow, '',       '',          '')
   call s:hi('Special',                            s:cyan,   '',       '',          '')
@@ -166,26 +166,32 @@ endfunction

   " TreeSitter stuff
-  call s:hi('TSInclude',                          s:cyan,   '',       '',          '')
+  call s:hi('TSInclude',                          s:purple, '',       '',          '')
   call s:hi('TSPunctBracket',                     s:cyan,   '',       '',          '')
-  call s:hi('TSPunctDelimiter',                   s:base07, '',       '',          '')
+  call s:hi('TSPunctDelimiter',                   s:cyan,   '',       '',          '')
+  call s:hi('TSPunctSpecial',                     s:cyan,   '',       '',          '')
   call s:hi('TSParameter',                        s:base07, '',       '',          '')
-  call s:hi('TSType',                             s:blue,   '',       '',          '')
-  call s:hi('TSFunction',                         s:cyan,   '',       '',          '')
+  call s:hi('TSType',                             s:yellow, '',       '',          '')
+  call s:hi('TSFunction',                         s:blue,   '',       '',          '')

   call s:hi('TSTagDelimiter',                     s:cyan,   '',       '',          '')
-  call s:hi('TSProperty',                         s:yellow, '',       '',          '')
+  call s:hi('TSProperty',                         s:base07, '',       '',          '')
   call s:hi('TSMethod',                           s:blue,   '',       '',          '')
   call s:hi('TSParameter',                        s:yellow, '',       '',          '')
   call s:hi('TSConstructor',                      s:base07, '',       '',          '')
-  call s:hi('TSVariable',                         s:base07, '',       '',          '')
-  call s:hi('TSOperator',                         s:base07, '',       '',          '')
+  call s:hi('TSVariable',                         s:base06, '',       '',          '')
+  call s:hi('TSOperator',                         s:orange, '',       '',          '')
   call s:hi('TSTag',                              s:base07, '',       '',          '')
   call s:hi('TSKeyword',                          s:purple, '',       '',          '')
   call s:hi('TSKeywordOperator',                  s:purple, '',       '',          '')
   call s:hi('TSVariableBuiltin',                  s:red,    '',       '',          '')
   call s:hi('TSLabel',                            s:cyan,   '',       '',          '')

+  call s:hi('TSConditional',                      s:purple, '',       '',          '')
+  call s:hi('TSNamespace',                        s:base07, '',       '',          '')
+  call s:hi('TSSymbol',                           s:green,  '',       '',          '')
+  call s:hi('TSException',                        s:red,    '',       '',          '')
+
   call s:hi('SpellBad',                           '',       '',       'undercurl', '')
   call s:hi('SpellLocal',                         '',       '',       'undercurl', '')
   call s:hi('SpellCap',                           '',       '',       'undercurl', '')