打开cpp文件时自动打开头文件 [英] Automatically open a header file when cpp file is opened

查看:88
本文介绍了打开cpp文件时自动打开头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个扩展的想法,但我不知道是否有任何东西可以完成这项工作。

I've got an idea for an extension but I don't know if there is anything out there already that does the job.

我经常发现自己正在研究类,并经常在源和标题之间切换以纠正某些函数定义或添加新成员。我已经设置了一个显示器,其中一个显示器显示我正在处理的文件的标题,而
另一个显示cpp文件。但是我想更进一步,当我打开它的兄弟时,让工作室自动拉出我的另一台显示器上的配对文件。

I often find myself working on classes and having to switch between the source and header pretty often to correct some function definition or add a new member. I've got it set up where I have one monitor showing the headers for the files I'm working on while the other the cpp files. However I'd like to take it a step further and have the studio automatically pull up the paired file on my other monitor when I open its sibling.

我还希望能够跟踪我正在处理的源文件中的位置,并自动将标题滚动到该位置。例如,我说我开始在头文件中编辑一些方法,我想扩展打开相同的命名cpp文件并滚动
到我正在编辑的方法的定义,然后如果我切换到另一个编辑在同一个头文件中的定义,它会自动将已打开的cpp文件窗口滚动到该其他方法的位置。反之亦然。

I'd also like to be able to track where in the source file I'm working on and automatically scroll the header to that location. For example say I start editing some method in the header file, I'd like the extension to open the same named cpp file and scroll to the definition of the method I'm editing, then if I switch to editing another definition within that same header file it would automatically scroll the already open cpp file window to the location of that other method. And vise versa.

我想知道是否已经存在任何类似的扩展,并且用VS SDK编写它有多难?谢谢。

I'd like to know if any similar extension already exists and how difficult would it be to write this with the VS SDK? Thanks.

信仰确定我们所希望的以及我们未看到的某些内容。

Faith is being sure of what we hope for and certain of what we do not see.

推荐答案

在Visual Studio 2017中,如果您正在编辑CPP文件,可以按< Ctrl + K> <按Ctrl + O> (或< Ctrl + KO>)打开关联的
H文件,反之亦然。您还可以指定其他键,例如< Alt + O>。

如果在H文件中选择一个函数名称并按< F12>,这将转到CPP中的函数文件,反之亦然。另见< Alt + F12>。


这篇关于打开cpp文件时自动打开头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆