Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find package "ts_ls" #1784

Open
3 tasks done
make-github-pseudonymous-again opened this issue Sep 5, 2024 · 7 comments
Open
3 tasks done

Cannot find package "ts_ls" #1784

make-github-pseudonymous-again opened this issue Sep 5, 2024 · 7 comments

Comments

@make-github-pseudonymous-again

I've searched open issues for similar requests

  • Yes

I've manually reviewed logs to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim

  • Yes

Problem description

Since neovim/nvim-lspconfig#3232, the correct server name for TypeScript is ts_ls instead of tsserver.

Replacing tsserver with ts_ls produces the following error:

Error executing vim.schedule lua callback: ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:80: Cannot find package "ts_ls".
stack traceback:                                                                                                                                          
        [C]: in function 'error'                                                                                                                          
        ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:80: in function 'get_package'                                                         
        ...on-tool-installer.nvim/lua/mason-tool-installer/init.lua:166: in function 'callback'                                                           
        ...share/nvim/lazy/mason.nvim/lua/mason-core/async/init.lua:87: in function 'step'                                                                
        ...share/nvim/lazy/mason.nvim/lua/mason-core/async/init.lua:96: in function 'run'                                                                 
        ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:202: in function 'refresh'                                                            
        ...on-tool-installer.nvim/lua/mason-tool-installer/init.lua:195: in function ''                                                                   
        vim/_editor.lua: in function ''                                                                                                                   
        vim/_editor.lua: in function <vim/_editor.lua:0>

Expected behavior

No error.

Steps to reproduce

require('mason-tool-installer').setup { ensure_installed = { ts_ls = {} }

Affected packages

No idea.

Neovim version (>= 0.7)

Not willing to disclose

Operating system/version

Not willing to disclose

Healthcheck

Not willing to disclose

Screenshots or recordings

No response

@gavink97
Copy link

gavink97 commented Sep 6, 2024

Here's a temporary work around

require('mason-lspconfig').setup({
    ensure_installed = {
        "tsserver"
    },
    handlers = {
        function (server_name)
            if server_name == "tsserver" then
                server_name = "ts_ls"
            end

@Th3C0deWizard
Copy link

Here's a temporary work around

require('mason-lspconfig').setup({
    ensure_installed = {
        "tsserver"
    },
    handlers = {
        function (server_name)
            if server_name == "tsserver" then
                server_name = "ts_ls"
            end

That does not work for me :C, I get the following warning: [lspconfig] Cannot acces configuration for ls_ts. Ensure this server is listed in server_configurations.md or added as a custom server.

@williamokano
Copy link

Getting the same error. After nvim-lspconfig added the deprecation from tsserver to ts_ls, it started showing the error message that tsserver is deprecated and I should use ts_ls instead. When I change the tool to ts_ls in mason ensure_installed, it says that it doesn't exist.

williamokano added a commit to williamokano/dotfiles that referenced this issue Sep 6, 2024
@joshwashywash
Copy link

joshwashywash commented Sep 7, 2024

Here's a temporary work around

require('mason-lspconfig').setup({
    ensure_installed = {
        "tsserver"
    },
    handlers = {
        function (server_name)
            if server_name == "tsserver" then
                server_name = "ts_ls"
            end

another temporary fix could be

local lspconfig = require('lspconfig')

require('mason-lspconfig').setup({
    ensure_installed = {
        'tsserver',
        -- others...
    },
    handlers = {
      -- default handler
      function(server_name)
        lspconfig[server_name].setup({})
      end,
      tsserver = function()
        lspconfig.ts_ls.setup({})
      end,
      -- other specific handlers...
    },
})

hopefully i typed that correctly.

@joshwashywash
Copy link

it looks like ts_ls is now available in the list of available lsps if you run :Mason on the command line. just update your packages and do the normal routine

local lspconfig = require('lspconfig')

require('mason-lspconfig').setup({
  ensure_installed = {
    'ts_ls',
    -- others
  },
  handlers = {
    function(server_name)
      lspconfig[server_name].setup({})
    end
  }
})

Screenshot 2024-09-08 at 10 20 00 AM

ts_ls is on the bottom.

hbibel added a commit to hbibel/neovim-config that referenced this issue Sep 9, 2024
@make-github-pseudonymous-again
Copy link
Author

I confirm I no longer encounter this error. TypeScript LS working as expected.

@tenlisboa
Copy link

@joshwashywash It worked fine over here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants