From 343322108d2458994f64af3396efccd4875326b5 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Wed, 8 Jun 2022 18:40:42 -0700 Subject: [PATCH] fix(lsp): symbols when 'lsp.protocol.CompletionItemKind' is default --- README.md | 2 ++ doc/fzf-lua.txt | 2 ++ lua/fzf-lua/providers/lsp.lua | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fb48199..1b1aee8 100644 --- a/README.md +++ b/README.md @@ -753,6 +753,8 @@ require'fzf-lua'.setup { symbol_style = 1, -- style for document/workspace symbols -- false: disable, 1: icon+kind -- 2: icon only, 3: kind only + -- NOTE: icons are extracted from + -- vim.lsp.protocol.CompletionItemKind -- colorize using nvim-cmp's CmpItemKindXXX highlights -- can also be set to 'TS' for treesitter highlights ('TSProperty', etc) -- or 'false' to disable highlighting diff --git a/doc/fzf-lua.txt b/doc/fzf-lua.txt index e1b9e50..91a26bd 100644 --- a/doc/fzf-lua.txt +++ b/doc/fzf-lua.txt @@ -798,6 +798,8 @@ Consult the list below for available settings: symbol_style = 1, -- style for document/workspace symbols -- false: disable, 1: icon+kind -- 2: icon only, 3: kind only + -- NOTE: icons are extracted from + -- vim.lsp.protocol.CompletionItemKind -- colorize using nvim-cmp's CmpItemKindXXX highlights -- can also be set to 'TS' for treesitter highlights ('TSProperty', etc) -- or 'false' to disable highlighting diff --git a/lua/fzf-lua/providers/lsp.lua b/lua/fzf-lua/providers/lsp.lua index 7449ae3..a453ad5 100644 --- a/lua/fzf-lua/providers/lsp.lua +++ b/lua/fzf-lua/providers/lsp.lua @@ -392,7 +392,13 @@ local function gen_sym2style_map(opts) -- style==3: "" local s = nil if opts.symbol_style == 1 then - s = ("%s %s"):format(icon, k) + -- if icons weren't set by the user + -- icon will match the kind + if icon ~= k then + s = ("%s %s"):format(icon, k) + else + s = k + end elseif opts.symbol_style == 2 then s = icon elseif opts.symbol_style == 3 then