-
-
Notifications
You must be signed in to change notification settings - Fork 448
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 format on save on big file cursor alway jump to the end of the file #2920
Comments
I can confirm that this is a real issue, and it's driving me nuts. The precise file size at which this behavior begins occurring is 100002 bytes. That is, formatting a file with 100001 bytes is fine, but adding one more byte breaks prettier. At least, this is true for a Javascript file. I've not tested other types. Here is my test. (I had to put it in a zip file, since the .js extension is not an allowed type for attaching.) |
+1 having the same problem. |
yes, I can confirm the same issue vscode 1.76.2 setting "editor.codeActionsOnSave": {
"source.organizeImports": false,
}, |
@marekcambal, please be aware that changing the setting only fixes the problem that happens while saving the file (with save on format flag is true). |
Same issue here |
Same here, except that with
marekcambal's workaround did not work for me |
+1 crazy |
Having the same issue. Is there a workaround for this ? |
bug +1. this is bug,no enhancement |
I was able to determine that the bug was introduced in 9.5. Reverting to version 9.4 fixes the issue. Looking at the commit log, be790ca seems very suspect. I changed the mode locally to just modifications but then prettier doesn't run at all. I'm guessing that the algorithm to get only the modified part is too costly to run for very large files. Though that doesn't quite make sense either as manually using the format is still fast (~180ms). VS code might just be having issues for whatever reason for very large files on modification only changes. The solution is probably to only use the "new" algorithm when the setting is enabled. But for now reverting to 9.4 will work and that's what I've done. |
I don't remember exactly why my change allows range formatting to work. I think it was because prettier always reports that it changed the entire file and this would overlap with some other edit ranges from somewhere else. VSCode would see the conflicting edits and bail. Because of @madc0w's analysis, I searched for "100000", in VSCode, and this looks like a contributing factor: https://github.com/microsoft/vscode/blob/f125afbc800ec611f5a9ab1333c769832ce424b3/src/vs/editor/common/services/editorSimpleWorker.ts#L492 Looking at the blame, that line was last changed to fix vscode#72321 and the discussion there seems very relevant. |
Format on save on big js file(3700lines), cursor alway jump to the end of the file
prettier version 9.10.4
vscode 1.76.2
The text was updated successfully, but these errors were encountered: