Closed bartels closed 2 years ago
Output from workspace.showOutput tsserver
after opening three files with fzf.vim
Prior to 1.9.11
, the log messages only appear one time instead of three.
[Info - 12:44:46 PM] using npm from /usr/bin/npm
[Info - 12:44:46 PM] Forking TSServer
PATH: /home/xxx/dev/tmp/node_modules/typescript/lib/tsserver.js
[Info - 12:44:46 PM] Starting TSServer
{
"path": "/home/xxx/dev/tmp/node_modules/typescript/lib",
"_api": {
"versionString": "4.5.5",
"version": "4.5.5"
}
}
[Info - 12:44:46 PM] using npm from /usr/bin/npm
[Info - 12:44:46 PM] Forking TSServer
PATH: /home/xxx/dev/tmp/node_modules/typescript/lib/tsserver.js
[Info - 12:44:46 PM] Starting TSServer
{
"path": "/home/xxx/dev/tmp/node_modules/typescript/lib",
"_api": {
"versionString": "4.5.5",
"version": "4.5.5"
}
}
[Info - 12:44:46 PM] using npm from /usr/bin/npm
[Info - 12:44:46 PM] Forking TSServer
PATH: /home/xxx/dev/tmp/node_modules/typescript/lib/tsserver.js
[Info - 12:44:46 PM] Starting TSServer
{
"path": "/home/xxx/dev/tmp/node_modules/typescript/lib",
"_api": {
"versionString": "4.5.5",
"version": "4.5.5"
}
}
I think the problem is caused by to the start
method now being an async function, with the await
call to find the tsserver's path.
Reversing the order of these two lines fixes the issue for me, so that Starting
state is set before the await
line.
https://github.com/neoclide/coc-tsserver/blob/464adfcb0a3f5960151b09f1b8d2c2c35ae78e1b/src/server/index.ts#L109-L110
Since version
1.9.11
I notice when I use fzf.vim to open multiple .ts files at once, I get many tsserver instances starting up in parallel. Prior to1.9.11
I correctly have only one instance running. This only happens if no .ts files have been opened yet, and then I open multiple files at once.So far I can only replicate this when using fzf.vim's
File
command, which allows you to mark multiple files to open at once. Opening a single file does not cause any issues, and opening multiple files via the command line, e.g.nvim *.ts
also does not cause the issue.Another thing, when opening multiple files, I can see in the vim-airline statusline, "initializing tsserver 4.5.5" is shown multiple times.
It seems like coc-tsserver is starting multiple instances in parallel, maybe due to some async issue between the two plugins?