vscode-bookmarks
vscode-bookmarks copied to clipboard
[FEATURE] Add Filter By Label
Provide a way for the user to hit a shortcut key, enter the label of a bookmark, and have it jump to that bookmark.
I would use this type of mark a lot, where the labels are each a single letter. For me, this is more efficient than hitting next-next-next-next-next, trying to find the bookmark. I can hit the shortcut key, give the one letter name (e.g. 'x'), then hit Enter (e.g. a la vim: 'x<cr>
. Since the letter (label) has meaning, I know I can jump straight to the line I need.
The first idea that comes to mind, is to hit the shortcut key, which pops up an input field. The user enters the bookmark label and hits Enter. Then it jumps to the first bookmark with that label.
Or perhaps it can use a fuzzy finder approach; e.g. jump to a bookmark if the label is an exact match, or if no exact match, jump to the first bookmark where the input text matches a prefix of the label (for example, input "db"
would match labels "db_open"
and "dbclose"
, and it would jump to the first one found, as if the user hit 'next' until it was found).
Hi @quazar0 ,
Do you know the List
and List from All Files
commands also search for labels? So, in fact, you already have this functionality. You just need to define a shortcut for your preferred command and you are good to go.
The only difference about what you ask is: it searches not only by the label, but also line content and line/column number.
About using a fuzzy/improved search, unfortunately it's not possible, because the VS Code doesn't provide API for that. There is no way to customize the search filter.
Hope this helps
I'm closing this issue because no new comments has been made since my last question. Feel free to reopen/comment if you have more questions.
Sorry for the delay, but just wanted you to know, the 'List' will not work. I think it is mainly because it searches for line content, not just the label. For example, if I name my bookmark 's' (making them short and quick to type is the main point), then I run the 'List' command, it finds many bookmarks, not just the 's' bookmark, since the letter "s" is very common in the content.
That’s true. It search not only by label, but also line contents and number.
I’m not sure it would be better to have a separate command, a setting or some kind of dynamic filtering.
I’lol reopen the issue, so I could see how many other are interested too.
Hope this helps
How about add a filter input widget in bookmarks side bar? Too much bookmarks for a project, difficult to navigate between bookmarks continuously. Though we can search and navigation bookmarks with command List from All Files currently, but if we want to navigate very frequency, it's hard to use. For this situation, it's better to use the sidebar, but too much bookmarks cause it also diffult to use.
A a filter in sidebar, will help this. Also, sorting bookmarks by time also improve this.
Hi @julee ,
There is no API available today in VSCode to provide such widget, only an open issue (https://github.com/microsoft/vscode/issues/70646) still on their Backlog, which means, no ETA.
Hope this helps
Hi @julee ,
There is no API available today in VSCode to provide such widget, only an open issue (microsoft/vscode#70646) still on their Backlog, which means, no ETA.
Hope this helps
Maybe we don't need a widget, just a way to let user input something, then the bookmarks sidebar can show only the filter result. Maybe just like gitlens:
Click the Search Commit icon will trigger the vscode input view, then user can input.
Hi @julee, I just wanted to add a note that, although not ideal, there IS a feature that can be used to filter a tree view currently, which works (mostly/sort of) as you want for the Bookmarks - File Explorer view.
That feature is called "filter by type". You can read about it at this link which I found through @alefragnani's open ticket: https://code.visualstudio.com/updates/v1_31#_new-tree-widget
Basically you can hit Esc
to give focus to the activity bar, and then just start typing. It will highlight the found instances of your text. You can hover over the text which appears as you type, and hit the filter icon, and then it will begin filtering.
Unfortunately, there's no ability to search for regexes, or even for case-sensitive input.
Hi @julee, I just wanted to add a note that, although not ideal, there IS a feature that can be used to filter a tree view currently, which works (mostly/sort of) as you want for the Bookmarks - File Explorer view.
That feature is called "filter by type". You can read about it at this link which I found through @alefragnani's open ticket: https://code.visualstudio.com/updates/v1_31#_new-tree-widget
Basically you can hit
Esc
to give focus to the activity bar, and then just start typing. It will highlight the found instances of your text. You can hover over the text which appears as you type, and hit the filter icon, and then it will begin filtering.Unfortunately, there's no ability to search for regexes, or even for case-sensitive input.
Yes, it works! Thank you.
Hope to support regexes in the future.