From b9d65bd05a3c25874cf061fa364b04790114a563 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Sun, 15 Jun 2025 20:37:59 -0700 Subject: [PATCH] Install luasnip for LSP support Install and configure LSP for helm and ansible --- .config/nvim/lua/plugins/completions.lua | 84 ++++++++++---------- .config/nvim/lua/plugins/language-server.lua | 10 ++- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/.config/nvim/lua/plugins/completions.lua b/.config/nvim/lua/plugins/completions.lua index 615a8f5..a22bb3a 100644 --- a/.config/nvim/lua/plugins/completions.lua +++ b/.config/nvim/lua/plugins/completions.lua @@ -1,45 +1,45 @@ return { --- { --- "L3MON4D3/LuaSnip", --- dependencies = { --- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp --- "rafamadriz/friendly-snippets", -- Collection of snippets --- }, --- }, - { - "hrsh7th/nvim-cmp", - config = function() --- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets - local cmp = require("cmp") + { + "L3MON4D3/LuaSnip", + -- dependencies = { + -- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp + -- "rafamadriz/friendly-snippets", -- Collection of snippets + -- }, + }, + { + "hrsh7th/nvim-cmp", + config = function() + -- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets + local cmp = require("cmp") - cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - require("luasnip").lsp_expand(args.body) -- For `luasnip` users. - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = 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" }, -- Show suggestions from LSP - { name = "luasnip" }, -- For luasnip users. - }, { - { name = "buffer" }, - }), - }) - end, - }, - { - "hrsh7th/cmp-nvim-lsp", - }, + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = 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" }, -- Show suggestions from LSP + { name = "luasnip" }, -- For luasnip users. + }, { + { name = "buffer" }, + }), + }) + end, + }, + { + "hrsh7th/cmp-nvim-lsp", + }, } diff --git a/.config/nvim/lua/plugins/language-server.lua b/.config/nvim/lua/plugins/language-server.lua index c31df54..24488c3 100644 --- a/.config/nvim/lua/plugins/language-server.lua +++ b/.config/nvim/lua/plugins/language-server.lua @@ -16,6 +16,8 @@ return { "hadolint", "yamllint", "gh-actions-language-server", + "ansible-language-server", + "ansible-lint", }, }) end, @@ -28,7 +30,7 @@ return { ensure_installed = { "lua_ls", "bashls", - --"helm_ls", + "helm_ls", "jsonls", "nginx_language_server", "basedpyright", @@ -78,7 +80,10 @@ return { filetypes = { "sh", "bash" }, }) 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.basedpyright.setup({ capabilities = capabilities, @@ -104,6 +109,7 @@ return { }, }) lspconfig.yamlls.setup({ capabilities = capabilities }) + lspconfig.ansiblels.setup({ capabilities = capabilities }) vim.keymap.set("n", "vd", vim.lsp.buf.hover, { desc = "View Docstring" }) vim.keymap.set("n", "gt", vim.lsp.buf.definition, { desc = "Go To Definition" }) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" })