File tree Expand file tree Collapse file tree 2 files changed +57
-3
lines changed
Expand file tree Collapse file tree 2 files changed +57
-3
lines changed Original file line number Diff line number Diff line change 1+ return {
2+ {
3+ " hrsh7th/cmp-nvim-lsp"
4+ },
5+ {
6+ ' L3MON4D3/LuaSnip' ,
7+ dependencies = {
8+ ' saadparwaiz1/cmp_luasnip' ,
9+ ' rafamadriz/friendly-snippets'
10+ },
11+ },
12+ {
13+ " hrsh7th/nvim-cmp" ,
14+ dependencies = { ' hrsh7th/cmp-nvim-lsp' },
15+ config = function ()
16+ -- Set up nvim-cmp.
17+ local cmp = require ' cmp'
18+ require (" luasnip.loaders.from_vscode" ).lazy_load ()
19+
20+ cmp .setup ({
21+ snippet = {
22+ -- REQUIRED - you must specify a snippet engine
23+ expand = function (args )
24+ require (' luasnip' ).lsp_expand (args .body ) -- For `luasnip` users.
25+ end ,
26+ },
27+ window = {
28+ completion = cmp .config .window .bordered (),
29+ documentation = cmp .config .window .bordered (),
30+ },
31+ mapping = cmp .mapping .preset .insert ({
32+ [' <C-b>' ] = cmp .mapping .scroll_docs (- 4 ),
33+ [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
34+ [' <C-Space>' ] = cmp .mapping .complete (),
35+ [' <C-e>' ] = cmp .mapping .abort (),
36+ [' <CR>' ] = cmp .mapping .confirm ({ select = true }),
37+ }),
38+ sources = cmp .config .sources ({
39+ { name = ' nvim_lsp' },
40+ { name = ' luasnip' }, -- For luasnip users.
41+ }, {
42+ { name = ' buffer' },
43+ })
44+ })
45+ end ,
46+ }
47+ }
Original file line number Diff line number Diff line change @@ -24,10 +24,17 @@ return {
2424 {
2525 " neovim/nvim-lspconfig" ,
2626 config = function ()
27+ local capabilities = require (' cmp_nvim_lsp' ).default_capabilities ()
2728 local lspconfig = require (" lspconfig" )
28- lspconfig .lua_ls .setup ({})
29- lspconfig .tsserver .setup ({})
30- lspconfig .pyright .setup ({})
29+ lspconfig .lua_ls .setup ({
30+ capabilities = capabilities
31+ })
32+ lspconfig .tsserver .setup ({
33+ capabilities = capabilities
34+ })
35+ lspconfig .pyright .setup ({
36+ capabilities = capabilities
37+ })
3138
3239 -- Buffer local mappings.
3340 -- See `:help vim.lsp.*` for documentation on any of the below functions
You can’t perform that action at this time.
0 commit comments