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

Highlight on select #41

Open kenijo opened 5 years ago

kenijo commented 5 years ago

Could you had the option to highlight on mouse select? And remove highlight when selection is unselected.

ryu1kn commented 5 years ago

Hi @kenijo , I’m not sure what you’re after. Isn’t that behaviour natively given by Code??

kenijo commented 5 years ago

I believe the default behavior of VSCode is to highlight the current selection only when text is selected with the mouse.

My idea is to do the same as the right click > toggle highlight of your extension except when it would be triggered when selecting a word: highlight all the instances of that word in the current file/panel as well as in all other file/panel that are visible.

Is this really a default behavior? Maybe I am missing something as I cannot make it work as I described it.

ryu1kn commented 5 years ago

Ah... I see. Code highlights the same pattern (not regex pattern match) in just the current active file but not ALL files, and that's what you're after, isn't it?

Do you want to provide a bit more context? ⬇️Doesn't need to be long 😉

A couple of requests from me when you raise an github issue.

  • Requesting a feature: Please try to provide the context of why you want the feature. Such as, in what situation the feature could help you and how, or how the lack of the feature is causing an inconvenience to you. I can't think of introducing it until I understand how it helps you 🙂
kenijo commented 5 years ago

Context for the feature:

Well it is very much the same context as using "toggle highlight" in the first place but with slightly more flexibility.

In my case, I often look at files side by side and I want to be able to "just" double click on the word in order to see all instances of that word highlighted in the current active panel but also in the inactive panels that are visible. I do not really need to have the word highlighted in all files (although ... maybe it could be nice...) Actually, if it is the current behavior of the "toggle highlight" then I would consider keeping it that way.

It is really helpful when going through code file or config files to identify commonalities. It is like a quick search across files feature. If the files are pretty big, you can easily navigate between the different instances of that word.

I am thinking highlight a variable name or keyword, not the word "the" that would appear 10000 times in book.

ryu1kn commented 5 years ago

Thanks @kenijo for the clarification :+1:

Text Marker highlights patterns in all panels (both active & inactive) but not "files", I used that expression to make it intuitive, but it seems it just caused confusion, sorry 😛

I'm not sure how to trigger the toggle command by just double-clicking a word, but being able to toggle a highlight with a quicker action would be great. Thanks for the suggestion.

lonix1 commented 4 years ago

+1!

Until this feature is supported by vscode (if ever), it would be nice to have it in this extension.

i.e.: click to highlight word in all editors (of the same file).