onsails/lspkind.nvim

All cmp sources treated as Variable in cmdline mode

Opened this issue · 0 comments

I've been using lspkind for awhile, and recently started trying to cmp's cmdline mode, ie:

			cmp.setup({
                                 --
				formatting = {
					format = lspkind.cmp_format({
						mode = "symbol_text", -- show only symbol annotations
						-- maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
						ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
						symbol_map = {
							Copilot = "󱜙",

						},
					}),
				},
                                 --- ...
			}
			cmp.setup.cmdline(':', {
				mapping = cmp.mapping.preset.insert({
				}),
				sources = {
					{ name = 'cmdline' },
					{
						name = 'path',
						keyword_length = 2,
						option = {
							trailing_slash = true,
						}
					}
			})

it seems like both cmdline and path end up treated as variables, ie:

CleanShot 2024-05-27 at 12 08 33

I think either I would want:

  • to not show any lsp kind info
  • map path and cmdline to a kind that makes sense (File and Function?)

I do see a before callback that runs first

if opts.before then
vim_item = opts.before(entry, vim_item)
end

... but I haven't figured out what to try to fill in to get it to skip the rest of the formatting. I do know that vim.fn.getcmdtype() returns an empty string if it's not in a command mode, so figure that could be used somehow.