hinell / lsp-timeout.nvim

Start/stop LSP servers upon demand; keeps RAM usage low
Other
211 stars 6 forks source link

tsserver not restarting after switching from `jose-elias-alvarez/typescript.nvim` to `pmizio/typescript-tools.nvim` #12

Closed ls-devs closed 11 months ago

ls-devs commented 11 months ago

Summary

EDIT : After some investigations tsserver is restarted, but the LSP typescript-tools is not. EDIT 2 _It seems that lua_ls doesn't restart too. Can it be related to the fact that it is handled by lsp-zero ? Or by the latest update of lsp-timeout?_

Before switching from jose-elias-alvarez/typescript.nvim to pmizio/typescript-tools.nvim tsserver was restarting without any problems. Now it wont restart.

If it can help, here's typescript-tools config :

local M = {}

M.config = function()
  local lsp_zero = require("lsp-zero")
  lsp_zero.extend_lspconfig()
  require("typescript-tools").setup({
    settings = {
      tsserver_file_preferences = {
        includeInlayParameterNameHints = "all",
        includeCompletionsForModuleExports = true,
        includeInlayParameterNameHintsWhenArgumentMatchesName = true,
        includeInlayFunctionParameterTypeHints = true,
        includeInlayVariableTypeHints = true,
        includeInlayVariableTypeHintsWhenTypeMatchesName = true,
        includeInlayPropertyDeclarationTypeHints = true,
        includeInlayFunctionLikeReturnTypeHints = true,
        includeInlayEnumMemberValueHints = true,
      },
      tsserver_format_options = {
        allowIncompleteCompletions = false,
        allowRenameOfImportPath = true,
      },
      separate_diagnostic_server = true,
      publish_diagnostic_on = "insert_leave",
      expose_as_code_action = {},
      tsserver_max_memory = "auto",
      tsserver_locale = "fr",
      complete_function_calls = true,
      include_completions_with_insert_text = true,
      code_lens = "all",
      disable_member_code_lens = true,
    },
  })
end

return M

Steps to reproduce

I don't have any steps to reproduce the issue, all I can give you is my neovim configuration if you want to try. You can find it here : ls-devs/nvim

Versions

NVIM v0.10.0-dev-1413+g684e93054-dirty Build type: RelWithDebInfo LuaJIT 2.1.1697887905

hinell commented 11 months ago

@ls-devs Have you updated to v1.1.0?

ls-devs commented 11 months ago

@ls-devs Have you updated to v1.1.0?

@hinell Yes, of course.

hinell commented 11 months ago

https://github.com/hinell/lsp-timeout.nvim/assets/8136158/3ac7ab95-361d-4a35-b57b-0910af42da9f

I've tried to run tsx project. It works fine.

Did you call lspconfig["typescript-tools"].setup()? Did you replace lspconfig.tsserver.setup with the following?:

-   lspconfig.tsserver.setup({ on_attach = on_attach })
+   require("typescript-tools").setup({})
+   lspconfig["typescript-tools"].setup({
+       -- ... your config
+   })

What does :set ft? reports on typescript files in your project? I would suggest to specify more filetypes, so tsx files are hooked up by lspconfig.

-- Put this into plugin spec `config = function()` body:
require("typescript-tools").setup({})
lspconfig["typescript-tools"].setup({
    filetypes = {
        "javascript",
        "js",
        "jsx",
        "ts",
        "tsx",
        "typescript",
        "javascriptreact",
        "javascript.jsx",
        "typescript",
        "typescriptreact",
        "typescript.tsx",
    }

})
ls-devs commented 11 months ago

I can confirm it's working with the configuration you give me. I forgot to add

  require("lspconfig")["typescript-tools"].setup({
    filetypes = {
      "javascript",
      "js",
      "jsx",
      "ts",
      "tsx",
      "typescript",
      "javascriptreact",
      "javascript.jsx",
      "typescript",
      "typescriptreact",
      "typescript.tsx",
    },
  })

Couldn't find any mention of setting up typescript-tools with lspconfig, but found that we must disable tsserver. Sorry for bothering with this issue since there's nothing to do with lsp-timeout here .

Btw, appreciate your work and the changes you made about the focusable windows.

hinell commented 11 months ago

Reflected in docs: https://github.com/hinell/lsp-timeout.nvim/commit/f3294c0fc2590dd019eca4a9c4466be42bce82e6 Close this issue if it's restarting LSPs as expected.

Couldn't find any mention of setting up typescript-tools

Fill a bug report out there.

Btw, appreciate your work

Took me entire day to upgrade it. There should be zero requirements for efforts to maintain this plugin. So less config is more.