-
Notifications
You must be signed in to change notification settings - Fork 510
Corrupted text added during save, not during save without formatting #2569
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
Comments
This looks related to #2555. Thanks for the detailed report @codykonior. |
It would also be great if you could provide the payload logs, information for how to do that is here: |
Just confirming that this has been happening lately to myself and some colleagues of mine. Next time it happens I'll try and pull the payload logs. |
The bottom one is correct @robdmoore it is a hidden setting |
Noted - I'll add that setting and loop back with logs if I notice the bug happening again. |
It started happening again, here's the logs: |
Thanks @robdmoore, sorry that you are hitting this--definitely a frustrating issue! |
I've been having problems with this as well. I have a build script that injects the contents of module files into scripts for an application that doesn't support the use of modules currently. Unfortunately I'm having to build every script by hand for the time being as when I save the file the entire thing gets corrupted - duplicate lines, duplicate sections of 50+ lines of code, random characters and brackets added in and sections completely removed. However, even when I save without the formatting, as soon as I format the document this happens again. Edit: It is happening on preview as well. I'm not even able to save somewhere else and open it in VSCode. This renders VSCode unusable for me until this is fixed. I'd really love to hear any ideas for workarounds if anyone has any ideas. Here's an interesting example. This is with all extensions disabled but PowerShell and semantic highlighting disabled. This is what my codes looks like throughout the entire file. |
Just checking on this to see if this has gotten any attention? I currently have no ability to use formatting with or without it being attached to 'on save'. Whenever I format PowerShell scripts, particularly larger files, this happens. I've been entirely unable to use the formatting functionality for almost a month now and it's really bumming me out. Is there anything I can do to help move this forward? |
@efie45 your coloring issue looks more like #3295 Can any of you test if the formatting issues happen when using PSScriptAnalyzer's |
Restarting VSCode helped me work around this issue. So, maybe a memory leak contributing to the issue? |
@efie45 @madrum is this still happening with the PowerShell Preview for VS Code? |
Yes, the issue happened for me this week. I restarted VSCode and it stopped
happening.
They file I was working on had about 780 lines. The last 8-10 lines were
getting duplicated each time I made a small change and saved.
|
Same here, happening when I try to format the content. I've attached a gif. I probably won't send you guys all kinds of logs and debugging information, it's clearly super broken and you guys should easily be able to reproduce the issue (if you can't that's also an issue). @andschwa Do you guys accept pull requests? There is apparently no decent formatter for powershell scripts, and I would like to have one. |
System Details
System Details Output
Issue Description
When I'm making edits to PowerShell scripts in VS Code (after a long day) sometimes Ctrl-S (Save) is adding corrupted text to the file. You can see it appear in the editor window and then get saved.
When the problem occurs, it's only in a single window/file. Reloading VS Code makes the problem go away. I didn't try closing just that code window.
Attached Logs
Unfortunately I got to this bit before I reloaded my session (though this happens every few days so I thought I'd open the issue now). The only thing of note in EditorServices.log is below but I'm not sure if it was related, because I think it was about 10 minutes before this happened, BUT I had the same problem on another file at around the same time:
What I did capture though were images of the corruption. I had just changed the type and property name, so, it seemed to be corrupting with part of what was previously removed.
Pre save
Save 1
Save 2
Save 3
The text was updated successfully, but these errors were encountered: