Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu customization API #11

Closed
hrsh7th opened this issue Aug 11, 2021 · 8 comments
Closed

Menu customization API #11

hrsh7th opened this issue Aug 11, 2021 · 8 comments

Comments

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 11, 2021

From #10, #7

@gegoune
Copy link
Contributor

gegoune commented Aug 11, 2021

Are you using custom window to display completion candidates in cmp or standard vim/nvim one?

@hrsh7th
Copy link
Owner Author

hrsh7th commented Aug 11, 2021

Haha, Currently nvim-cmp uses vim's native completion menu.

But my next task after nvim-cmp stabilized is it! I will use a custom completion menu via the floating window. (It realizes custom highlighting.)

@Jesse-Bakker
Copy link

Sounds pretty cool! Will there then also be an option to just use the regular neovim completion menu?

@akinsho
Copy link

akinsho commented Aug 12, 2021

Sounds pretty cool! Will there then also be an option to just use the regular neovim completion menu?

Sounds like you'd have to maintain two implementations to do that, one that conforms to the requirements of nvim's completion menu and one to a custom popup. I'm nowhere near the code but seems like it'd be easier to just add configuration options for whatever a person might want to disable/enable rather than implement/maintain both styles

@Jesse-Bakker
Copy link

I'm nowhere near the code but seems like it'd be easier to just add configuration options for whatever a person might want to disable/enable rather than implement/maintain both styles

Yeah, that's what I meant

@windwp
Copy link

windwp commented Aug 13, 2021

vim.lsp.protocol.CompletionItemKind = {
    '', -- Text          = 1;
    '', -- Method        = 2;
    'ƒ', -- Function      = 3;
    '', -- Constructor   = 4;
    '', -- Field         = 5;
    '', -- Variable      = 6;
    '', -- Class         = 7;
    '', -- Interface     = 8;
    '', -- Module        = 9;
    '', -- Property      = 10;
    '', -- Unit          = 11;
    '', -- Value         = 12;
    '', -- Enum          = 13;
    '', -- Keyword       = 14;
    '', -- Snippet       = 15;
    '', -- Color         = 16;
    '', -- File          = 17;
    '', -- Reference     = 18;
    '', -- Folder        = 19;
    '', -- EnumMember    = 20;
    '', -- Constant      = 21;
    '', -- Struct        = 22;
    '', -- Event         = 23;
    '', -- Operator      = 24;
    '', -- TypeParameter = 25;
}
local cmp = require('cmp')
for index, value in ipairs(vim.lsp.protocol.CompletionItemKind) do
    cmp.lsp.CompletionItemKind[index] = value
end

a little snippet to implement lsplkind on nvim-cmp

@miguelcaravantes
Copy link

vim.lsp.protocol.CompletionItemKind = {
    '', -- Text          = 1;
    '', -- Method        = 2;
    'ƒ', -- Function      = 3;
    '', -- Constructor   = 4;
    '', -- Field         = 5;
    '', -- Variable      = 6;
    '', -- Class         = 7;
    '', -- Interface     = 8;
    '', -- Module        = 9;
    '', -- Property      = 10;
    '', -- Unit          = 11;
    '', -- Value         = 12;
    '', -- Enum          = 13;
    '', -- Keyword       = 14;
    '', -- Snippet       = 15;
    '', -- Color         = 16;
    '', -- File          = 17;
    '', -- Reference     = 18;
    '', -- Folder        = 19;
    '', -- EnumMember    = 20;
    '', -- Constant      = 21;
    '', -- Struct        = 22;
    '', -- Event         = 23;
    '', -- Operator      = 24;
    '', -- TypeParameter = 25;
}
local cmp = require('cmp')
for index, value in ipairs(vim.lsp.protocol.CompletionItemKind) do
    cmp.lsp.CompletionItemKind[index] = value
end

a little snippet to implement lsplkind on nvim-cmp

great i am using it this way to show icon + text

for index, value in ipairs(vim.lsp.protocol.CompletionItemKind) do
    cmp.lsp.CompletionItemKind[index] = value .. ' ' ..  cmp.lsp.CompletionItemKind[index]
end

@hrsh7th hrsh7th changed the title Menu customization Menu customization API Aug 14, 2021
@hrsh7th
Copy link
Owner Author

hrsh7th commented Aug 16, 2021

@hrsh7th hrsh7th closed this as completed Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants