remote-vscode
remote-vscode copied to clipboard
Temporary files at /var/folders not deleted after session ended
There are many "ghost" files stored at this location. This is one of them.
The extension creates files in the temporary folder, which may be deleted if you restart your pc (some linux clean that folder).
I keep those files to prevent any data loss if something goes wrong. So you can always reopen the last files.
What we can do is to add a configuration to enable or disable the file deletion on close. So we can keep this folder clean.
So which folders should I clean? I don't want my script to accidentally delete others:) @rafaelmaiolla
Along the same line, after I finish editing a remote file (Cmd-W), in addition to deleting the temp file on the local filesystem, it would be nice if it was no longer shown in the file history (Cmd-P). I.e., if I edit the same file three times consecutively (rmate file), the file history gets a bit cluttered with an entry for each of the three times I invoked rmate.
I have same experience, trying to find some solution
Could this be done by creating one random folder in tmp dir on server start instead of creating a random folder for each remote file that is opened? This random folder created on server start could be passed to session object which in turn could pass it to RemoteFile.initialize()
method. And all the local files will be co-located. Few more things that would need to be handled are,
- Closing the file should delete the local copy with permissions if the changes haven't yet been saved.
- Stopping the server could simply delete the local files; and close the editor tabs; and remove the files from recently opened file list of vscode. (Could possibly ask to save the unsaved files which could be controlled via config parameter to auto-save / ask / discard).
- If a file is already open, reopening it should reuse the editor tab. Could possibly ask to discard previously unsaved changes or cancel the reopen operation.
- If vscode were closed without stopping server / disconnecting session, the subsequent server start could either re-use the previously created random folder or ask for its clean up and create new one. For this, obviously, there would have to be some tracking file maintained by the extension itself.
BTW, how does one go about building this thing?