remote-vscode icon indicating copy to clipboard operation
remote-vscode copied to clipboard

Temporary files at /var/folders not deleted after session ended

Open Leedehai opened this issue 6 years ago • 5 comments

There are many "ghost" files stored at this location. This is one of them. screen shot 2017-10-24 at 16 29 03

Leedehai avatar Oct 24 '17 23:10 Leedehai

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.

rafaelmaiolla avatar Oct 25 '17 12:10 rafaelmaiolla

So which folders should I clean? I don't want my script to accidentally delete others:) @rafaelmaiolla

Leedehai avatar Oct 25 '17 22:10 Leedehai

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.

pkazmier avatar Dec 22 '17 15:12 pkazmier

I have same experience, trying to find some solution

lihuanshuai avatar Feb 01 '18 04:02 lihuanshuai

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,

  1. Closing the file should delete the local copy with permissions if the changes haven't yet been saved.
  2. 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).
  3. 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.
  4. 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?

WinCPP avatar Aug 11 '18 21:08 WinCPP