luozhiya / fittencode.nvim

Fitten Code AI Programming Assistant for Neovim
49 stars 8 forks source link

Cmp源模式设计Item最大长度或省略中间内容 #54

Closed hetaozdh closed 1 month ago

hetaozdh commented 1 month ago

现在的source补全模式会将fitten返回的所有代码作为Item内容,导致CmpMenu的长度长的非常离谱,结果挤占了Document显示的空间

image
luozhiya commented 1 month ago

@hetaozdh

source 模式只截取返回了一定数量的字符,但是 实际上 cmp 里补全 item 显示多长是在 cmp 里设置

formatting = {
  expandable_indicator = true,
  fields = { 'abbr', 'kind', 'menu' },
  format = function(_, vim_item)
    return vim_item
  end,
},
                                                  *cmp-config.formatting.format*
formatting.format~
  `fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
  The function used to customize the appearance of the completion menu. See
  |complete-items|. This value can also be used to modify the `dup` property.
  NOTE: The `vim.CompletedItem` can contain the special properties
  `abbr_hl_group`, `kind_hl_group` and `menu_hl_group`.
hetaozdh commented 1 month ago

已经解决了,谢谢