Skip to content

Commit

Permalink
fix!: add treesitter default groups to theme
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 20, 2024
1 parent 66cfdc1 commit bddedb1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 303 deletions.
52 changes: 51 additions & 1 deletion lua/tokyonight/theme.lua
Expand Up @@ -208,7 +208,57 @@ function M.setup()
DapStoppedLine = { bg = util.darken(c.warning, 0.1) }, -- Used for "Warning" diagnostic virtual text

-- These groups are for the Neovim tree-sitter highlights.
-- As of writing, tree-sitter support is a WIP, group names may change.
["@annotation"] = { link = "PreProc" },
["@attribute"] = { link = "PreProc" },
["@boolean"] = { link = "Boolean" },
["@character"] = { link = "Character" },
["@character.special"] = { link = "SpecialChar" },
["@comment"] = { link = "Comment" },
["@conditional"] = { link = "Conditional" },
["@constant"] = { link = "Constant" },
["@constant.builtin"] = { link = "Special" },
["@constant.macro"] = { link = "Define" },
["@debug"] = { link = "Debug" },
["@define"] = { link = "Define" },
["@exception"] = { link = "Exception" },
["@float"] = { link = "Float" },
["@function"] = { link = "Function" },
["@function.builtin"] = { link = "Special" },
["@function.call"] = { link = "@function" },
["@function.macro"] = { link = "Macro" },
["@include"] = { link = "Include" },
["@keyword.coroutine"] = { link = "@keyword" },
["@keyword.operator"] = { link = "@operator" },
["@keyword.return"] = { link = "@keyword" },
["@method"] = { link = "Function" },
["@method.call"] = { link = "@method" },
["@none"] = {},
["@number"] = { link = "Number" },
["@preproc"] = { link = "PreProc" },
["@repeat"] = { link = "Repeat" },
["@storageclass"] = { link = "StorageClass" },
["@string"] = { link = "String" },
["@string.special"] = { link = "SpecialChar" },
["@symbol"] = { link = "Identifier" },
["@tag"] = { link = "Label" },
["@tag.attribute"] = { link = "@property" },
["@tag.delimiter"] = { link = "Delimiter" },
["@text"] = { link = "@none" },
["@text.emphasis"] = { italic = true },
["@text.environment"] = { link = "Macro" },
["@text.environment.name"] = { link = "Type" },
["@text.literal"] = { link = "String" },
["@text.math"] = { link = "Special" },
["@text.note"] = { link = "SpecialComment" },
["@text.strike"] = { strikethrough = true },
["@text.strong"] = { bold = true },
["@text.title"] = { link = "Title" },
["@text.todo"] = { link = "Todo" },
["@text.underline"] = { underline = true },
["@text.uri"] = { link = "Underlined" },
["@type"] = { link = "Type" },
["@type.definition"] = { link = "Typedef" },
["@type.qualifier"] = { link = "@keyword" },

--- Misc
-- TODO:
Expand Down
288 changes: 0 additions & 288 deletions lua/tokyonight/treesitter.lua

This file was deleted.

14 changes: 0 additions & 14 deletions lua/tokyonight/util.lua
@@ -1,5 +1,3 @@
local ts = require("tokyonight.treesitter")

local M = {}

M.bg = "#000000"
Expand Down Expand Up @@ -51,10 +49,6 @@ end

---@param group string
function M.highlight(group, hl)
group = ts.get(group)
if not group then
return
end
if hl.style then
if type(hl.style) == "table" then
hl = vim.tbl_extend("force", hl, hl.style)
Expand Down Expand Up @@ -189,14 +183,6 @@ function M.load(theme)
vim.o.termguicolors = true
vim.g.colors_name = "tokyonight"

if ts.new_style() then
for group, colors in pairs(ts.defaults) do
if not theme.highlights[group] then
M.highlight(group, colors)
end
end
end

M.syntax(theme.highlights)

-- vim.api.nvim_set_hl_ns(M.ns)
Expand Down

0 comments on commit bddedb1

Please sign in to comment.