typescript-language-server / typescript-language-server

TypeScript & JavaScript Language Server

Home Page:https://www.npmjs.com/package/typescript-language-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tsserver can not detect the corresponding error messages

zlxbuzz opened this issue · comments

I'm using NeoVim NERDTree. When I open a TypeScript file, tsserver can detect the corresponding error messages. However, when I switch files and return to the previous one, any code modifications aren't detected by tsserver until I use LspRestart to trigger a recheck. What could be the reason for this?

Many things could be the reason. Enable LSP logs in your editor and provide them here after reproducing the issue.

Many things could be the reason. Enable LSP logs in your editor and provide them here after reproducing the issue.

When I switch back to the previous TypeScript file, tsserver doesn't detect any code changes. There are no messages in LspLog. At 18:21:21, executing LspRestart resulted in the following output. Other LSPs like css-lsp and json-lsp don't have this issue. I manage my plugins using lazy.nvim.
LspLog:

  [WARN][2023-11-16 17:43:24] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 6): "
  [WARN][2023-11-16 17:49:23] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 7): "
  [WARN][2023-11-16 17:50:35] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 7): "
  [WARN][2023-11-16 17:50:41] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 7): "
  [WARN][2023-11-16 17:50:53] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 7): "
  [START][2023-11-16 18:21:21] LSP logging initiated
  [WARN][2023-11-16 18:21:21] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 9): "
  [WARN][2023-11-16 18:22:46] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 9): "
  [WARN][2023-11-16 18:25:57] .../lua/vim/lsp.lua:1637  "buf_attach_client called on unloaded buffer (id: 9): "

There are logs if your LSP is working.
There will be things logged when opening, editing and all other actions that you do.
I'm asking you to provide the full LSP logs from the time you open the project to the point where you've reproduced the issue.

And I don't know what the:

[WARN][2023-11-16 17:43:24] .../lua/vim/lsp.lua:1637 "buf_attach_client called on unloaded buffer (id: 6

means since that's specific to your editor and not the LSP protocol.

Afterward, I made some attempts and found that when I use version 4.0.0 of the typescript-language-server, the issue no longer occurs. However, when I switch to version 4.1.0 or above, the previous problem arises again. So, I'm wondering if the new versions have made some modifications.

Obviously new versions have new changes.

I've asked about logs. That's the fastest way I can help you.

Obviously new versions have new changes.

I've asked about logs. That's the fastest way I can help you.

Sorry, I checked the Lsp log, but it's too large to pinpoint the issue. I identified the problem through a minimal code configuration. I found that when I set 'set nohidden', the issue arises. However, when I use 'set hidden', the problem disappears. So, could it be a problem caused by buffers?

I don't know what set hidden does. You might want to ask the neovim community or whoever maintains the typescript integration with neovim.