Compare commits

...

3 commits

Author SHA1 Message Date
diniamo
5c314776d9
Merge f1edabb210 into 383924d225 2024-11-07 19:32:50 +01:00
383924d225
meta: update release info 2024-11-07 11:12:38 +03:00
diniamo
f1edabb210 nvim-cmp: move text and snippet completions to the bottom
This doesn't guarantee that snippets will be above text completions, but
that should still be the case, since the `kind` comparator sorts
snippets above text.
2024-11-04 22:21:45 +01:00
3 changed files with 24 additions and 2 deletions

View file

@ -42,6 +42,20 @@ in {
after = ''
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
local cmp = require("cmp")
local kinds = require("cmp.types").lsp.CompletionItemKind
local deprio = function(kind)
return function(e1, e2)
if e1:get_kind() == kind then
return false
end
if e2:get_kind() == kind then
return true
end
return nil
end
end
cmp.setup(${toLuaObject cfg.setupOpts})
${optionalString config.vim.lazy.enable

View file

@ -29,6 +29,8 @@ in {
sorting.comparators = mkOption {
type = mergelessListOf (either str luaInline);
default = [
(mkLuaInline "deprio(kinds.Text)")
(mkLuaInline "deprio(kinds.Snippet)")
"offset"
"exact"
"score"
@ -43,6 +45,12 @@ in {
(see `:help cmp-config.sorting.comparators`),
or a string, in which case the builtin comparator with that name will
be used.
A `deprio` function and a `kinds`
(`require("cmp.types").lsp.CompletionItemKind`) variable is provided
above `setupOpts`. By passing a type to the funcion, the returned
function will be a comparator that always ranks the specified kind the
lowest.
'';
apply = map (
c:

View file

@ -1,4 +1,4 @@
{
"release": "v0.6",
"isReleaseBranch": true
"release": "v0.7",
"isReleaseBranch": false
}