Closed excalios closed 1 year ago
It's difficult to reproduce the slow type issue. What's your TypeScript version? What's the size of your project? I'm using the coc-tsserver to work on the coc.nvim project, I think it's big enough, didn't came across the slowness .
You can take a look at the projects here I'm unsure as to why it happens not sure if it's my neovim config or tsconfig. My updatetime is 50 I'm on nvim 0.5.1
I just checked this and does this have anything to do with it? The "trying to cancel ongoing request with sequence number x". Edit: Something I also realized if I tried to make an error in my case I deleted an import and then deleted another import like around 9-10 seconds mark. Which a few seconds after it usually is when the diagnostics show up. It actually gave an error for both the import. So it's like it's not it read the errors slow. But, it's more like it waits for around 10 seconds and then tell the tsserver to check it? I'm not sure though just speculation.
I tried clearing my config and just using coc just in case it's with other plugins. I tried with nvim nightly also and there's no difference.
Edit 2: I just tried deleting an import and tried to get an auto complete or just typing like simple things like console.log. But I tried to type cons and wait for completion to showup. I got tsserver-timeout instead
So I think I found the problem but I don't know how to fix it. I keep trying to find what's wrong by deleting an import and then undoing it. I found it's not all the files that are slow it's only model.ts files. I thought at first it was because of the import of other model.ts files which is partially true. I thought it has something to do with the class or because of extending objection model. Like it was too big or something. I found that it's this part of the code
When importing other model.ts for the modelClass on this part of the code it became really slow. If I remove this part of the code and import the models it works just fine. I don't know why it's like this but on vscodium it works just fine no performance problem. On my older projects too it's just fine there's no problem at all.
Should be problem of your language server, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel
We've add tsserver.enableTracing
support, you can find trace file by checkout the output of tsserver.
The tsserver could be slow after some time, use latest typescript > 4.9 and disable logging of tsserver should helps.
"tsserver.log": "off",
"tsserver.trace.server": "off",
big thanks @chemzqm
update Typescript to 4.9.3 solved the diagnostic issue
ts server has been very slow whether it is showing diagnostics or autocomplete suggestions and etc.
I tried it by deleting an import statement and the diagnostics error showed 13 seconds after as the picture above. Even autocomplete showed very slowly sometimes auto import doesn't even work at all. I am genuinely not sure why. I tried deleting watchman there's no noticeable change. Tried coding on vscodium and it works fine and fast.