Closed lkhphuc closed 1 year ago
Copilot technically is a LSP, and I don't think it would be too useful if it always popped up on the bottom, but an easier way to do that than messing with comparators would be to just set the source priority like so:
sources = {
{ name = "nvim_lsp", group_index = 1 },
{ name = "copilot", group_index = 2 },
{ name = "path", group_index = 2 },
{ name = 'neorg', group_index = 2 },
}
Also though, I just tried putting the length comparator above the copilot-cmp ones, and it properly made copilot completions show up at the end.
It may be that 2 isn't a high enough weight to make the exact comparator always prioritized. I would try increasing it to 3 or 4 and see f that fixes it. Here is the formula that it is used in from the nvim-cmp docs:
final_score = orig_score + ((#sources - (source_index - 1)) * sorting.priority_weight)
Thanks for the tips. I tried playing around a bit but sometime it did rank lower, but sometimes it still ranks very high. Feel free to close this issue.
I tried to follow your code snippet on the readme to rank copilot lower than exact match, but it does not work.
But in the text you said copilot should be put lower, so I tried this:
I tried remove the sorting config and use cmp's default but copilot is stilled ranked highest.![Screenshot 2023-01-17 at 18 48 24](https://user-images.githubusercontent.com/12573521/212985236-f5997f82-b1fd-445d-8c69-a2109b5744fa.png)
Do you have any idea? Thank you.