简体   繁体   中英

How to configure Visual Studio Code so that it selects an already opened file in a different split view instead of opening it again in the same view?

I often use split view in Visual Studio Code, eg, showing a C++ header file in the left view and the associated source file in the right view. What I often do is use the command Go to Definition (default key binding F12 ) in the header file (which is open in the left view). And then Visual Studio Code goes on to open the definition in the left view, so that the associated source file is now open in both , the left and the right view.

What I would like Visual Studio Code to do instead is to select the definition in the right view, where the source file is already opened. How to configure Visual Studio Code to do that?

I would like Visual Studio Code to act in the same manner as Visual Studio does, which shows exactly the behavior I would like to see, namely selecting the already opened source file and jumping to the definition there, instead of opening the same file twice in different views.

Visual Studio Code provides the following option which enables the desired behavior:

Reveal If Open

Controls whether an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, eg when forcing an editor to open in a specific group or to the side of the currently active group.

It seems to be off by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM