nvim-cmp icon indicating copy to clipboard operation
nvim-cmp copied to clipboard

Question: How to use comparators to sort properties and values first in CSS?

Open kmoschcau opened this issue 1 year ago • 0 comments

Hi, currently I don't fully understand what each comparator does or how it could help me achieve what I want.

Currently I have this setup in my cmp config:

      sources = cmp.config.sources({
        { name = "nvim_lsp" },
        { name = "nvim_lsp_signature_help" },
        { name = "luasnip" },
      }, {
        buffer_source,
      }),
      sorting = {
        comparators = {
          cmp.config.compare.offset,
          cmp.config.compare.exact,
          cmp.config.compare.score,
          require("cmp-under-comparator").under,
          cmp.config.compare.kind,
          cmp.config.compare.sort_text,
          cmp.config.compare.length,
          cmp.config.compare.order,
        },
      },

Basically when completing properties, I would like to have properties first. When completing values for properties I would like to have values first. Right now they are both somewhere in the middle, sandwiched between functions and snippets. How could I achieve having them first?

kmoschcau avatar Oct 20 '23 13:10 kmoschcau