-- Prueft, ob alle genannten Kommandos im PATH liegen. local function have_all(commands) for _, command in ipairs(commands) do if vim.fn.executable(command) == 0 then return false end end return true end return { { "neovim/nvim-lspconfig", dependencies = { "saghen/blink.cmp" }, lazy = false, config = function() local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) -- gilt fuer alle Server und wird mit den serverspezifischen Configs gemerged vim.lsp.config("*", { capabilities = capabilities, }) vim.lsp.config.lua_ls = { settings = { Lua = { runtime = { version = "LuaJIT", }, diagnostics = { globals = { "vim" }, }, workspace = { checkThirdParty = false, library = { vim.env.VIMRUNTIME .. "/lua", vim.fn.stdpath("config") .. "/lua", }, }, telemetry = { enable = false, }, }, }, } vim.lsp.config.clangd = { cmd = { "clangd", "--background-index", "--clang-tidy", "--completion-style=detailed", "--header-insertion=iwyu", "--header-insertion-decorators", "--pch-storage=memory", "--all-scopes-completion", "--inlay-hints", "--function-arg-placeholders", "--fallback-style=llvm", }, } vim.lsp.config.vtsls = { settings = { typescript = { updateImportsOnFileMove = { enabled = "always" }, suggest = { completeFunctionCalls = true, }, inlayHints = { enumMemberValues = { enabled = true }, functionLikeReturnTypes = { enabled = true }, parameterNames = { enabled = "all" }, parameterTypes = { enabled = true }, propertyDeclarationTypes = { enabled = true }, variableTypes = { enabled = false }, }, }, javascript = { suggest = { completeFunctionCalls = true, }, inlayHints = { parameterNames = { enabled = "all" }, }, }, }, } vim.lsp.config.basedpyright = { settings = { basedpyright = { analysis = { diagnosticMode = "openFilesOnly", inlayHints = { callArgumentNames = true, }, typeCheckingMode = "basic", -- oder "strict" für strenger autoSearchPaths = true, useLibraryCodeForTypes = true, }, }, }, } vim.lsp.config.ansiblels = { filetypes = { "yaml.ansible" }, -- Erkennung: siehe config.filetypes settings = { ansible = { python = { interpreterPath = "python3", }, validation = { lint = { enabled = true, path = "ansible-lint", }, }, }, }, } local servers = { "basedpyright", -- npm install -g basedpyright, brew install basedpyright "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck "clangd", -- pkg install llvm "html", -- npm install -g vscode-langservers-extracted "jsonls", -- npm install -g vscode-langservers-extracted "lua_ls", -- pkg install lua-language-server, brew install lua-language-server "prismals", -- npm install -g @prisma/language-server "vtsls", -- npm install -g @vtsls/language-server } if have_all({ "ansible-language-server", "ansible-lint", "ansible" }) then 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 end vim.lsp.enable(servers) end, }, }