Add ccls support for colored symbols

This commit is contained in:
Antoine Vaure 2025-02-02 20:16:20 +01:00
parent 5fd329dc7f
commit 43c1dc6d35
2 changed files with 82 additions and 36 deletions

View file

@ -1,47 +1,57 @@
local custom_highlights = function(C)
return {
HopNextKey = { bg = C.text, fg = C.base, style = { "bold", "underline" } },
HopNextKey1 = { bg = C.text, fg = C.base, style = { "bold" } },
HopNextKey2 = { bg = C.text, fg = C.base, style = { "bold", "italic" } },
local U = require("catppuccin.utils.colors")
local ret = {
HopNextKey = { bg = C.text, fg = C.base, style = { "bold", "underline" } },
HopNextKey1 = { bg = C.text, fg = C.base, style = { "bold" } },
HopNextKey2 = { bg = C.text, fg = C.base, style = { "bold", "italic" } },
DiagnosticUnderlineError = { style = { "undercurl" } },
DiagnosticUnderlineWarn = { style = { "undercurl" } },
DiagnosticUnderlineInfo = { style = { "undercurl" } },
DiagnosticUnderlineHint = { style = { "undercurl" } },
DiagnosticUnderlineOk = { style = { "undercurl" } },
-- Function = { fg = C.blue, style = { "bold" } },
["@function.call"] = { fg = U.darken(C.blue, 0.5, C.text) },
Function = { fg = C.blue, style = { "bold" } },
["@lsp.type.function"] = { link = "@function.call" },
["@lsp.type.method"] = { link = "@function.call" },
["@lsp.type.macro"] = { link = "Macro" },
["@Keyword.directive"] = { link = "PreProc" },
-- ["@lsp.mod.definition"] = { bg = U.darken(C.green, .3, C.base) },
-- Keyword = { fg = C.black, style = { "italic" } },
Type = { fg = C.text },
Type = { fg = C.text },
--
-- syntax
Constant = { fg = C.text },
String = { fg = C.text },
Character = { fg = C.text },
Number = { fg = C.text },
Float = { fg = C.text },
Boolean = { fg = C.text },
Identifier = { fg = C.text },
Function = { fg = C.text },
Statement = { fg = C.text },
Conditional = { fg = C.text },
Repeat = { fg = C.text },
Label = { fg = C.text },
Operator = { fg = C.text },
Keyword = { fg = C.text },
Exception = { fg = C.text },
PreProc = { fg = C.pink },
Include = { fg = C.pink },
Define = { fg = C.pink },
Macro = { fg = C.pink },
PreCondit = { fg = C.pink },
StorageClass = { fg = C.text },
Structure = { fg = C.text },
Special = { fg = C.text },
Type = { fg = C.text },
Typedef = { fg = C.text },
SpecialChar = { fg = C.text },
Tag = { fg = C.text },
Delimiter = { fg = C.text },
Debug = { fg = C.text },
Constant = { fg = C.text },
String = { fg = C.text },
Character = { fg = C.text },
Number = { fg = C.text },
Float = { fg = C.text },
Boolean = { fg = C.text },
Identifier = { fg = C.text },
-- Function = { fg = C.text },
Statement = { fg = C.text },
Conditional = { fg = C.text },
Repeat = { fg = C.text },
Label = { fg = C.text },
Operator = { fg = C.text },
Keyword = { fg = C.text },
Exception = { fg = C.text },
PreProc = { fg = C.pink },
Include = { fg = C.pink },
Define = { fg = C.pink },
Macro = { fg = C.pink },
PreCondit = { fg = C.pink },
StorageClass = { fg = C.text },
Structure = { fg = C.text },
Special = { fg = C.text },
Type = { fg = C.text },
Typedef = { fg = C.text },
SpecialChar = { fg = C.text },
Tag = { fg = C.text },
Delimiter = { fg = C.text },
Debug = { fg = C.text },
variable = {},
-- ['@parameter'] = { style = { "underline"} },
-- Underlined = { style = { "underline" } }, -- (preferred) text that stands out, HTML links
-- Bold = { style = { "bold" } },
@ -115,6 +125,36 @@ local custom_highlights = function(C)
-- csvCol7 = { fg = C.mauve },
-- csvCol8 = { fg = C.pink },
}
local var_colors = {
U.darken(C.green, .3, C.text);
U.darken(C.green, .5, C.text);
U.darken(C.green, .7, C.text);
U.darken(C.yellow, .3, C.text);
U.darken(C.yellow, .5, C.text);
U.darken(C.yellow, .7, C.text);
U.darken(C.teal, .3, C.text);
U.darken(C.teal, .5, C.text);
U.darken(C.teal, .7, C.text);
U.darken(C.red, .3, C.text);
U.darken(C.red, .5, C.text);
U.darken(C.red, .7, C.text);
}
local all_colors = {
variable = var_colors
}
for type, colors in pairs(all_colors) do
for i = 1, #colors do
for _, lang in pairs({ 'cpp' }) do
local k = string.format('@lsp.typemod.%s.id%s.%s', type, i - 1, lang)
ret[k] = { fg = colors[i] }
end
end
end
return ret
end
return custom_highlights

View file

@ -9,7 +9,13 @@ local servers = {
basedpyright = {},
lua_ls = {},
clangd = {},
ccls = {},
ccls = {
init_options = {
highlight = {
rainbow = 10,
},
},
},
-- jedi_language_server = {},
nixd = {},
nil_ls = {},