ryu1kn / vscode-text-marker

Visual Studio Code Extension. Select text in your code and mark all matches. The marking colour is configurable
https://marketplace.visualstudio.com/items?itemName=ryu1kn.text-marker
MIT License
87 stars 17 forks source link

Allow toggling multiple selections with multiple cursors #73

Open Kronuz opened 2 years ago

Kronuz commented 2 years ago

I'd be really useful if we could have multiple selections and toggle all of them at once.

How to reproduce

1) Select multiple lines with text 2) Highlight parts of each line 3) Use toggle highlight command to turn on the highlights

Desired behavior

All selections should be added as a highlights

What we see instead

Only first selected text is highlighted, all others are ignored.

Proposed solution

Add selections to TextEditor (lib/vscode/text-editor.ts) and use it in ToggleHighlightCommand (lib/commands/toggle-highlight.ts) to iterate through all active selections in execute().

LoanCaecke commented 2 years ago

Hello,

I would like to suggest one sub-feature for multiple cursors too :

  1. Select multiple lines with text
  2. Highlight parts of each line
  3. Use toggle highlight command to turn on the highlights and make the multicursor selected text a single regex group

So it avoid to spread the hightlights on all the file if one selected text area is one char only (hightlight all "d" of the file for exemple.)