While I was developing over SSH, I lost the connection to the remote server just as I attempted to create a new folder. After reconnection, the file sidebar in Visual Studio Code still had the folder in it, but there was no name next to the icon; just the icon itself. In an effort to remove this "ghost" folder, I right-clicked the entry in the sidebar and chose "Delete Permanently." Just as I hit "Delete" in the confirmation dialog, I realized it was probably not a good idea, and my fears soon came true: the parent of the nameless folder, including ~80% of the project I had open, was deleted. Shortly thereafter, Visual Studio Code became unresponsive and had to be restarted.
Luckily, external backups combined with Visual Studio Code's local history feature were enough to restore all but the last few minutes worth of code, but another person in a similar situation might not be quite so lucky.
Theory
Not knowing VSC's internals, I would imagine that, somewhere along the line, VSC concatenated the path to the parent folder (/parent" with the name of the child in an effort to get "/parent/child" and delete the child folder using that path; however, because VSC believed I had selected a folder with no name/an empty string for a name, the result of this concatenation was just "/parent", leading to the recursive deletion of the parent folder.
Suggestion
I understand the bug that led to this occurrence is far too specific and unreproducable for a proper bug report or fix to be possible. However, would it be feasible for a sort of "catch-all" check to be implemented in the UI code that would prevent deletion of a nameless folder brought about by any situation? (I would assume there are more ways this could occur than just the way it did in my instance).
I acknowledge that this may be seen as an ideologically poor solution, but, given the catastrophic results it could prevent for what seems like little maintenance, I make this suggestion nonetheless.
System/installation info
Ubuntu 23.10 locally, 24.04 on server
Local extensions enabled: None other than the official ones for development over SSH
Server extensions: ESLint, Vue - Official
Context
While I was developing over SSH, I lost the connection to the remote server just as I attempted to create a new folder. After reconnection, the file sidebar in Visual Studio Code still had the folder in it, but there was no name next to the icon; just the icon itself. In an effort to remove this "ghost" folder, I right-clicked the entry in the sidebar and chose "Delete Permanently." Just as I hit "Delete" in the confirmation dialog, I realized it was probably not a good idea, and my fears soon came true: the parent of the nameless folder, including ~80% of the project I had open, was deleted. Shortly thereafter, Visual Studio Code became unresponsive and had to be restarted. Luckily, external backups combined with Visual Studio Code's local history feature were enough to restore all but the last few minutes worth of code, but another person in a similar situation might not be quite so lucky.
Theory
Not knowing VSC's internals, I would imagine that, somewhere along the line, VSC concatenated the path to the parent folder (/parent" with the name of the child in an effort to get "/parent/child" and delete the child folder using that path; however, because VSC believed I had selected a folder with no name/an empty string for a name, the result of this concatenation was just "/parent", leading to the recursive deletion of the parent folder.
Suggestion
I understand the bug that led to this occurrence is far too specific and unreproducable for a proper bug report or fix to be possible. However, would it be feasible for a sort of "catch-all" check to be implemented in the UI code that would prevent deletion of a nameless folder brought about by any situation? (I would assume there are more ways this could occur than just the way it did in my instance). I acknowledge that this may be seen as an ideologically poor solution, but, given the catastrophic results it could prevent for what seems like little maintenance, I make this suggestion nonetheless.
System/installation info
Ubuntu 23.10 locally, 24.04 on server Local extensions enabled: None other than the official ones for development over SSH Server extensions:
ESLint
,Vue - Official
Detailed information