Closed CharlieCheckpt closed 1 year ago
Possibly Tree-sitter, but most likely LSP semantic highlights.
Could you please share the output(s) of :Inspect
while hovering both symbols?
Thank you for reply.
my_var
: @variable.python links to Fg python
Myvar
: @variable.python links to Fg python, @type.python links to BlueItalic python
Actually, after disabling the highlight of treesitter, the two variables have the same color. But then in general the theme looks less nice
In Python uppercase names are often used for classes, so I assume that Tree-sitter treats all uppercase variables as types.
Using a LSP server with semantic highlights should fix that. It works in combination with Tree-sitter but provides more accurate context.
Otherwise, you can override the highlight for Python types in your init.lua
file, with the side effect that actual Python types will be highlighted like variables:
-- Apply custom highlights on colorscheme change.
-- Must be declared before executing ':colorscheme'.
local grpid = vim.api.nvim_create_augroup('custom_highlights_sonokai', {})
vim.api.nvim_create_autocmd('ColorScheme', {
group = grpid,
pattern = 'sonokai',
callback = function()
local config = vim.fn['sonokai#get_configuration']()
local palette = vim.fn['sonokai#get_palette'](config.style, config.colors_override)
local set_hl = vim.fn['sonokai#highlight']
set_hl('@type.python', palette.fg, palette.none)
end
})
Very clear, thank you !
Hello,
Thank you for this very nice color theme.
In python, variables starting with an uppercase letter have a different color, which I found quite misleading :
I'd like
myvar
andMyvar
to both be white.I don't know if this is a bug or an intended behaviour, or even if it has to do with
sonokai
(treesitter
maybe ?). Do you know what causes this difference of color, and if there is any way to fix it in sonokai?Thanks !