microsoft/vscode

Highlight selected text is not applied to all opened files

aviadb opened this issue ยท 33 comments

  • VSCode Version: 1.14.0
  • OS Version: Windows 10

Selecting text for highlight(either by marking it or by double clicking) highlight the selected text only in selected opened file but not in all opened files in other panels.
In addition, the highlight marker is not visible in map preview.

Almost 2 month has passed since,
without any progress.

I am definitely in favor of this feature which I am used to with Notepad++ (which they call Smart Highlighting In All Views). To help people understand, here are a couple of screenshots:

Current behavior when highlighting the word "car" in the left view (matches are highlighted only in the left)
image 2

Expected behavior when highlighting the word "car" in the left view (matches are highlighted in both views)
image 3

This is exactly the feature I am looking for. When I almost submitted a feature suggestion, I found this. It has been almost 2 years.

Are there any plugins which support this behaviour?

Here are a few plugins that do the highlight of all occurrences of a word within a single document. I requested to all the developer to add the ability to highlight across multiple views.
Feel free to go in and +1 the feature to motivate them to develop the feature.

https://github.com/ryu1kn/vscode-text-marker
https://github.com/rsbondi/highlight-words
https://github.com/cliffordfajardo/highlight-selections-vscode
https://github.com/EsIce/highlight-icemode

Here are a few plugins that do the highlight of all occurrences of a word within a single document. I requested to all the developer to add the ability to highlight across multiple views.
Feel free to go in and +1 the feature to motivate them to develop the feature.

https://github.com/ryu1kn/vscode-text-marker
https://github.com/rsbondi/highlight-words
https://github.com/cliffordfajardo/highlight-selections-vscode
https://github.com/EsIce/highlight-icemode

@cliffordfajardo added the feature to his plugin : https://github.com/cliffordfajardo/highlight-selections-vscode#multi-tab-support

ctf0 commented

ryu1kn/vscode-text-marker#44 with correct behavior, waiting for merge

2021 and still not addressed ๐Ÿ˜ข

Please let us know the plans on this

Team / @rebornix @alexdima @kieferrm, can you please consider this request, it has been in open state for years with quite a good number of upvotes..

This is a must. I'm new with vscode, but I came from Atom and this is a time saving feature, specially when working with multiple monitors and multiple views.

2022 and counting ๐Ÿ˜ข

June 2022 and this still isn't a feature. This is a must if you are going kill off Atom now. At least make your text editor better before forcing many people to switch.

Upgraded to 1.68.1 but it still doesn't work for me.

Are you using an extension to make it work? which one?

Thanks!

Upgraded to 1.68.1 but it still doesn't work for me.

Are you using an extension to make it work? which one?

Thanks!

Yeah my bad, I did have an extension doing this. It's "highlight-icemode-select"

Upgraded to 1.68.1 but it still doesn't work for me.
Are you using an extension to make it work? which one?
Thanks!

Yeah my bad, I did have an extension doing this. It's "highlight-icemode-select"

That does mostly what I want. Was able to change the background color to make it "none".

One thing that I still don't like is, if you select the word "for", it will catch all the words, but it will also highlight the word "for" inside of "format". Atom didn't have this problem. It would highlight everything that matched exactly what was selected.

UPDATE:

With begin-again's highlight-icemode-select extension suggestion plus adjusting the background color, and selecting "Match Whole Words" in the Find pane (CTRL + F), it gives the desired function.

Add the following to your settings.json after installing the extension above to remove the background color.

"highlight-icemode.backgroundColor": ""

@kenijo You can press CTRL+F (CMD+F for Mac) and there is a button you can click in the Find pane that defaults the highlights to "Whole Word Selection". This makes it function for the double-click as well. Only issue I could really see is if you want to do a search for a variable or something that you don't remember the entire name of. In that case you can just switch back temporarily to search for it.

Thanks, that's a good alternative. The one thing I don't like about highlight-icemode-select is that it highlights even on multiline selections. I wish that could be disabled (it is distracting).

I'll stay with (multiwindows-highlight)[https://github.com/aki12n/multiwindows-highlight] for now

Thank you all! highlight-icemode-select does exactly what I need!

The thing I miss now is the minimap doing the same, showing selections in multiple views... anyway the icemode extension is a big step.

Many times the same entity is referenced in multiple files (like json/yaml key names, recurring data/logs, global vars), so having this would help a lot.

I am coming from Atom too (reluctantly - thanks Microsoft!) and this is something that has stopped me switching to VSC in the past. Highlight-icemode looks good, but is there a way to get the selected word highlighted in the minimap as well? There are marks in the minimap border, but they don't line up. I can't make any sense of them. I used this feature in Atom constantly to see quickly where else the selected word is from the minimap.

I wish this was there too. There are a few enhancement requests on the VSCode GitHub related to this but so far I haven't seen anything come to fruition.
The closest feature to this is a highlight happening on the scrollbar, but I don't find it practical.

Just came across this and the above mentioned highlight-icemode-select extension is accomplishing this feature perfectly for me.

On my instance, highlight-icemode-select does not highlight the word in the minimap. Am I missing something?

On my instance, highlight-icemode-select does not highlight the word in the minimap. Am I missing something?

Sorry @jheller I meant that highlight-icemode-select is solving the "Highlight selected text is not applied to all opened files" problem perfectly. I can't say anything about the mini-map part as I don't use those, sorry!

The cross-editors-selections extension is a start in the right direction, but it only highlights the selected text in the minimap. I have another extension that highlights all occurences of the selected text in the editor, and I would like to see that reflected in the minimap. Atom was able to do this so well, and it's the feature I miss most.

ctf0 commented

but it only highlights the selected text in the minimap

it really depends on your editor configuration, ex."editor.hideCursorInOverviewRuler": false, again the extension does nothing outside the usual editor behavior, so i would recommend to disable any selection modifier/highlighter extensions & see if the editor behave as you expect.

OK. I removed the highlight-icemode extension I was using. Now in the editor it only highlights the selection, not other occurences of it in the editor. And the minimap just shows the selection - and that is barely visible.
Here is what I would like to see. This image is from the Atom package minimap-highlight-selected, which worked in conjunction with the highlight-selected package. When a word is selected it shows (very clearly) all occurences of it in the editor and in the minimap. I found it extremely useful. image

ctf0 commented

Now in the editor it only highlights the selection, not other occurrences of it in the editor

this depends on your editor configuration, maybe you got used to a selection modifier made by other extensions, but this outside the extension scope.

And the minimap just shows the selection - and that is barely visible

plz check the editor minimap settings

When a word is selected it shows (very clearly) all occurences of it in the editor and in the minimap. I found it extremely useful.

the extension i made is not for this usage, plz check the readme