Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Add kind mapping #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add kind mapping #223

wants to merge 1 commit into from

Conversation

ray-x
Copy link

@ray-x ray-x commented Feb 26, 2021

This is a port from complete-nvim feature which will show LSP kinds to a nerdfont
e.g {["Function"] = ""; ["Interface"] = "擄";}

Screen Shot 2021-02-26 at 4 14 59 pm

@hrsh7th
Copy link
Owner

hrsh7th commented Feb 26, 2021

Thank you for your contribution.

I think this feature is unnecessary because we already have https://github.com/onsails/lspkind-nvim .

I'm considering it to support by nvim-compe itself. But it still needs more time.

@ray-x
Copy link
Author

ray-x commented Feb 26, 2021

In fact, https://github.com/onsails/lspkind-nvim is work out of box. As it replace language server by

require('vim.lsp.protocol').CompletionItemKind = symbols

But The way Lspkind-nvim update kind is by attach the nerd font in front of kind. So the kind will be

{ " Text", "ƒ Method", " Function", ....}

But what I want is

{ "", "ƒ", " ", }

Which is similar to vscode.
Check the behavior below:
iskind:
Screen Shot 2021-02-26 at 5 10 18 pm

vscode:

Screen Shot 2021-02-26 at 5 09 54 pm

@hrsh7th
Copy link
Owner

hrsh7th commented Feb 26, 2021

I'm now using lspkind with following config and it worked as you expected.


if dein#tap('lspkind-nvim')
  lua require'lspkind'.init({ with_text = false })
endif

@ray-x
Copy link
Author

ray-x commented Feb 26, 2021

Well, 2~3 lines of change in compe or introduce a plugin for it...
I would probably change my init.lua for this if the PR rejected.

@hrsh7th
Copy link
Owner

hrsh7th commented Feb 26, 2021

To be honest, I think this feature needs more consideration.

For example, Currently, the buffer source results don't have kind. But user will want this configuratuon affect to buffer source, I think.

@ray-x
Copy link
Author

ray-x commented Feb 26, 2021

As I only need a hard code kind icon. So I can easily do this in init.vim while I waiting for this feature :
require('vim.lsp.protocol').CompletionItemKind = {'', 'ƒ', '', '', 'ﴲ', '', '', 'ﰮ', '', '', '', '', '了', '', '﬌', '', '', '', '', '', '', '', 'ﳅ', '', '', ''}

What would be ideal that:

  1. Type icon in the font (same as vscode, would be great with color) and then the item.abbr

Screen Shot 2021-02-26 at 7 22 16 pm

  1. Set a default for those does not have kind.

@hrsh7th
Copy link
Owner

hrsh7th commented Feb 26, 2021

I think the ideal solution like as the following.

local compe = require'compe'

local source = {}

source.complete = function(_, context)
  local items = {}
  table.insert(items, {
    word = 'something';
    kind = compe.helper.kind.Keyword;
  })
  context.complete({
    items = items
  })
end

It means we should define kind table in nvim-compe built-in.
Currently, it depends on the LSP but it should be able to use in some other sources.

@stale
Copy link

stale bot commented Aug 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants