.config/nvim/lua/plugins/completion.lua

changeset 1122
8a56361b077f
parent 1098
8d479a558198
child 1123
b7a3f68c02b2
equal deleted inserted replaced
1121:199d907c2f67 1122:8a56361b077f
4 event = "InsertEnter", 4 event = "InsertEnter",
5 dependencies = { 5 dependencies = {
6 "hrsh7th/cmp-buffer", 6 "hrsh7th/cmp-buffer",
7 "hrsh7th/cmp-calc", 7 "hrsh7th/cmp-calc",
8 "hrsh7th/cmp-nvim-lsp", 8 "hrsh7th/cmp-nvim-lsp",
9 "hrsh7th/cmp-nvim-lsp-signature-help",
10 "hrsh7th/cmp-nvim-lua", 9 "hrsh7th/cmp-nvim-lua",
11 "hrsh7th/cmp-omni", 10 "hrsh7th/cmp-omni",
12 "hrsh7th/cmp-path", 11 "hrsh7th/cmp-path",
13 { "L3MON4D3/LuaSnip", opts = { history = true, delete_check_events = "TextChanged" } }, 12 { "L3MON4D3/LuaSnip", opts = { history = true, delete_check_events = "TextChanged" } },
14 "quangnguyen30192/cmp-nvim-tags", 13 "quangnguyen30192/cmp-nvim-tags",
32 luasnip.lsp_expand(args.body) 31 luasnip.lsp_expand(args.body)
33 end, 32 end,
34 }, 33 },
35 formatting = { 34 formatting = {
36 format = function(entry, vim_item) 35 format = function(entry, vim_item)
37 if entry.source.name == "nvim_lsp_signature_help" then 36 if vim_item.kind == "Text" then
38 vim_item.kind = ""
39 elseif vim_item.kind == "Text" then
40 vim_item.kind = entry.source.name 37 vim_item.kind = entry.source.name
41 end 38 end
42 vim_item.menu = nil 39 vim_item.menu = nil
43 return vim_item 40 return vim_item
44 end, 41 end,
81 fallback() 78 fallback()
82 end, 79 end,
83 }), 80 }),
84 sources = cmp.config.sources({ 81 sources = cmp.config.sources({
85 { name = "nvim_lsp" }, 82 { name = "nvim_lsp" },
86 { name = "nvim_lsp_signature_help" },
87 { name = "nvim_lua" }, 83 { name = "nvim_lua" },
88 { name = "buffer", option = { keyword_pattern = [[\k\+]] } }, 84 { name = "buffer", option = { keyword_pattern = [[\k\+]] } },
89 { name = "path" }, 85 { name = "path" },
90 -- { name = "omni" }, 86 -- { name = "omni" },
91 { name = "tags" }, 87 { name = "tags" },
92 { name = "calc" }, 88 { name = "calc" },
93 }), 89 }),
94 }) 90 })
95 end, 91 end,
96 }, 92 },
93
94 {
95 "ray-x/lsp_signature.nvim",
96 events = { "LspAttach" },
97 opts = {
98 toggle_key = "<F12>",
99 toggle_key_flip_floatwin_setting = true,
100 floating_window = false,
101 fix_pos = true,
102 hint_enable = false,
103 handler_opts = { border = "none" },
104 },
105 },
97 } 106 }

mercurial