Adds luasnip for completions

This commit is contained in:
Michael Housh
2023-10-01 11:44:07 -04:00
parent 660ff7d94d
commit e8772df72e
2 changed files with 17 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
{
"LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" },
"bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" },
@@ -7,7 +8,9 @@
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"formatter.nvim": { "branch": "master", "commit": "34dcdfa0c75df667743b2a50dd99c84a557376f0" },
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
"go.nvim": { "branch": "master", "commit": "2f573a297bea3a483a3607ae7c607a8a08d27993" },
"guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" },
"lazy.nvim": { "branch": "main", "commit": "59335c5b9d116f5d3948f833288a89e2a829a005" },
@@ -24,7 +27,7 @@
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
"nvim-lspconfig": { "branch": "master", "commit": "fabd2578cbce0a76d48afa4b369f27a08f03ead3" },
"nvim-lspconfig": { "branch": "master", "commit": "eb1b53162755888ff75e495797071644d983bff7" },
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
"nvim-treesitter": { "branch": "master", "commit": "776e4d341b5416c995e74c3abbf75f9cec26aa5e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },

View File

@@ -7,17 +7,22 @@ return {
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
--"hrsh7th/cmp-vsnip",
--"saadparwaiz1/cmp_luasnip",
'saadparwaiz1/cmp_luasnip',
"f3fora/cmp-spell",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-emoji"
"hrsh7th/cmp-emoji",
"L3MON4D3/LuaSnip",
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
config = function()
-- Setup nvim-cmp.
local cmp = require "cmp"
local lspkind = require("lspkind")
local capabilities = require('cmp_nvim_lsp').default_capabilities()
--local luasnip = require('luasnip')
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
local luasnip = require('luasnip')
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@@ -67,6 +72,9 @@ return {
}
})
-- Configure nvim-cmp.
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup({
formatting = {
format = lspkind.cmp_format {
@@ -86,6 +94,7 @@ return {
experimental = {native_menu = false, ghost_text = false},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
--require('luasnip').lsp_expand(args.body)
end
},