From d1025023b00c6563823dbb5b77951d7b5e9a1a31 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 25 Oct 2023 09:02:54 +0200 Subject: [PATCH] refactor: symbol/completion kinds are now the same accross all plugins --- lua/tokyonight/theme.lua | 152 +++++++++++++-------------------------- 1 file changed, 48 insertions(+), 104 deletions(-) diff --git a/lua/tokyonight/theme.lua b/lua/tokyonight/theme.lua index d00c6e2..238b9d2 100644 --- a/lua/tokyonight/theme.lua +++ b/lua/tokyonight/theme.lua @@ -589,93 +589,17 @@ function M.setup() CmpItemKindDefault = { fg = c.fg_dark, bg = c.none }, - CmpItemKindClass = { fg = c.orange, bg = c.none }, CmpItemKindCodeium = { fg = c.teal, bg = c.none }, - CmpItemKindConstant = { fg = c.magenta, bg = c.none }, - CmpItemKindConstructor = { fg = c.blue, bg = c.none }, CmpItemKindCopilot = { fg = c.teal, bg = c.none }, - CmpItemKindEnum = { fg = c.orange, bg = c.none }, - CmpItemKindEnumMember = { fg = c.green1, bg = c.none }, - CmpItemKindEvent = { fg = c.orange, bg = c.none }, - CmpItemKindField = { fg = c.green1, bg = c.none }, - CmpItemKindFunction = { fg = c.blue, bg = c.none }, - CmpItemKindInterface = { fg = c.orange, bg = c.none }, - CmpItemKindKeyword = { fg = c.cyan, bg = c.none }, - CmpItemKindMethod = { fg = c.blue, bg = c.none }, - CmpItemKindModule = { fg = c.yellow, bg = c.none }, - CmpItemKindOperator = { fg = c.green1, bg = c.none }, - CmpItemKindPackage = { fg = c.yellow, bg = c.none }, - CmpItemKindProperty = { fg = c.green1, bg = c.none }, - CmpItemKindReference = { fg = c.magenta, bg = c.none }, - CmpItemKindSnippet = { fg = c.dark5, bg = c.none }, - CmpItemKindStruct = { fg = c.orange, bg = c.none }, CmpItemKindTabNine = { fg = c.teal, bg = c.none }, - CmpItemKindTypeParameter = { fg = c.green1, bg = c.none }, - CmpItemKindUnit = { fg = c.orange, bg = c.none }, - CmpItemKindValue = { fg = c.magenta, bg = c.none }, - CmpItemKindVariable = { fg = c.magenta, bg = c.none }, -- headlines.nvim CodeBlock = { bg = c.bg_dark }, -- navic - NavicIconsFile = { fg = c.fg, bg = c.none }, - NavicIconsModule = { fg = c.yellow, bg = c.none }, - NavicIconsNamespace = { fg = c.fg, bg = c.none }, - NavicIconsPackage = { fg = c.fg, bg = c.none }, - NavicIconsClass = { fg = c.orange, bg = c.none }, - NavicIconsMethod = { fg = c.blue, bg = c.none }, - NavicIconsProperty = { fg = c.green1, bg = c.none }, - NavicIconsField = { fg = c.green1, bg = c.none }, - NavicIconsConstructor = { fg = c.orange, bg = c.none }, - NavicIconsEnum = { fg = c.orange, bg = c.none }, - NavicIconsInterface = { fg = c.orange, bg = c.none }, - NavicIconsFunction = { fg = c.blue, bg = c.none }, - NavicIconsVariable = { fg = c.magenta, bg = c.none }, - NavicIconsConstant = { fg = c.magenta, bg = c.none }, - NavicIconsString = { fg = c.green, bg = c.none }, - NavicIconsNumber = { fg = c.orange, bg = c.none }, - NavicIconsBoolean = { fg = c.orange, bg = c.none }, - NavicIconsArray = { fg = c.orange, bg = c.none }, - NavicIconsObject = { fg = c.orange, bg = c.none }, - NavicIconsKey = { fg = c.purple, bg = c.none }, - NavicIconsKeyword = { fg = c.purple, bg = c.none }, - NavicIconsNull = { fg = c.orange, bg = c.none }, - NavicIconsEnumMember = { fg = c.green1, bg = c.none }, - NavicIconsStruct = { fg = c.orange, bg = c.none }, - NavicIconsEvent = { fg = c.orange, bg = c.none }, - NavicIconsOperator = { fg = c.fg, bg = c.none }, - NavicIconsTypeParameter = { fg = c.green1, bg = c.none }, - NavicText = { fg = c.fg, bg = c.none }, NavicSeparator = { fg = c.fg, bg = c.none }, + NavicText = { fg = c.fg, bg = c.none }, - AerialArrayIcon = { fg = c.orange, bg = c.none }, - AerialBooleanIcon = { fg = c.orange, bg = c.none }, - AerialClassIcon = { fg = c.orange, bg = c.none }, - AerialConstantIcon = { fg = c.magenta, bg = c.none }, - AerialConstructorIcon = { fg = c.orange, bg = c.none }, - AerialEnumIcon = { fg = c.orange, bg = c.none }, - AerialEnumMemberIcon = { fg = c.green1, bg = c.none }, - AerialEventIcon = { fg = c.orange, bg = c.none }, - AerialFieldIcon = { fg = c.green1, bg = c.none }, - AerialFileIcon = { fg = c.fg, bg = c.none }, - AerialFunctionIcon = { fg = c.blue, bg = c.none }, - AerialInterfaceIcon = { fg = c.orange, bg = c.none }, - AerialKeyIcon = { fg = c.purple, bg = c.none }, - AerialKeywordIcon = { fg = c.purple, bg = c.none }, - AerialMethodIcon = { fg = c.blue, bg = c.none }, - AerialModuleIcon = { fg = c.yellow, bg = c.none }, - AerialNamespaceIcon = { fg = c.cyan, bg = c.none }, - AerialNullIcon = { fg = c.orange, bg = c.none }, - AerialNumberIcon = { fg = c.orange, bg = c.none }, - AerialObjectIcon = { fg = c.orange, bg = c.none }, - AerialOperatorIcon = { fg = c.blue5, bg = c.none }, - AerialPackageIcon = { fg = c.cyan, bg = c.none }, - AerialPropertyIcon = { fg = c.green1, bg = c.none }, - AerialStringIcon = { fg = c.green, bg = c.none }, - AerialStructIcon = { fg = c.orange, bg = c.none }, - AerialTypeParameterIcon = { fg = c.green1, bg = c.none }, - AerialVariableIcon = { fg = c.magenta, bg = c.none }, AerialNormal = { fg = c.fg, bg = c.none }, AerialGuide = { fg = c.fg_gutter }, AerialLine = { link = "LspInlayHint" }, @@ -796,38 +720,58 @@ function M.setup() NoiceCompletionItemKindDefault = { fg = c.fg_dark, bg = c.none }, - NoiceCompletionItemKindKeyword = { fg = c.cyan, bg = c.none }, - - NoiceCompletionItemKindVariable = { fg = c.magenta, bg = c.none }, - NoiceCompletionItemKindConstant = { fg = c.magenta, bg = c.none }, - NoiceCompletionItemKindReference = { fg = c.magenta, bg = c.none }, - NoiceCompletionItemKindValue = { fg = c.magenta, bg = c.none }, - - NoiceCompletionItemKindFunction = { fg = c.blue, bg = c.none }, - NoiceCompletionItemKindMethod = { fg = c.blue, bg = c.none }, - NoiceCompletionItemKindConstructor = { fg = c.blue, bg = c.none }, - - NoiceCompletionItemKindClass = { fg = c.orange, bg = c.none }, - NoiceCompletionItemKindInterface = { fg = c.orange, bg = c.none }, - NoiceCompletionItemKindStruct = { fg = c.orange, bg = c.none }, - NoiceCompletionItemKindEvent = { fg = c.orange, bg = c.none }, - NoiceCompletionItemKindEnum = { fg = c.orange, bg = c.none }, - NoiceCompletionItemKindUnit = { fg = c.orange, bg = c.none }, - - NoiceCompletionItemKindModule = { fg = c.yellow, bg = c.none }, - - NoiceCompletionItemKindProperty = { fg = c.green1, bg = c.none }, - NoiceCompletionItemKindField = { fg = c.green1, bg = c.none }, - NoiceCompletionItemKindTypeParameter = { fg = c.green1, bg = c.none }, - NoiceCompletionItemKindEnumMember = { fg = c.green1, bg = c.none }, - NoiceCompletionItemKindOperator = { fg = c.green1, bg = c.none }, - NoiceCompletionItemKindSnippet = { fg = c.dark5, bg = c.none }, - TreesitterContext = { bg = util.darken(c.fg_gutter, 0.8) }, Hlargs = { fg = c.yellow }, -- TreesitterContext = { bg = util.darken(c.bg_visual, 0.4) }, } + -- lsp symbol kind and completion kind highlights + local kinds = { + Array = "@punctuation.bracket", + Boolean = "@boolean", + Class = "@type", + Color = "Special", + Constant = "@constant", + Constructor = "@constructor", + Enum = "@lsp.type.enum", + EnumMember = "@lsp.type.enumMember", + Event = "Special", + Field = "@field", + File = "Normal", + Folder = "Directory", + Function = "@function", + Interface = "@lsp.type.interface", + Key = "@field", + Keyword = "@lsp.type.keyword", + Method = "@method", + Module = "@namespace", + Namespace = "@namespace", + Null = "@constant.builtin", + Number = "@number", + Object = "@constant", + Operator = "@operator", + Package = "@namespace", + Property = "@property", + Reference = "@text.reference", + Snippet = "Conceal", + String = "@string", + Struct = "@lsp.type.struct", + Unit = "@lsp.type.struct", + Text = "@text", + TypeParameter = "@lsp.type.typeParameter", + Variable = "@variable", + Value = "@string", + } + + local kind_groups = { "NavicIcons%s", "Aerial%sIcon", "CmpItemKind%s", "NoiceCompletionItemKind%s" } + for kind, link in pairs(kinds) do + local base = "LspKind" .. kind + theme.highlights[base] = { link = link } + for _, plugin in pairs(kind_groups) do + theme.highlights[plugin:format(kind)] = { link = base } + end + end + local markdown_rainbow = { c.blue, c.yellow, c.green, c.teal, c.magenta, c.purple } for i, color in ipairs(markdown_rainbow) do