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] - Bookmark all open files #609

Closed Nezteb closed 1 year ago

Nezteb commented 1 year ago

My idea is slightly similar to https://marketplace.visualstudio.com/items?itemName=usama8800.tab-groups but I'd like to be able to have a command for bookmarking all of the currently open files so that I can come back to them later if I want.

The simplest thing would be to just bookmark the first lines of each open file, but a more advanced option would be to bookmark the last selected line in each file.

alefragnani commented 1 year ago

Hi @Nezteb ,

The extension's idea is to bookmark positions in files, not files itself. With that in mind, and based on the VS Code API, I guess the only doable approach would be bookmarking the first line of opened files, because VS Code does not provide position/selection of non active files.

But I wonder, based on your scenario, if Bookmarks are really what you need. It seems you want something like a session restore feature, and I guess you would be better suited using the Restore Editors extension for that. It allows you to create different layouts, based no your open editors/documents, and restore them later. I think it worth a try.

Hope this helps

Nezteb commented 1 year ago

VS Code does not provide position/selection of non active files.

Ah, I was hoping there was a way to get a list of the user's "edit locations" as mentioned in the docs: https://code.visualstudio.com/Docs/editor/editingevolved#_quick-file-navigation

In my mind I was thinking something like:

# pseudocode
for edit_location in edit_locations:
  if edit_location in open_files:
    bookmark(edit_location)

It seems you want something like a session restore feature

You're correct; I figured I'd bring it up as a potential usecase that bookmarks could cater as well. 😅

Thanks for the extension mention! I had been using Tab Groups for this, but I'll have to check out Restore Editors. 😄