-
Notifications
You must be signed in to change notification settings - Fork 76
Sorting completion items by external sources #273
Comments
That's a sensilbe enhancement. Unfortunately I might not have time to work on this project recently so it might takes a while for me to implement this:( Right now a possible solution might be putting lsp sources and buffer sources in different group and use the following mapping to switch between them. imap <c-j> <Plug>(completion_next_source) "use <c-j> to switch to previous completion
imap <c-k> <Plug>(completion_prev_source) "use <c-k> to switch to next completion |
@haorenW1025 To build on top of this idea, it would be nice to customize the ordering of the completion types. Using the types like in here: |
How would that fit with |
Yeah I think length sorting or alphabetical sorting within each type is nice. |
@quantum-booty that would be cool, can you create a separate issue for that? |
@haorenW1025 please, consider investing on this issue, I think that really makes sense to prioritize ordering of sources. |
@haorenW1025 would you explain in the readme or there, how I can separate in groups? I currently have this chain config vim.g.completion_chain_complete_list = {
default = {
default = {
{
complete_items = {
"lsp", "snippet", "ts", "path", "buffers"
}
}
},
string = {
{
complete_items = {"path"}
}
}
}
} |
I have it like this: vim.g.completion_chain_complete_list = {
{complete_items = {'lsp', 'snippet'}},
{complete_items = {'buffers'}},
{mode = '<c-p>'},
{mode = '<c-n>'},
} So so I have In your case it would be something like this: vim.g.completion_chain_complete_list = {
default = {
default = {
{ complete_items = { "lsp", "snippet" } },
{ complete_items = { "ts", "path", "buffers" } }
},
string = {
{
complete_items = {"path"}
}
}
}
} You have it described here |
I also just found out that you can sort by types, and use it to push things like buffers to the bottom of the list vim.g.completion_items_priority = {
Method = 10,
Field = 9,
Property = 9,
Variables = 6,
Function = 7,
Interfaces = 6,
Constant = 6,
Class = 6,
Struct = 6,
Keyword = 5,
Treesitter = 4,
Buffers = 0,
TabNine = 1,
File = 2,
} |
Is your feature request related to a problem? Please describe.

My
completion_chain_complete_list
contains lsp and buffer. I'm frustrated when the top of the popupmenu is Buffer (which is mostly noise when lsp is available).Describe the solution you'd like
Support sorting completion items by external sources. User could put lsp result ahead of buffer.
The text was updated successfully, but these errors were encountered: