chore: Changes to nvim cmp
This commit is contained in:
parent
ff3a171e81
commit
b2267a0e47
2 changed files with 36 additions and 10 deletions
|
@ -104,6 +104,8 @@ cmp.setup {
|
|||
nvim_lsp = "(LSP)",
|
||||
luasnip = "(Snippet)",
|
||||
buffer = "(Text)",
|
||||
nvim_lsp_signature_help = "(Signature)",
|
||||
nvim_lua = "(Nvim LSP)",
|
||||
path = "(Path)",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
|
@ -118,8 +120,32 @@ cmp.setup {
|
|||
},
|
||||
sources = cmp.config.sources(
|
||||
{
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp",
|
||||
entry_filter = function(entry, context)
|
||||
local kind = entry:get_kind()
|
||||
local line = context.cursor_line
|
||||
local col = context.cursor.col
|
||||
local char_before_cursor = string.sub(line, col - 1, col)
|
||||
|
||||
|
||||
if char_before_cursor == "." then
|
||||
if kind == 2 or kind == 5 then
|
||||
return true
|
||||
else return false end
|
||||
elseif string.match(line, "^%s*%w*$") then
|
||||
if kind == 3 or kind == 6 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
},
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'luasnip'},
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = "path" },
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue