Open devhik0 opened 1 month ago
Hey there, sorry about this - this seems like an awful experience.
Is this specifically a problem with only editing? Are you seeing an increase in build time as well? I don't suppose you've been able to run the results of your trace via https://github.com/microsoft/typescript-analyze-trace, have you? That will make things easier to diagnose in terms of performance, and will make it easier to understand what is slower now compared to 5.4.
There is also every-ts to help figure out which commit of TypeScript introduced a regression. If you can run that to help diagnose the issue, it would be extremely helpful.
Well actually I am not using TSC to build my project cuz it's a next.js project. As I know it's using swc to build but I don't have problems at build.
Only happens at editing and typing. I am also using vscode if matters. I generated that trace i attached via vscode's tsserver traces.
I checked same thing at another project and another editor and also at another OS :D , only difference was at Neovim with (coc.nvim) TS server LSP. coc-ts
Also at version check i tried both vscode's TS version and my project's version (5.5, 5.4.5) both were same.
What's happening basically:
I am making a mistake at code then I am waiting for diagnostics, meanwhile my fans are buzzing, my CPU and memory usage increasing around 80%, the process continuing and it's not showing anything as solution at intellisense. Even when I correct my mistake, returning back to normal state takes 5-6 sec and my fans and usage becomes same again.
I checked performance profile at vscode, i saw a similar graphic describes that problem.
Here i am sharing what i see while coding: :(
Here is for neovim with coc-tsserver
"C:\Program Files\nodejs\node.EXE" --max-old-space-size=11196 C:\Users\aydin\AppData\Local\coc\extensions\node_modules\coc-tsserver\node_modules\typescript\lib\tsserver.js --useInferredProjectPerProjectRoot --cancellationPipeName C:\Users\aydin\AppData\Local\Temp\coc-tsserver\3956c3a1a44238ae64fa\tscancellation-95086c00069497dac2c0.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
I am okay for high resource consumption for these kind of things, however i dont know why its not ending and showing.
Anything ?
@devhik0 Is it possible that this might be related to #58011 which will be fixed in 5.5.0 through #58398 PR ?
I used 5.5 to write that logs though, still today it's hanging for long minutes like 5min to show a diagnostic
@devhik0 Oh okay. My bad then. It seems unrelated. Apologies for the inconvenience.
No problem @stackyism , i don't think this problem has a solution tbh
Anything?
Anything?
Have you tried using analyze-trace of extendedDiagnostics as mentioned here ?
It actually really helped me find the Hot spots and lead me to exact files which were causing excessive computation in generics.
Hot Spots
├─ Check file [/Volumes/stuff/types.ts]
Note: try and give your extendedDiagnostics command a lot of memory in advance for it to not break.
I am not using TSC @stackyism
I am not using TSC @stackyism
That's completely fine, we don't use it as well, we use nx to run our builds and it does type checking based on plugins. But this tsc usages is just to help with diagnosis and not replace the actual working solution whatever you maybe using.
Does this make sense or am I misunderstanding by what you mean that you don't use TSC ? 🤔
these commands will just need corresponding tsconfig files used to run typescript checking.
Also, just a side note, I meant --generateTrace
flag for analyze-trace and not extendedDiagnostics.
I used following command to output the trace folder
yarn tsc -p myapp/tsconfig.app.json --generateTrace myapp/trace-5.4.5-no-changes
And
yarn analyze-trace myapp/trace-5.4.5-no-changes > diagnostics-no-change.txt
My commands are starting with next
and its using swc. But my problem is with VSCode's typescript server which I can't use any commands to run it @stackyism
My commands are starting with
next
and its using swc. But my problem is with VSCode's typescript server which I can't use any commands to run it
I understand that. As per my understanding, nextJS app should have a tsconfig.json
file in your root folder and there must be a typescript
package with some version in your package.json ?
If you can confirm if both of the above are true, then, you can use your local installed typescript in node_modules to run the above commands. tsc
Would you need help with that ?
:) Thanks for your help but I think I couldn't explain myself much. Think you have vscode, you have some .TS files and editing those. While editing it's taking minutes to show diagnostics. I don't want compile, i am looking for diagnostics
When i make a mistake in my code, my ram usage is increasing much and intellisense is not showing errors/warnings in expected time period like 1-2 sec. Sometimes its hanging and i am waiting for minutes to see its response.
Well actually I am not using TSC to build my project cuz it's a next.js project. As I know it's using swc to build but I don't have problems at build.
Only happens at editing and typing. I am also using vscode if matters. I generated that trace i attached via vscode's tsserver traces.
I checked same thing at another project and another editor and also at another OS :D , only difference was at Neovim with (coc.nvim) TS server LSP. coc-ts
Also at version check i tried both vscode's TS version and my project's version (5.5, 5.4.5) both were same.
What's happening basically:
I am making a mistake at code then I am waiting for diagnostics, meanwhile my fans are buzzing, my CPU and memory usage increasing around 80%, the process continuing and it's not showing anything as solution at intellisense. Even when I correct my mistake, returning back to normal state takes 5-6 sec and my fans and usage becomes same again.
I checked performance profile at vscode, i saw a similar graphic describes that problem.
Here i am sharing what i see while coding: :(
Here is for neovim with coc-tsserver
"C:\Program Files\nodejs\node.EXE" --max-old-space-size=11196 C:\Users\aydin\AppData\Local\coc\extensions\node_modules\coc-tsserver\node_modules\typescript\lib\tsserver.js --useInferredProjectPerProjectRoot --cancellationPipeName C:\Users\aydin\AppData\Local\Temp\coc-tsserver\3956c3a1a44238ae64fa\tscancellation-95086c00069497dac2c0.tmp* --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation --useNodeIpc
I am okay for high resource consumption for these kind of things, however i dont know why its not ending and showing.
Also check this @stackyism
Okay. So, it looks like I understand why this might be confusing.
As per the above messages, you're facing issues with Visual code not providing proper typescript intellisense due to huge computation time. Intellisense basically keeps checking your code for typescript error through ts-server which keeps compiling your code and gives you errors or recommendations.
Now, I'll just try to iterate how I wanted to help.
tsc --generateTrace
& analyze-trace
.Does this make sense or maybe I've completely misunderstood the problem here ? But this is the best I could try to help.
Do you have discord, i want to show you what I want actually @stackyism
Do you have discord, i want to show you what I want actually @stackyism
Yes. I've joined typescript discord server and have user name saagar.takhi8606
.
I sent request on discord, please accept that @stackyism
I wish to discuss this with Mr.Hejlsberg, wondering his ideas always :)
Anything?
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
No response
💻 Code
🙁 Actual behavior
When i make a mistake in my code, my ram usage is increasing much and intellisense is not showing errors/warnings in expected time period like 1-2 sec. Sometimes its hanging and i am waiting for minutes to see its response. Not sure but i think that error below is causing that performance issues.
🙂 Expected behavior
At mistakes, seeing errors/warnings in short period.
Additional information about the issue
When i check logs and traces i am seeing a lot different packages are downloading while the error-checking continues. Like this:
Trace-20240610T183642.json
Also at this process:
C:\Program Files\nodejs\node.exe" --max-old-space-size=12000 "c:\Users\aydin\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js" --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName C:\Users\aydin\AppData\Local\Temp\vscode-typescript\465f576e122de7f00782\tscancellation-f24a4ea23cca8e2de700.tmp* --traceDirectory "\"c:\Users\aydin\AppData\Roaming\Code - Insiders\logs\20240610T180039\window1\exthost\vscode.typescript-language-features\tsserver-log-7zZxSQ\"" --locale en --noGetErrOnBackgroundUpdate --canUseWatchEvents --validateDefaultNpmLocation 504.904 K
there is around 500mb memory usage, even i give 12GB to it.I could say i cant code because of these kind of problems.