New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
treesitter overrides not working after nvim breaking changes #79
Comments
So I've just tested this with the following: # Ruby file
def this_is_a_test
message = "Testing Treesitter"
puts message
end and with and when I edit my onedarkpro config to: highlights = {
TSVariable = { bg = "${green}" },
variable = { bg = "${red}"},
rubyvariable = { bg = "${purple}"},
} I see: Which suggests that This is the challenge with nightly, there's always so many moving parts and things break all the time. Whilst I can't see the same as you it may be the difference in when I update nightly. |
Can you try reproducing the following? Start with this minimal.lua file: local fn = vim.fn
-- Ignore default config and plugins and define new dirs
local test_dir = '/tmp/nvim-minimal'
vim.opt.runtimepath:remove(fn.expand('~/.config/nvim'))
vim.opt.packpath:remove(fn.expand('~/.local/share/nvim/site'))
vim.opt.runtimepath:append(fn.expand(test_dir))
vim.opt.packpath:append(fn.expand(test_dir))
-- Install packer
local install_path = test_dir .. '/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({
'git',
'clone',
'--depth',
'1',
'https://github.com/wbthomason/packer.nvim',
install_path,
})
vim.cmd([[packadd packer.nvim]])
end
-- Setup packer
local packer = require('packer')
packer.init({
package_root = test_dir .. '/pack',
compile_path = test_dir .. '/plugin/packer_compiled.lua',
})
packer.startup(function(use)
-- Packer can manage itself
use('wbthomason/packer.nvim')
-- Plugins
use({
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
requires = { 'nvim-treesitter/playground' },
})
use({ 'olimorris/onedarkpro.nvim' })
-- Auto install plugins
if packer_bootstrap then
packer.sync()
end
end)
-- Plugin setup
local ok, treesitter = pcall(require, 'nvim-treesitter.configs')
if ok then
treesitter.setup({
highlight = {
enable = true,
},
ensure_installed = { 'python' },
})
end
local ok, onedarkpro = pcall(require, 'onedarkpro')
if ok then
local p = {
dark_red = '#be5046',
}
onedarkpro.setup({
theme = 'onedark',
colors = p,
ft_highlights = {
python = {
pythonTSConstant = { fg = p.dark_red }, -- Doesn't work (used to)
-- TSConstant = { fg = p.dark_red }, -- works but is not filetype specific
},
},
})
onedarkpro.load()
end Then, as in the GIF,
A_CONSTANT = 'foo'
So my point is that under neovim master I believe the |
I think we're aligned on this. As shown with the Do you not just need to redefine how you're applying your own custom highlights as a result of the changes in Neovim? Reference: Treesitter highlight groups Edit: And apologies if I am grossly misunderstanding this problem |
No need for an apology and thanks for the patience.
That's a fair question (I don't have a concrete anwser). From what I can surmise of this neovim/neovim#14090 (comment) I believe onedarkpro is lacking two things:
|
One extra comment. If I run something like:
Then I can effectively access the |
Okay very interesting. And I guess you can't set that in the I will definitely look into this as it's a potentially awesome way to replace filetype highlights. |
Exactly. For instance while something like the following works:
it cannot be added to the
Awesome! Thanks once again and sorry for all the back and forth. |
Indeed something like petobens/dotfiles@e460ac8 fixes both this issue and #67 |
@petobens - I've just tried: highlights = {
["@variable.ruby"] = { bg = "${purple}" },
} and I get: |
Oh neat. I guess that's the way to go. Feel free to close this issue and the other #67 if you deem fit. |
I'll close this but leave #67 for now. After you've discovered this then I'm not sure what will happen with filetype highlights as this is a game changer. |
Consider the following minimal.lua file:
Now, as in the GIF, do
~/Desktop/foo.md
#
symbol is not highlighted in redTSHighlightCapturesUnderCursor
(the reported highlight group is no longermarkdownTSPunctuationSpecial
)I guess that after neovim/neovim#19931 there are some breaking changes to treesitter highlights (as stated in neovim/neovim#14090 (comment))
Also relevant: nvim-treesitter/playground#90
The text was updated successfully, but these errors were encountered: