WhoIsSethDaniel/mason-tool-installer.nvim

Error with MasonToolsUpdate

kassio opened this issue · 2 comments

Error executing Lua callback: ...pack/packer/start/mason.nvim/lua/mason-registry/init.lua:69: Cannot find package "bashls".
stack traceback:
        [C]: in function 'error'
        ...pack/packer/start/mason.nvim/lua/mason-registry/init.lua:69: in function 'get_package'
        ...on-tool-installer.nvim/lua/mason-tool-installer/init.lua:53: in function 'check_install'
        ...ason-tool-installer.nvim/plugin/mason-tool-installer.lua:6: in function <...ason-tool-installer.nvim/plugin/mason-tool-installer.lua:5>

My config:

local servers = {
  'bashls',
  'cssls',
  'gopls',
  'golangci_lint_ls',
  'graphql',
  'html',
  'jsonls',
  'solargraph',
  'sqlls',
  'sqls',
  'sumneko_lua',
  'tailwindcss',
  'vimls',
  'vuels',
  'yamlls',
}

require('mason').setup({
  ui = {
    border = 'none',
    icons = {
      server_installed = theme.icons.info,
      server_pending = theme.icons.warn,
      server_uninstalled = theme.icons.error,
    },
  },
})

require('mason-lspconfig').setup()

require('mason-tool-installer').setup({
  ensure_installed = servers,
  auto_update = false,
  run_on_start = false,
})

Ohh I noticed that we install the server as bash-language-server but lspconfig uses it as bashls.

I was trying to use the same name to install and configure the lsp server.

As you found out you must use the Mason name for the server you wish to install. If you don't, Mason throws the error you were seeing.

You can see the mapping of lspconfig server name to mason name here: https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md