feat(lsp): make symbol highlights configurable

main
bhagwan 2 years ago
parent ea287de481
commit 09e2b982fb

@ -751,9 +751,12 @@ require'fzf-lua'.setup {
lsp_icons = true,
ui_select = true, -- use 'vim.ui.select' for code actions
symbol_style = 1, -- style for document/workspace symbols
-- colorize using CmpItemKindXXX hls
-- false: disable, 1: icon+kind
-- 2: icon only, 3: kind only
-- colorize using nvim-cmp's CmpItemKindXXX highlights
-- can also be set to 'TS' for treesitter highlights ('TSProperty', etc)
-- or 'false' to disable highlighting
symbol_hl_prefix = "CmpItemKind",
-- additional symbol formatting, works with or without style
symbol_fmt = function(s) return "["..s.."]" end,
severity = "hint",

@ -796,9 +796,12 @@ Consult the list below for available settings:
lsp_icons = true,
ui_select = true, -- use 'vim.ui.select' for code actions
symbol_style = 1, -- style for document/workspace symbols
-- colorize using CmpItemKindXXX hls
-- false: disable, 1: icon+kind
-- 2: icon only, 3: kind only
-- colorize using nvim-cmp's CmpItemKindXXX highlights
-- can also be set to 'TS' for treesitter highlights ('TSProperty', etc)
-- or 'false' to disable highlighting
symbol_hl_prefix = "CmpItemKind",
-- additional symbol formatting, works with or without style
symbol_fmt = function(s) return "["..s.."]" end,
severity = "hint",

@ -485,6 +485,7 @@ M.globals.lsp = {
cwd_only = false,
ui_select = true,
symbol_style = 1,
symbol_hl_prefix = "CmpItemKind",
symbol_fmt = function(s) return "["..s.."]" end,
async_or_timeout = 5000,
_actions = function() return M.globals.actions.files end,

@ -398,8 +398,10 @@ local function gen_sym2style_map(opts)
elseif opts.symbol_style == 3 then
s = k
end
if s then
M._sym2style[k] = utils.ansi_from_hl("CmpItemKind" .. k, s, colormap)
if s and opts.symbol_hl_prefix then
M._sym2style[k] = utils.ansi_from_hl(opts.symbol_hl_prefix .. k, s, colormap)
elseif s then
M._sym2style[k] = s
else
-- can get here when only 'opts.symbol_fmt' was set
M._sym2style[k] = k

Loading…
Cancel
Save