-
-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSCode: Formatter slow or freezes if jsconfig.json is present in project #659
Comments
Can you try adding include and exclude (https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) We'll exclude node_modules and dist file by default if there's no tsconfig or jsconfig. |
Maybe #639 somehow has bad side effects, running too often/taking too long in this case? Is your |
I changed exclude to this and now it seems to work better, if I reload the editor the first formatting is still slow but all subsequent ones run as expected now (at least for the last half an hour I've been testing it). {
"exclude": ["node_modules", "**/node_modules", "dist"]
} It's a rather old and large project where functionality in the CMS are built as seperate modules that are completely self contained, so they all got their own node_modules folder and package.json to handle dependencies for that module.
Just introduced Svelte a couple of months ago and it's been working really well up until now. |
527 is still a lot to me. It's really a large app. Noted most of the formating performance isssue reported is not actually a formating issue but a more general performance issue. It's just formating is easier to spot. We probably still needs to tweak the performance here and there. |
I guess most of those files are from the other projects. Because there's only the jsconfig at the root, everything's loaded even if not needed. I also think we cannot do much there. The initial load is most likely the TS service reading the config file and then scanning and loading all the js/ts files initially. Since that's synchronous we are essentially blocked from doing anything else. |
Yes, it's a rather large website that's a couple of years old with ongoing development. Excluding node_modules folders deeper in the structure seems to have solved my problem for now. Have had the same jsconfig file for years in the project without any problems before, it was last edited 2 years ago. If you don't need to reference this issue for performance tweaking we could probably close it |
I don't think it's related to your issue, but I'm getting some pretty bad freezy laggy behaviors as well. |
It seems like it's always a step or a change behind or something? Reporting errors is pretty inconsistent. |
I need more info about your project and the situation it occurs in.
If the repo is not private it would be great if I could have a look. |
I was trying to not open a separate issue unnecessarily, but I think my issue might be different enough that it calls for one. I'll try to make a minimal repo as well. The project is small. |
I also have a very slow formatting experience but without a jsconfig.json.
I exclude |
Is the formatting only slow on startup or all the time? If only on startup - not much we can do, all the files are loaded on startup and that blocks the extension for a little while. |
It is hard to generalize the problem. Small project don't seem to be affected, at least not that much. But my "bigger" projects behave like this: What can I do to get some more useful information for you? I cannot send you the project, because it is some internal stuff for a customer. |
Can you anonymize it somehow? So for example remove all dependencies that are internal, extract out one big component and replace its content with lorem ipsum stuff and import other placeholder components. During that extraction process you might also find out that the problem is no longer reproducible, which helps narrow down what the reason is. |
I just realized what could be a cause, at least for the consistent lag in the "large" svelte component:
Is there any way that the tooling can ignore such files? |
@kuechlerm Did you find a way to ignore data imports? |
@IgorMitev No :( |
I guess you have set declare module "*.json" {
const value: any;
export default value;
} Then the file is not analyzed and it should be faster. The disadvantage is that you no longer have type definitions for the JSON module and also TS will not error if there's no JSON file at the path you specify. |
@dummdidumm That was a very good tip! Thanks. |
Closing as there is nothing we can take action on. If performance problems occur, please open a new issue with a detailed reproduction. |
Describe the bug
Since updating to 105.4.0 of the VS Code extension the formatter is really slow or freezes when saving a .svelte file making me having to skip formatting from the VS Code prompt almost every time I'm saving a file.
There's a
jsconfig.json
present in the project, it's got a couple of aliases mapped in the root of my project.https://code.visualstudio.com/docs/languages/jsconfig
If I remove this file the formatter works as expected.
Version 102.3.0 doesn't have this problem, I've downgraded to that version in the meanwhile.
To Reproduce
Add a
jsconfig.json
file to the project, content doesn't seem to matter.I added an empty
jsconfig.json
file, or with an empty object, and this causes the formatter to freeze.Expected behavior
Format the code without freezing.
Screenshots
System (please complete the following information):
The text was updated successfully, but these errors were encountered: