alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code

Home Page:https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Rapscallion0 opened this issue · comments

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

  • Extension version: v13.4.2
  • VSCode version: 1.85.1
  • OS version: Windows 11 23H2 (22632.3007)

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

Hi @alefragnani,

This sounds like a great solution to my issue!

Thank you for looking into this!