Lsp support for bash, python, c and puppet

main
Micke Nordin 2 years ago
parent eac1e2910f
commit 23195e00be
Signed by: micke
GPG Key ID: 0DA0A7A5708FE257

@ -0,0 +1,16 @@
#!/bin/bash
input=${1}
if [[ ${input} == "" ]]; then
input="-"
elif ! [[ -f ${input} ]]; then
echo "Usage: ${0} [puppet file]"
exit 1
fi
tempfile=$(mktemp)
cat "${input}" > "${tempfile}"
puppet-lint --fix "${tempfile}" > /dev/null 2>&1
#puppet-lint --log-format "%{filename}:%{line}:%{column}: %{kind}: %{message}. [%{check}]" ${tempfile} | grep -v warning:
cat "${tempfile}"
rm "${tempfile}"

@ -0,0 +1,3 @@
#!/bin/bash
cd /home/micke/sources/puppet-editor-services/
ruby puppet-languageserver ${@}

@ -13,6 +13,9 @@ Plug 'nvim-lua/plenary.nvim' " Dependecy for telescope
Plug 'nvim-lua/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " Dependecy for telescope
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'rodjek/vim-puppet'
Plug 'mrk21/yaml-vim' " For hieradata
Plug 'vim-ruby/vim-ruby' " For Facts, Ruby functions, and custom providers
Plug 'WhoIsSethDaniel/toggle-lsp-diagnostics.nvim'
call plug#end()
@ -135,7 +138,6 @@ local on_attach = function(client, bufnr)
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
end
-- set up completion
@ -194,7 +196,7 @@ local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protoco
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'pyright', 'pylsp', 'bashls', 'clangd'}
local servers = { 'pylsp', 'clangd', 'puppet', 'bashls'}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
capabilities = capabilities,
@ -205,18 +207,28 @@ for _, lsp in ipairs(servers) do
}
end
-- set up formatting
-- require "lspconfig".efm.setup {
-- init_options = {documentFormatting = true},
-- settings = {
-- rootMarkers = {".git/"},
-- languages = {
-- python = {
-- {formatCommand = "yapf --quiet", formatStdin = true},
-- {formatCommand = "isort -d -", formatStdin = true}
-- }
-- }
-- }
-- }
nvim_lsp["efm"].setup {
capabilities = capabilities,
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
},
init_options = {documentFormatting = true},
filetypes = { 'sh', 'puppet'},
settings = {
rootMarkers = {".git/"},
languages = {
puppet = {
{
formatCommand = 'puppet-fix', formatStdin = true, lintCommand = 'puppet-lint --log-format "%{filename}:%{line}:%{column}: %{kind}: %{message}. [%{check}]"', lintSource = 'puppet-lint', lintFormats= {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}
}
},
sh = {
{
formatCommand = "shfmt -i 2", formatStdin = true, lintCommand = 'shellcheck -f gcc -x', lintSource = 'shellcheck', lintFormats= {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}
}
}
}
}
}
EOF

Loading…
Cancel
Save