Install luasnip for LSP support
Install and configure LSP for helm and ansible
This commit is contained in:
parent
b8772ae9b4
commit
b9d65bd05a
2 changed files with 50 additions and 44 deletions
|
@ -1,45 +1,45 @@
|
||||||
return {
|
return {
|
||||||
-- {
|
{
|
||||||
-- "L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
-- dependencies = {
|
-- dependencies = {
|
||||||
-- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp
|
-- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp
|
||||||
-- "rafamadriz/friendly-snippets", -- Collection of snippets
|
-- "rafamadriz/friendly-snippets", -- Collection of snippets
|
||||||
-- },
|
-- },
|
||||||
-- },
|
},
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
config = function()
|
config = function()
|
||||||
-- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets
|
-- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
-- REQUIRED - you must specify a snippet engine
|
-- REQUIRED - you must specify a snippet engine
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
completion = cmp.config.window.bordered(),
|
completion = cmp.config.window.bordered(),
|
||||||
documentation = cmp.config.window.bordered(),
|
documentation = cmp.config.window.bordered(),
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-PageUp>"] = cmp.mapping.scroll_docs(-4),
|
["<C-PageUp>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-PageDown>"] = cmp.mapping.scroll_docs(4),
|
["<C-PageDown>"] = cmp.mapping.scroll_docs(4),
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<C-e>"] = cmp.mapping.abort(),
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" }, -- Show suggestions from LSP
|
{ name = "nvim_lsp" }, -- Show suggestions from LSP
|
||||||
{ name = "luasnip" }, -- For luasnip users.
|
{ name = "luasnip" }, -- For luasnip users.
|
||||||
}, {
|
}, {
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ return {
|
||||||
"hadolint",
|
"hadolint",
|
||||||
"yamllint",
|
"yamllint",
|
||||||
"gh-actions-language-server",
|
"gh-actions-language-server",
|
||||||
|
"ansible-language-server",
|
||||||
|
"ansible-lint",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
@ -28,7 +30,7 @@ return {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
"bashls",
|
"bashls",
|
||||||
--"helm_ls",
|
"helm_ls",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
"nginx_language_server",
|
"nginx_language_server",
|
||||||
"basedpyright",
|
"basedpyright",
|
||||||
|
@ -78,7 +80,10 @@ return {
|
||||||
filetypes = { "sh", "bash" },
|
filetypes = { "sh", "bash" },
|
||||||
})
|
})
|
||||||
lspconfig.gh_actions_ls.setup({ capabilities = capabilities })
|
lspconfig.gh_actions_ls.setup({ capabilities = capabilities })
|
||||||
-- lspconfig.helm_ls.setup({ capabilities = capabilities })
|
lspconfig.helm_ls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
filetypes = { "tpl", "helm"},
|
||||||
|
})
|
||||||
lspconfig.jsonls.setup({ capabilities = capabilities })
|
lspconfig.jsonls.setup({ capabilities = capabilities })
|
||||||
lspconfig.basedpyright.setup({
|
lspconfig.basedpyright.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
@ -104,6 +109,7 @@ return {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
lspconfig.yamlls.setup({ capabilities = capabilities })
|
lspconfig.yamlls.setup({ capabilities = capabilities })
|
||||||
|
lspconfig.ansiblels.setup({ capabilities = capabilities })
|
||||||
vim.keymap.set("n", "<leader>vd", vim.lsp.buf.hover, { desc = "View Docstring" })
|
vim.keymap.set("n", "<leader>vd", vim.lsp.buf.hover, { desc = "View Docstring" })
|
||||||
vim.keymap.set("n", "<leader>gt", vim.lsp.buf.definition, { desc = "Go To Definition" })
|
vim.keymap.set("n", "<leader>gt", vim.lsp.buf.definition, { desc = "Go To Definition" })
|
||||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" })
|
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue