diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua index 6aeeeb6..b5ba7db 100644 --- a/lua/plugins/completions.lua +++ b/lua/plugins/completions.lua @@ -33,28 +33,41 @@ return { config = function() require('mason').setup() - require('mason-lspconfig').setup({ - automatic_installation = false, - ensure_installed = { + local ensure_installed = { + -- Language servers + 'clangd', -- C/C++ + 'cmake', -- CMake + 'lua_ls', -- Lua + 'opencl_ls', -- OpenCL + } + if vim.fn.executable('npm') == 1 then + local npm_ensure_installed = { -- Language servers 'ansiblels', -- Ansible 'bashls', -- Bash - 'clangd', -- C/C++ - 'cmake', -- CMake 'docker_compose_language_service', -- Docker Compose 'dockerls', -- Dockerfile - 'esbonio', -- Sphinx 'html', -- HTML 'jsonls', -- JSON - 'lemminx', -- XML - 'lua_ls', -- Lua - 'opencl_ls', -- OpenCL - 'powershell_es', -- Powershell - 'pyright', -- Python - 'ruff_lsp', -- Python 'vimls', -- VimScript 'yamlls', -- YAML - }, + } + for _, package in ipairs(npm_ensure_installed) do + table.insert(ensure_installed, package) + end + end + -- TODO: Where to put these? + -- Language servers + -- 'esbonio', -- Sphinx + -- 'pyright', -- Python + -- 'ruff_lsp', -- Python + -- 'lemminx', -- XML + if vim.fn.has('win32') then + table.insert(ensure_installed, 'powershell_es') + end + require('mason-lspconfig').setup({ + automatic_installation = false, + ensure_installed = ensure_installed, handlers = { -- Default handler, sets up everything unless a custom language server