Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight all occurrences of selection in all windows in Visual Studio Code

I'm using Visual Studio Code with two windows (panes) side-by-side. To avoid confusion, here is a screenshot:

I'm using "editor.selectionHighlight": true, which you can see is working in the left (active) window. A similar solution is proposed in this question with editor.action.selectHighlights, but that works only in the active window. I tried searching but all my searches resulted in what I'm already using.

When I was using Atom, I was using a "Highlight Selection" plugin which highlighted matches from all open windows.

Is there a way, either native (preferred) or via an extension, to make selection highlighting work in all open windows?

like image 593
Marko Gresak Avatar asked Jan 17 '26 16:01

Marko Gresak


1 Answers

It looks like the highlight (not select) functionality shown below will be released in Stable v1.84 early December 2023 as under this setting:

Editor: Occurrences Highlight

Controls whether occurrences should be highlighted across files.

Options:

  1. off
  2. singleFile - current file only
  3. multiFile - across all valid open files

Work has begun and can be tested on this feature in the Insiders Build v1.84. The currently experimental feature will highlight the occurrences of a word found in all visible editors (in my early testing). From Test: Multi Editor/Model Highlighting

You must enable this setting:

Editor: Multi Document Occurrences Highlight

> Experimental: Controls whether the editor should highlight word
> occurrences across multiple open editors

Note

This initial implementation features only textual occurrences, with support for semantic highlighting coming in the future.

Here is a demo with three different files in three editor groups. You see you don't have to select the words, just click on them.

highlight occurrences across files

like image 171
Mark Avatar answered Jan 20 '26 22:01

Mark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!