williamboman / mason-lspconfig.nvim

Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.
Apache License 2.0
2.68k stars 164 forks source link

tsserver has been renamed to ts_ls in nvim-lspconfig #458

Closed ic-768 closed 1 week ago

ic-768 commented 1 week ago

Problem description

Per https://github.com/neovim/nvim-lspconfig/pull/3232,

if you install tsserver through mason-lspconfig, then you will get a deprecation warning from nvim-lspconfig telling you to rename it to ts_ls.

Why do you think this is an issue with mason-lspconfig.nvim?

If it's not, then I'm mistaken and I'm sorry

Neovim version (>= 0.7)

11

Operating system/version

Ubuntu

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

Affected language servers

tsserver

Steps to reproduce

snippet:

require("mason").setup()
require("mason-lspconfig").setup({
    ensure_installed = {
        "tsserver",
    },
})

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

require("mason-lspconfig").setup_handlers({
    function(server_name)
        local capabilities = require("cmp_nvim_lsp").default_capabilities()
        require("lspconfig")[server_name].setup({
            capabilities = capabilities,
        })
    end,
})

Actual behavior

Deprecation error

Expected behavior

No deprecation error

LspInfo

x

LspLog

No response

Healthcheck

x

Screenshots or recordings

No response

Integralist commented 1 week ago

Yup, I just stumbled into this.

So I deleted the installed tsserver binary via Mason, and then updated my nvim config to replace tsserver with ts_ls but now I get the warning...

[mason-lspconfig.nvim] Server "ts_ls" is not a valid entry in ensure_installed. Make sure to only provide lspconfig server names.

I realise this is because Mason hasn't been updated to reflect the change and so I can't actually install ts_ls via Mason.

ic-768 commented 1 week ago

Yup, I just stumbled into this.

So I deleted the installed tsserver binary via Mason, and then updated my nvim config to replace tsserver with ts_ls but now I get the warning...

[mason-lspconfig.nvim] Server "ts_ls" is not a valid entry in ensure_installed. Make sure to only provide lspconfig server names.

I realise this is because Mason hasn't been updated to reflect the change and so I can't actually install ts_ls via Mason.

if it's of any help until this gets resolved, you can see how i handled the name change in my config here.

mke21 commented 1 week ago

I cannot change it, MasonUninstall tsserver gives the error "tsserver is not a valid package. So does MasonInstall ts_ls: "ts_ls" is not a valid package.

What to do?

muazong commented 1 week ago

run this command in your terminal: npm install -g typescript-language-server typescript

config file: local lspconfig = require("lspconfig") lspconfig["ts_ls"].setup({})

rendi12345678 commented 1 week ago

run this command in your terminal: npm install -g typescript-language-server typescript

config file: local lspconfig = require("lspconfig") lspconfig["ts_ls"].setup({})

it works perfectly, thanks :)