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-lua/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " Dependecy for telescope Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " Dependecy for telescope
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } 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' Plug 'WhoIsSethDaniel/toggle-lsp-diagnostics.nvim'
call plug#end() call plug#end()
@ -135,7 +138,6 @@ local on_attach = function(client, bufnr)
local hl = "DiagnosticSign" .. type local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end end
end end
-- set up completion -- 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 -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- 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 for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
capabilities = capabilities, capabilities = capabilities,
@ -205,18 +207,28 @@ for _, lsp in ipairs(servers) do
} }
end end
nvim_lsp["efm"].setup {
-- set up formatting capabilities = capabilities,
-- require "lspconfig".efm.setup { on_attach = on_attach,
-- init_options = {documentFormatting = true}, flags = {
-- settings = { debounce_text_changes = 150,
-- rootMarkers = {".git/"}, },
-- languages = { init_options = {documentFormatting = true},
-- python = { filetypes = { 'sh', 'puppet'},
-- {formatCommand = "yapf --quiet", formatStdin = true}, settings = {
-- {formatCommand = "isort -d -", formatStdin = true} 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 EOF

Loading…
Cancel
Save