Code Monkey home page Code Monkey logo

Comments (8)

gegoune avatar gegoune commented on July 30, 2024 1

There is a way, like

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

(search other issues for original author, I think it was @windwp) But it definitely would be nicer if vim.lsp.protocol.CompletionItemKind was used if set.

from nvim-cmp.

hrsh7th avatar hrsh7th commented on July 30, 2024 1

I will add the API to customize menu's. I think this customization should be realized on user-land.

from nvim-cmp.

hrsh7th avatar hrsh7th commented on July 30, 2024 1

I've added the API for it.
https://github.com/hrsh7th/nvim-cmp#formattingformat-type-funentry-cmpentry-vim_item-vimcompleteditem-vimcompleteditem

from nvim-cmp.

timbedard avatar timbedard commented on July 30, 2024

I will add the API to customize menu's. I think this customization should be realized on user-land.

I agree. Thanks!

from nvim-cmp.

timbedard avatar timbedard commented on July 30, 2024

Sweet. Thanks!

from nvim-cmp.

gegoune avatar gegoune commented on July 30, 2024

How would relevant function look without lspkind-nvim? Tried

formatting = {                                                                                        
  format = function(_, vim_item)                                                                      
    vim_item.kind = vim.lsp.protocol.CompletionItemKind[vim_item.kind]                                
    return vim_item                                                                                   
  end,                                                                                                
},                                                                                                    

but it does not display anything except for completion candidate itself.
Screenshot 2021-08-16 at 11 31 16

from nvim-cmp.

hrsh7th avatar hrsh7th commented on July 30, 2024

vim_item.kind can be Function/Snippet/Folder etc.
You should check vim.lsp.protocol.CompletionItemKind keys.

And I think it doesn't problem. Is it a problem for you?

from nvim-cmp.

gegoune avatar gegoune commented on July 30, 2024

Ah, ok, so it won't work since vim.lsp.protocol.CompletionItemKind is

vim.lsp.protocol.CompletionItemKind = {
  'ﮜ [text]', -- Text = 1;
  ' [method]', -- Method = 2;
  'ƒ [function]', -- Function = 3;
…
}

from nvim-cmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.