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

fix(tsserver-deprecation): use ts_ls where tsserver is being used in lspconfig #89

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nitishlobo
Copy link

This PR addresses the following error when opening nvim:
"tsserver is deprecated, use ts_ls instead. Feature will be removed in lspconfig 0.2.0"

The issue was raised here:
#88

The solution was given here:
neovim/nvim-lspconfig#3232 (comment)

Note that you may need to do a reload of the related plugins:
:Lazy reload mason.nvim mason-lspconfig.nvim mason-tool-installer.nvim

@nitishlobo
Copy link
Author

@Mccranky83
Copy link

Mccranky83 commented Sep 6, 2024

If the problem resides in the fact that lspconfig renamed tsserver to ts_ls while no package under the name ts_ls is available in mason yet, why not just change the following section of the config instead?

-- default handler for installed servers
function(server_name)
  lspconfig[server_name].setup({
    capabilities = capabilities,
  })
end,
-- mason still installs `tsserver`
["tsserver"] = function()
  -- lspconfig sees `ts_ls`
  lspconfig["ts_ls"].setup({
    capabilities = capabilities,
    ...
end,

The result of :checkhealth run seems to confirm that this works:

vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /Users/Mccranky/.local/state/nvim/lsp.log
- Log size: 9460 KB

vim.lsp: Active Clients ~
- ts_ls (id: 1)
    Root directory: nil
    Command: /Users/Mccranky/.local/share/nvim/mason/bin/typescript-language-server --stdio
    Settings: vim.empty_dict()
    Attached buffers: 1
- emmet_ls (id: 2)
    Root directory: nil
    Command: /Users/Mccranky/.local/share/nvim/mason/bin/emmet-ls --stdio
    Settings: vim.empty_dict()
    Attached buffers: 1
- copilot (id: 3)
    Command: node /Users/Mccranky/.local/share/nvim/lazy/copilot.lua/copilot/index.js
    Settings: {
      advanced = {
        inlineSuggestCount = 3,
        listCount = 10
      }
    }
    Attached buffers: 1, 6

Copy link

@isandesh7 isandesh7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the change. I'm still getting ERROR -

  1. Pasted the contents of the modified file as is.
  2. Ran the provided reload command
  3. Restarted nvim
  4. Observed same issue.
[mason-lspconfig.nvim] Server "tsserver" is not a valid entry in ensure_installed. Make sure to only p
rovide lspconfig server names.


changing this to
ts_ls worked.

@Mccranky83
Copy link

I tested the change. I'm still getting ERROR -

  1. Pasted the contents of the modified file as is.
  2. Ran the provided reload command
  3. Restarted nvim
  4. Observed same issue.
[mason-lspconfig.nvim] Server "tsserver" is not a valid entry in ensure_installed. Make sure to only p
rovide lspconfig server names.

changing this to
ts_ls worked.

image
Yes, just found out that mason has also renamed tsserver to ts_ls, so it's easy to use telescope to find and replace every tsserver with ts_ls.

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

Successfully merging this pull request may close these issues.

3 participants