Closed Zefling closed 3 years ago
@Zefling
Thanks for your feedback!
Could you provide the code snippet or a link to the source file that causing the issue? In my end (MacBook Pro) it takes ~100ms to format a 150-line TS file with 30 lines of imports.
You should be able to find out the exact time used when formatting a file in the Output channel for this extension:
Hope that helps!
I have this problem a workspace with a lot of projects. If I remove this extension, the slowdowns disappear. On a new workspace, not problem. It's strange.
Could you setup a shared workspace so I can reproduce the issue?
The workspace with project isn't possible because it's not a open source projects. :(
Looks like the first log (after resolving your configuration) took a long time to show. That could be because:
Reinstalling the extension might fix A and C if it's an env setup issue. If not, it's most likely an I/O issue because this extension reads config from various sources, e.g package.json, tsconfig.json, Prettier's config, EditorConfig's config, etc. Reboot your computer or try on another one to see if it's a lock/disk issue.
Edit: I released a new version (3.1.0) with improved logs. It will output a log before configuration resolution so may help to justify A and C without reinstalling.
With the new log:
[2020-11-30T10:08:56.442] [INFO] formatDocument - Start formatting fileName: c:\xxxxxx\xxxx.ts
[2020-11-30T10:09:04.188] [INFO] formatDocument - Resolved config: {
I find this:
[2020-11-30 10:11:45.885] [renderer3] [warning] UNRESPONSIVE extension host, 'dozerg.tsimportsorter' took 100% of 3620.362ms, saved PROFILE here: 'c:\Users\CVEYSS~1\AppData\Local\Temp\exthost-a5edd4.cpuprofile' [{"id":"dozerg.tsimportsorter","total":3610140,"percentage":100},{"id":"eamodio.gitlens","total":235,"percentage":0},{"id":"gc","total":6140,"percentage":0},{"id":"self","total":975,"percentage":0},{"id":"vscode.merge-conflict","total":769,"percentage":0},{"id":"vscode.typescript-language-features","total":1771,"percentage":0}]
@Zefling Thanks for your helpful logs!
I've released a new revision (3.1.1) with more logs into config resolution. Could you try and share your new logs here?
Hi @Zefling,
From v4.1.0, you can switch on/off Debug Mode in User Settings. Maybe it can help you find useful logs if the issue appears again.
Thanks!
With the last version :
[2020-12-16T17:18:30.214] [INFO] vscode.resolveConfig - Start resolving configs for fileName: c:\<path>\<file>.component.ts, languageId: typescript
[2020-12-16T17:18:30.217] [DEBUG] config.loadVscConfig - Finish loading VSC config
[2020-12-16T17:18:30.217] [DEBUG] config.loadImportSorterConfig - Load Prettier/EditorConfig config.
[2020-12-16T17:18:30.218] [INFO] config.loadPretConfig - Prettier API version: 2.2.1
[2020-12-16T17:18:30.239] [DEBUG] config.loadImportSorterConfig - Load import-sorter config from C:\Users\XXXX\AppData\Roaming\Code\User\import-sorter.json
[2020-12-16T17:18:30.240] [DEBUG] config.loadImportSorterConfig - Load package.json config.
[2020-12-16T17:18:30.242] [DEBUG] config.loadESLintConfig - Start loading ESLint config for filePath: c:\<path>\<file>.component.ts
[2020-12-16T17:18:30.242] [INFO] config.loadESLintConfig - ESLint API version: 7.15.0
[2020-12-16T17:18:30.263] [WARN] config.loadESLintConfig - Failed loading ESLint config: No ESLint configuration found in c:\<path>.
[2020-12-16T17:18:30.263] [DEBUG] config.loadTsConfig - Find TS config for fileName: c:\<path>\<file>.component.ts
[2020-12-16T17:18:30.264] [DEBUG] config.loadTsConfig - Load TS config for fileName: c:\<path>\<file>.component.ts
[2020-12-16T17:18:38.381] [DEBUG] vscode.resolveConfig - Finish resolving configs.
[2020-12-16T17:18:38.382] [DEBUG] formatDocument - Start formatting fileName: c:\<path>\<file>.component.ts
[2020-12-16T17:18:38.382] [INFO] parser.formatSource - config: {
Thanks for your logs, @Zefling !
Looks like the issue is tsconfig.json
loading.
Currently, I'm not sure about the root cause as your config worked fine in my laptop. But I'll keep watching it.
If you find more clues, please let me know and I'll appreciate it!
For what it's worth, I also have a codebase that experiences this slowness.
@JohnLouderback Thanks for the feedback!
Is it possible that I can access the codebase? Or can you make a demo project to reproduce the issue?
@Zefling and @JohnLouderback - Are you still having the performance issue? There is another issue that might be related and I've fixed it, so I'll close this one. Feel free to re-open it if you have more questions. Thanks!
Sorry, I'm no longer working on the problematic project. I haven't noticed the problem on other projects. It is possible that it is a problem of workspace.
Describe the bug Save is much slower when the extension is enabled
To Reproduce Just use save
Expected behavior A save that is done without too much slowing down.
Actual behavior The save is slow, in some cases it is necessary to do 2 saves.
OS (please complete the following information):
VS Code (please complete the following information):
tsconfig.json (if any)
.editorconfig (if any)
Installed VS Code extensions