简体   繁体   English

如何配置 Visual Studio Code 以便它在不同的拆分视图中选择已打开的文件,而不是在同一视图中再次打开它?

[英]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.

相关问题 Visual Studio 中是否有一个选项可以简单地查看文件如何包含在我的 C++ 代码中而无需构建? - Is there an option in Visual Studio that provides a simple view of how a file is included in my C++ code without building? 如何在发布模式下查看 Visual Studio 中的代码? - How do I view code in Visual Studio in Release Mode? 有没有办法在 Visual Studio 中查看编译器生成的代码? - Is there a way to view compiler generated code in Visual Studio? 如何为 WSL 和 Visual Studio 代码配置编译器 - How to configure compiler for WSL and visual studio code 如何配置CMake以便生成的Visual Studio项目找到可执行文件? - How to configure CMake so that the generated Visual Studio project finds the executable? 如何在Visual Studio Visual C ++ Win32项目中查看主窗体,以便编辑它? - How can I view the main form in a Visual Studio Visual C++ Win32 Project so I can edit it? 如何在Visual Studio 2010中查看C ++函数的已编译机器代码或字节代码? - How do I view the compiled machine code or byte code for a C++ function in Visual Studio 2010? 无法在Visual Studio窗口中打开文件 - not opening file in visual studio windows 如何复制已打开的文件? - how to copy already opened file? 如何在Android中调试Visual Studio 2017生成的C ++代码.SO文件和其他第三方库? - How to debug visual studio 2017 generated C++ code .SO file and others third party libraries in android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM