How to recover binary file opened and saved in VSCode? - visual-studio-code

I'm working with a new student who's getting started with Python programming in Visual Studio Code. She's exploring and getting to know programming by feel and using VS Code and kitao/pyxel to learn the ropes. In that project, one creates .pyres files (that are binary/zip files). When that file appeared in the editor, the user clicked on the file, acknowledged the "view this file as text even though it's binary" warning, and then saved it, thereby corrupting the file. And since VS Code and Windows are uncompromising on these sorts of mistakes, all of the work in generating the assets appears to be lost.
Is there any way given a binary file that was opened and re-saved unchanged in VS Code to reverse the changes that VS Code makes to that file? Any insight into what changes VS Code makes to a binary file when opened as text and saved?

Related

VScode: Show a prompt when loaded files are modified externally on disk

Which is the final outcome of the VScode [issue] #14298 (https://github.com/microsoft/vscode/issues/14298) ?
Is it: "No, we will NOT issue a warning, if an external app modifies a VScode opened file, like ALL other editors do ? (except Notepad)"
Up to now, I cannot find such a setting...
I have never seen a prompt when an open file is changed elsewhere. What I have seen is a warning when I try to save a file that has been changed elsewhere. I have seen this: preventing dirty writes
VS Code will show you an error message when you try to save a file
that cannot be saved because it has changed on disk. VS Code blocks
saving the file to prevent overwriting changes that have been made
outside of the editor.
In order to resolve the save conflict, click the Compare action in the
error message to open a diff editor that will show you the contents of
the file on disk (to the left) compared to the contents in VS Code (on
the right):
Until those issues have been resolved I believe that is as close as you are going to get.

How do you stop VS Code from loading a corrupt file?

I accidently opened a file that didn't have a suffix, just "file.", that doesn't even exist and now whenever I try to close it, VS Code crashes. When I reopen Code, it always reopens the file. I've scoured settings and tried these fixes but nothing helps.
Visual Studio Code always reopens previous file or folder
How can I completely clear the cache for VS code and stop reopening files? It should be possible outside of VS Code because I get the feeling settings aren't be preserved because of the corrupt file.
FWIW, I was able to track down the call to the file in $HOME/.config/Code/Backups. Once I removed the offending Backup file, I can open Code once again without loading the corrupt file.

Prevent VS Code from opening all files in a folder recursively

I am currently using VS Code on a folder mounted through an SSHFS. The folder has subfolders with many jpg and other image files.
Logging all the files VS Code tries to open reveals it recursively touches all the files (doesn't read the content, just STATs them). This takes very, very long over an SSHfs mount and I can not cancel it without killing the editor (it won't even respond to regular closing).
During this, no files or directories can be opened (inside VSCode) and will show a loading spinner until VS Code has finally had it's way and checked all the files.
This behaviour only recently emerged, I can't pinpoint if any version beyond the current stable version has this behaviour.
I am thinking it might be the new searching engine, but I can't find out which part of the editor is doing it.
It looks like they just posted a fix for your situation:
Slow startup opening a large workspace over the network
you will need vscode v1.32.3

Flash Builder (ecplise) syntax coloring not working

A few weeks ago syntax coloring stopped working for the odd file. Or halfway down a file. Now its becomming increasingly the norm.
I've cleaned the project, pruned out a whole heap of closed projects, but it hasnt improved things.
What would Stack Overflow suggest?
I ran into this last week. In my case my main application mxml file stopped having it's code highlighted. Also I lost the ability to switch between source and code views for that file. It was as if it was just being recognized as a basic text file.
To get it working again I had to create a new mxml file, made it the default application, copy/paste all my code over into the new file, delete the original file, and then rename my new mxml file to match the file I just deleted. Then i went into my project properties and made sure my Run/Debug settings were still correct so i could launch/test the application again.

Eclipse intellisense disappeared for particular MXML file (Flex Project)

I was trying to replace a container with different types of containers (I commented out the markup for that container and typed in the markup for the other containers). Finally I reverted and removed all the comments, restoring the original container.
Now I'm getting no errors or warnings, but I cannot see the MXML objects in the intellisense when working in the included actionscript file.
For e.g. when I typed "dg" + CTRL-space I dont' see "dgSalesData".
However, I know the IDE recognizes the object, for if I call a non-existent method on the object (e.g. dgSalesData.callNonExistentMethod()) it gives a compiler error.
What can I do to restore the intellisense?
I already checked out this answer. All the boxes are checked in 'Windows > Preferences > Java > Editor > Content Assist > Advanced'. Moreover, all other inluded actionscript files can see objects in their MXML counterparts.
I think it's related to formatting the MXML markup, because I've seen a loss of intellisense before. I used to use a plugin called "Pretty Print Command" that would format my code like in VS. Then I noticed that when I use it intellisense sometimes gets lost, so I stopped using it.
EDIT: Wow, I just noticed that the IDE has it's own formatting option. I don't know I missed it:) However, after letting the IDE format the MXML and re-building the intellisense still won't show any of the MXML objects.
Does anyone have an idea how I can restore the intellisense?
As a workaround, I made a copy of the MXML file and the included actionscript file. I then deleted the local copies of the MXML and actionscript files and renamed the copy to the original. I then simply re-checked it back to source safe.
It doesn't seem possible. I made another copy of the actionscript file and included that file. This restored the intellisense, though the VSS history for the file is now split into two. A very dirty solution, but it works.