From 3c3b3952b4d3bc44cb393745102e817f55abc406 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 24 Aug 2024 09:56:18 +0200 Subject: [PATCH] Squashed commit of the following: commit 1029099729e656df66264e45814060f9b84b2bf4 Author: Sonny Bakker Date: Sat Aug 24 09:54:59 2024 +0200 [#1] show completion lsp source --- templates/nvim/lua/lsp.lua.j2 | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index 23a12ce..c689ff6 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -111,11 +111,18 @@ local cmp = require('cmp') local luasnip = require('luasnip') cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) + sources = { + { names = 'nvim_lsp', }, + { names = 'luasnip', }, -- TODO: add snippets + }, + + formatting = { + format = function(entry, vim_item) + vim_item.menu = string.format('[%s]', entry.source.source.client.name) + return vim_item end, }, + mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping(function(fallback) if cmp.visible() then @@ -136,8 +143,10 @@ cmp.setup({ end end, { 'i', 's' }), }), - sources = { - { names = 'nvim_lsp', }, - { names = 'luasnip', }, -- TODO: add snippets + + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, }, })