FIX: small refactor of lsp settings and fixing issue with autocomplete
This commit is contained in:
parent
f47b2f2e58
commit
12c22f330c
@ -6,17 +6,17 @@
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "933db4596e4bab1b09b6d48a10e21819e4cc458f" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "a38be6e0dd4c6db66997deab71fc4453ace97f9c" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "08954f723bf2d442ea020551e3acc956f4dc6dc7" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "af6afefbb46ab29a8a1db69536b04290a9403876" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" },
|
||||
"mason-lspconfig": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" },
|
||||
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "97dc716fc914c46577a4f254035ebef1aa72558a" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "6e5c78ebc9936ca74add66bda22c566f951b6ee5" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "7f3179315959bd762abd0f8dbe0361db805fb2d4" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "5e4f959d5979730ddb2ee9ae60f5133081502b23" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "c2b8311dfacd08b3056b8f0249025d633a4e71a8" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "f4b415bfbce390866a83277db42cf6aa94230728" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "623c3cd60a8081b68edcaf544856c053249a659e" },
|
||||
"undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "193ba9b393931bad768c1d2eed688b0bcc240858" }
|
||||
}
|
@ -31,11 +31,16 @@ return
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp', keyword_length = 1 },
|
||||
{ name = 'luasnip', keyword_length = 3},
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
{ name = 'buffer', keyword_length = 2 },
|
||||
}),
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
@ -66,6 +71,18 @@ return
|
||||
matching = { disallow_symbol_nonprefix_matching = false }
|
||||
})
|
||||
|
||||
local lsp = require("lspconfig")
|
||||
lsp.lua_ls.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
@ -77,10 +94,6 @@ return
|
||||
capabilities = capabilities
|
||||
})
|
||||
|
||||
require('lspconfig')['lua_ls'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
|
||||
require('lspconfig')['rust_analyzer'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
@ -93,16 +106,5 @@ return
|
||||
capabilities = capabilities
|
||||
})
|
||||
|
||||
local lsp = require("lspconfig")
|
||||
lsp.lua_ls.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
|
@ -24,3 +24,4 @@ vim.opt.scrolloff = 8
|
||||
vim.g.netrw_browse_split = 0
|
||||
vim.g.netrw_winsize = 25
|
||||
|
||||
vim.opt.completeopt = {'menu', 'menuone', 'noselect' }
|
||||
|
Loading…
Reference in New Issue
Block a user