alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
GNU General Public License v3.0
1.65k stars 161 forks source link

[FEATURE] - Verify existing Bookmarks.json file when turning on "Save Bookmarks In Project" #690

Open Rapscallion0 opened 5 months ago

Rapscallion0 commented 5 months ago

I recently had some issues with VSC (I believe extension related) and ended up resetting settings and extensions. This seems to have resolved my issue. However the Bookmarks setting "Save Bookmarks In Project" was turned off after resetting and I had this turned on prior to resetting. When opening a project in VSC I noticed that my bookmarks were not available. I confirmed that a .vscode\Bookmarks.json file existed and then after a little digging noticed that "Save Bookmarks In Project" was disabled. I enabled the "Save Bookmarks In Project" and noticed immediately that Bookmarks.json disappeared from VSC explorer (I had it open as per previous mentioned investigation).

Further investigation revealed that Bookmarks.json was indeed completely deleted.

Environment/version

alefragnani commented 3 months ago

Hi @Rapscallion0 ,

Once you enable saveBookmarksInProject setting, the bookmarks from the current session will be saved locally, overwriting any previously saved file. This happens simply because the local bookmarks are not loaded unless saveBookmarksInProject is set to true. That being said, the scenario you experienced is the expected behavior.

But, I understand your report, and I think a small change could be added to avoid missing previously saved bookmarks. When enabling saveBookmarksInProject, look for a already saved bookmarks.json file, and ask if really want to overwrite it. Answering yes, will work as today. Answering no will ignore the current bookmarks and reload the ones from bookmarks.json.

Hope this helps

Rapscallion0 commented 3 months ago

Hi @alefragnani,

This sounds like a great solution to my issue!

Thank you for looking into this!