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 163 forks source link

[FEATURE] - Allow bookmarks.json save location to be specified per workspace folder #600

Open SudoCerb opened 1 year ago

SudoCerb commented 1 year ago

I have a workspace with three different repositories. I enabled Save Bookmarks In Project but this saved a new bookmarks.json file in one of my repos under .vscode (seemingly the first one it found alphabetically), but I was not working in that repository at the time, and don't want bookmarks to live there.

Would it be feasible to configure a bookmarks.json file per workspace folder or git repository?

SudoCerb commented 1 year ago

I've read that there's improved multi-root support but it's not clear how I would use that to solve my issue.

alefragnani commented 3 months ago

Hi @SudoCerb ,

First of all, sorry for the late reply.

About the behavior, if you have enabled saveBookmarksInProject in the multi-root workspace level (directly in the your-workspace.code-workspace file), a individual .vscode/bookmarks.json file should be used for each folder, containing the bookmarks of that folder. This is the similar behavior as VS Code itself, while handling folder settings on multi-root workspaces, which handles individual .vscode/settings.json file, on each folder. The same behavior should be seen if you enable saveBookmarksInProject at user settings level.

However, if you set saveBookmarksInProject in one individual folder within that multi-root workspace, it will be ignored, for that multi-root workspace. It only works if you open that folder separate, in an individual windows.

But, there is one caveat, and maybe this is what happened to you. If you:

I think a fix for this would be effectively split the bookmarks, and save them on its own root-folder

The hard part (in the bookmarks.json matter) for multi-root workspaces is that you may have your .code-workspace located anywhere, away from the original root-folders contained in that multi-root workspace. So, to saveBookmarksInProject for multi-root workspaces, the only reasonable location is inside the root-folder itself.

Hope this helps

alefragnani commented 3 months ago

BTW, I'm not inclined to the external location management for bookmarks, like #685 for instance, simply because it would be necessary to replicate a session management feature, like VS Code already does today.

I think what would happen if the user selects a network location, or even shared locations (two users sharing the same bookmark files) would be another thing to worry about.