lsp lua
This commit is contained in:
58
lua/plugins/lsp.lua
Normal file
58
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require "cmp"
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
local caps = vim.lsp.protocol.make_client_capabilities()
|
||||
caps = require("cmp_nvim_lsp").default_capabilities(caps)
|
||||
|
||||
vim.lsp.config("*", { capabilities = caps })
|
||||
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable {
|
||||
"lua_ls",
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user