codeswing icon indicating copy to clipboard operation
codeswing copied to clipboard

“New Swing” command can overwrite an existing swing, without notifying the user

Open Tracker647 opened this issue 5 years ago • 2 comments

Snipaste_2021-01-01_17-56-45

my operation step: 1.ctrl+shift+p: code swing: create a new swing 2.select the demo folder(rock-paper-scissors-master) 3.select basic:html/css/javascript then I find all my file contents is gone,why?

Tracker647 avatar Jan 01 '21 10:01 Tracker647

https://user-images.githubusercontent.com/54085641/103436964-7ba44f00-4c5c-11eb-9d61-02260e1e840a.mp4

Tracker647 avatar Jan 01 '21 10:01 Tracker647

When you run the “CodeSwing: New Swing” command, you’re creating an entirely new swing, based on the template you selected. So if you select a directory that already includes a swing, it would override the existing files. Based on the video you linked, that’s what is happening.

If you want to open an existing swing, you can run the “CodeSwing: Open Swing” command, which lets you select a directory, and opens the swing editor for the respective files. Alternatively, if you open a swing directory directly in VS Code, then the swing will automatically open, since CodeSwing can recognize that the workspace is a swing. Could you try this command and see if it works as expected for you?

To prevent confusion, we could probably update the “CodeSwing: New Swing” command to check for an existing swing in the selected directory, and ask the user to confirm that they want to overwrite it. I’ll try to make that change this afternoon 👍

lostintangent avatar Jan 01 '21 17:01 lostintangent

Closing this as not planned, since I never heard any other feedback about this behavior.

lostintangent avatar Dec 28 '23 17:12 lostintangent