lostintangent / codeswing

VS Code extension for building web applications ("swings") using a interactive and editor-integrated coding environment
https://aka.ms/codeswing
MIT License
977 stars 45 forks source link

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

Closed Tracker647 closed 8 months ago

Tracker647 commented 3 years ago

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 commented 3 years ago

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

lostintangent commented 3 years ago

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 commented 8 months ago

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