vscode向类中添加函数的快捷方式或更简单的方法



我上下浏览了vscode文档,以找到一种在类中自动创建函数的方法,每次我向类添加方法时,我都需要复制定义并滚动到页面底部以实现该方法。

Clion有一套很棒的工具https://www.jetbrains.com/help/resharper/Code_Generation_in_CPP.html平等

我想知道是否有任何简单的方法,我可以用它来添加一个函数到一个类,而无需上下滚动文件

class HelloWorld
{
private:

public:

int IWantToDefineAMethod(); //<- need to scroll here and write this
};
int HelloWorld::IWantToDefineAMethod() //<-- then need to scroll to here and write this 
{
}
// and need to scroll here and there couple of time just to add a single function!

https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.cpp-helper

我不是创造者,我只是发现了它。

一个旁注是,它创建了原型的实现,但它不检查它是否重复,这在已知问题一节中描述。

你需要设置CppHelper.SourcePattern,让插件知道它应该在哪里搜索源文件。

Example:
"CppHelper.SourcePattern": [
"{FILE}.cpp",
"{FILE}.c",
"{FILE}.inl",
"/src/{FILE}.cpp"
]
Where {FILE} is your active header file name.

最新更新