Is it possible to use selected text as label for new bookmarks (if selected text is a one-line)? Such feature would allow faster bookmarking of functions, classes, .. etc.
Suggested use-case:
Old use case:
New flow makes it easier to bookmark with meaningful labels while focusing on code. Specially when the beginning of the line isn't very meaningful text. For instance you can come through a long line like that in C++ file:
std::unordered_map<unsigned int, std::vector<std::vector<int>> ClassName::FunctionName()
It becomes essential to rename this bookmark to "FunctionName" to be able to spot it easily in the bookmarks sidebar.
Hi @ogamal ,
Thank you for your suggestion 馃憤 . I don鈥檛 use labeled bookmarks, but I agree it鈥檚 a great improvement.
But, I wouldn鈥檛 change the _default_ Toggle bookmark command to use the selected text, but instead, make the Toggle Labeled to use it. BTW, I鈥檓 not sure you know about it, because in your _Old use case_ scenario, you used the Side Bar to label the bookmark. Also, it would have a setting to define this behavior (default on).
Hope this helps
@alefragnani I didn't know about Toggle Labeled. That's useful in my use-case and saves few steps. It would be great if it is possible to make it default and even better if it can populate from selected text.
Thanks,
@alefragnani I didn't know about Toggle Labeled. That's useful in my use-case and saves few steps
That鈥檚 great!
It would be great if it is possible to make it default and even better if it can populate from selected text.
That鈥檚 the idea. In fact, I鈥檓 thinking about:
It would fulfill _any_ scenario 馃槵
@alefragnani Sounds great!
My two cents on how it could be implemented:
Toggle Labeled should prefill the label's textbox with the selected text if there is any. Toggle Labeled should prefill the label's textbox with the code of the current line if nothing is selected. Based on your feedback, I designed 4 possible suggestions. Choose the one better fit your needs, and define it in Preferences: Settings
dontUse: Don't use the selection (original behavior - default value)useWhenSelected: Use the selected text _(if available)_ directly, no confirmation requiredsuggestWhenSelected: Suggests the selected text _(if available)_. You still need to confirm.suggestWhenSelectedOrLineWhenNoSelected: Suggests the selected text _(if available)_ or the entire line (when has no selection). You still need to confirm "bookmarks.label.suggestion": "useWhenSelected"
This feature should be released this weekend.
Stay tuned