diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-09-09 13:00:29 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-09-09 13:00:29 +0200 |
| commit | ff2aa976d49b5b8d9ddc25ecd08eee8bb96edd72 (patch) | |
| tree | 2f24b2bc1c1011c7704a62c2ed19a0ec78052fda /nvim/lua/plugins | |
| parent | 5eede1a1c740da47fdb2767d8e8f879825b3767c (diff) | |
| download | dotfiles-ff2aa976d49b5b8d9ddc25ecd08eee8bb96edd72.tar.gz dotfiles-ff2aa976d49b5b8d9ddc25ecd08eee8bb96edd72.tar.bz2 dotfiles-ff2aa976d49b5b8d9ddc25ecd08eee8bb96edd72.zip | |
Benutze ansiblels nur wenn alle Programme installiert sind
Diffstat (limited to 'nvim/lua/plugins')
| -rw-r--r-- | nvim/lua/plugins/lsp.lua | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index e0ad450..1e552d4 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | -- Prueft, ob alle genannten Kommandos im PATH liegen. | ||
| 2 | local function have_all(commands) | ||
| 3 | for _, command in ipairs(commands) do | ||
| 4 | if vim.fn.executable(command) == 0 then return false end | ||
| 5 | end | ||
| 6 | |||
| 7 | return true | ||
| 8 | end | ||
| 9 | |||
| 1 | return { | 10 | return { |
| 2 | { | 11 | { |
| 3 | "neovim/nvim-lspconfig", | 12 | "neovim/nvim-lspconfig", |
| @@ -97,6 +106,9 @@ return { | |||
| 97 | filetypes = { "yaml.ansible" }, -- Erkennung: siehe config.filetypes | 106 | filetypes = { "yaml.ansible" }, -- Erkennung: siehe config.filetypes |
| 98 | settings = { | 107 | settings = { |
| 99 | ansible = { | 108 | ansible = { |
| 109 | python = { | ||
| 110 | interpreterPath = "python3", | ||
| 111 | }, | ||
| 100 | validation = { | 112 | validation = { |
| 101 | lint = { | 113 | lint = { |
| 102 | enabled = true, | 114 | enabled = true, |
| @@ -107,8 +119,7 @@ return { | |||
| 107 | }, | 119 | }, |
| 108 | } | 120 | } |
| 109 | 121 | ||
| 110 | vim.lsp.enable({ | 122 | local servers = { |
| 111 | "ansiblels", -- npm install -g @ansible/ansible-language-server & (brew install ansible-lint, pkg install sysutils/py-ansible-lint) | ||
| 112 | "basedpyright", -- npm install -g basedpyright, brew install basedpyright | 123 | "basedpyright", -- npm install -g basedpyright, brew install basedpyright |
| 113 | "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck | 124 | "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck |
| 114 | "clangd", -- pkg install llvm | 125 | "clangd", -- pkg install llvm |
| @@ -117,7 +128,13 @@ return { | |||
| 117 | "lua_ls", -- pkg install lua-language-server, brew install lua-language-server | 128 | "lua_ls", -- pkg install lua-language-server, brew install lua-language-server |
| 118 | "prismals", -- npm install -g @prisma/language-server | 129 | "prismals", -- npm install -g @prisma/language-server |
| 119 | "vtsls", -- npm install -g @vtsls/language-server | 130 | "vtsls", -- npm install -g @vtsls/language-server |
| 120 | }) | 131 | } |
| 132 | |||
| 133 | if have_all({ "ansible-language-server", "ansible-lint", "ansible" }) then | ||
| 134 | table.insert(servers, 1, "ansiblels") -- npm install -g @ansible/ansible-language-server; brew install ansible-lint ansible, pkg install sysutils/py-ansible-lint sysutils/ansible | ||
| 135 | end | ||
| 136 | |||
| 137 | vim.lsp.enable(servers) | ||
| 121 | end, | 138 | end, |
| 122 | }, | 139 | }, |
| 123 | } | 140 | } |
