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

Support regular expression to mark a text #8

Closed ryu1kn closed 7 years ago

ryu1kn commented 7 years ago

Expecting user actions:

It must be confusing that you can unmark a text by selecting it if the text was highlighed & command executed, but cannot if it was specified by regex...

Then it could be better if I could remove whatever mark currently under the cursor, suggested in https://github.com/ryu1kn/vscode-text-marker/issues/6

But if there are 2 texts aaa and bbb marked by regex [ab]*, would it be unnatural if both marks are removed if I execute highlight/unhighlight command just on text aaa? And in the first place, is it even possible to find a corresponding regex pattern just from a cursor position?

ryu1kn commented 7 years ago

So,

I should probably drop the feature to unmark a text by highlighting it, and always use the list of pattern to select remove marks, for consistency...

ryu1kn commented 7 years ago

Released as v0.4.0

https://github.com/ryu1kn/vscode-text-marker/releases/tag/8ba08408c246b

ryu1kn commented 7 years ago

I should probably drop the feature to unmark a text by highlighting it, and always use the list of pattern to select remove marks, for consistency...

Maybe I don't need to because the following can be resolved.

  • It would be complicated/impractical to find the regex pattern giving the mark under the cursor
  • It would be confusing that I can/cannot unmark a text by selecting the text depending on the way I maked them (either by selecting it or writing a regex)

As TextMarker always updates the locations of matching texts anyway, if I not only apply highlight but keep track of the locations, I should be able to identify a pattern from a text location. It doesn't seem to be complicated but it could cause a performance issue if there are tens of thousands of locations registered.

Anyway with this way, I can unhighlight regex patterns as well, then the problem that I could unhighlight only non-regex type patterns will disappear.