fix(nvim): copilot_cmp behaviour

This commit is contained in:
Rob Watson 2023-10-04 05:27:52 +02:00
parent 0cd4cf6d40
commit d123d084d7
1 changed files with 14 additions and 2 deletions

View File

@ -68,14 +68,26 @@ cmp.setup({
}),
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
require("copilot_cmp.comparators").prioritize,
cmp.config.compare.offset,
cmp.config.compare.score,
cmp.config.compare.recently_used,
-- require("cmp-under-comparator").under,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
-- https://github.com/hrsh7th/nvim-cmp/wiki/Advanced-techniques#disabling-completion-in-certain-contexts-such-as-comments
enabled = function()
local context = require("cmp.config.context")
if vim.api.nvim_get_mode().mode == "c" then
return true
end
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment")
end,
formatting = {
fields = { "kind", "abbr", "menu" },
},