Skip to content

Commit

Permalink
fix: check if neovim is nightly to load advanced hl
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmx03 committed Mar 27, 2023
1 parent 7965990 commit 0963ad8
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions lua/solarized/colorscheme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,25 @@ function Colorscheme:apply_semantic_hl()
end,
})

vim.api.nvim_create_autocmd('LspTokenUpdate', {
callback = function(args)
local token = args.data.token
if vim.fn.has 'nvim-0.9.0' == 1 then
vim.api.nvim_create_autocmd('LspTokenUpdate', {
callback = function(args)
local token = args.data.token

if token.type ~= 'variable' or token.modifiers.readonly then
return
end
if token.type ~= 'variable' or token.modifiers.readonly then
return
end

local text = vim.api.nvim_buf_get_text(args.buf, token.line, token.start_col, token.line, token.end_col, {})[1]
local text = vim.api.nvim_buf_get_text(args.buf, token.line, token.start_col, token.line, token.end_col, {})[1]

if text ~= string.upper(text) then
return
end
if text ~= string.upper(text) then
return
end

vim.lsp.semantic_tokens.highlight_token(token, args.buf, args.data.client_id, '@constant')
end,
})
vim.lsp.semantic_tokens.highlight_token(token, args.buf, args.data.client_id, '@constant')
end,
})
end
end

function Colorscheme:setup(t)
Expand All @@ -149,7 +151,7 @@ function Colorscheme:setup(t)

self:apply_colorscheme_highlights()

if self.config.theme ~= 'vim' and vim.fn.has('nvim-0.8.3') then
if self.config.theme ~= 'vim' then
self:apply_semantic_hl()
end
end
Expand Down

0 comments on commit 0963ad8

Please sign in to comment.