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] - Toggle Label - Bookmark menu - autofill in select text to the input box #579

Closed mishaxz closed 1 year ago

mishaxz commented 1 year ago

When you toggle a bookmark as a label, it would be great if it can automatically put the selected text in the input box as the suggestion for what to label it.

Often the bookmark window is not very wide but something important is on the line you want to bookmark but it won't be visible in the bookmark window because it is not wide enough, if you can select the text in the line that is important then sometimes this makes a very good bookmark label.

alefragnani commented 1 year ago

Hi @mishaxz ,

There is already a setting that you can play with bookmarks.label.suggestion. You should probably use suggestWhenSelected value.

It is documented in README.md

* Choose how labels are suggested when creating bookmarks (dontUse by default)

  * `dontUse`: Don't use the selection (original behavior)
  * `useWhenSelected`: Use the selected text (if available) directly, no confirmation required
  * `suggestWhenSelected`: 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

Hope this helps