[英]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.我经常在 Visual Studio Code 中使用拆分视图,例如,在左视图中显示 C++ header 文件,在右视图中显示相关的源文件。 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).我经常做的是在 header 文件(在左视图中打开)中使用命令
Go to Definition
(默认键绑定F12 )。 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.然后 Visual Studio Code 继续在左视图中打开定义,因此关联的源文件现在在左视图和右视图中都打开了。
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.我希望 Visual Studio Code 做的是 select右侧视图中的定义,其中源文件已经打开。 How to configure Visual Studio Code to do that?
如何配置 Visual Studio Code 来做到这一点?
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 以与 Visual Studio 相同的方式运行,这正是我希望看到的行为,即选择已经打开的源文件并跳转到那里的定义,而不是在不同的看法。
Visual Studio Code provides the following option which enables the desired behavior: Visual Studio Code 提供了以下选项来启用所需的行为:
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.它似乎默认关闭。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.