Visual Studio片段是否可能? [英] Is this possible with Visual Studio snippets?
问题描述
我使用TODO注释的修改形式(SteveC_TODO),该注释使我可以在任务列表中将自己的待办事项分组在一起.
I use a modified form of TODO comment (SteveC_TODO) that allows me to group my own todos together in the task list.
昨天我认为最好修改重构代码片段,以便为通常的NotImplemented异常添加待办事项注释.我修改了方法存根-正文"片段
Yesterday I thought it would be nice to modify the refactoring snippets to add a todo comment to the usual NotImplemented exception. I modified the Method Stub - Body snippet to this
$signature$
{
//SteveC_TODO: implement $end$$signature$
throw new $Exception$();
}
但是这会导致todo注释具有完整的方法签名.它达到了目的,但是我希望注释仅使用方法签名中的名称,并且形式为
but this results in the todo comment having the full method signature. It serves the purpose but I would prefer the comment to only use the name from the method signature and be of the form
//SteveC_TODO: implement CoolMethod
而不是形式
//SteveC_TODO: implement private void CoolMethod(object o)
有人知道我可以做到这一点吗?我认为传递给重构片段的参数是固定的,但是也许有一种方法可以解析$ signature $参数以仅提取名称.有人知道这是否可能吗?
Does anyone know of a way that I can do this? I presume that the arguments passed to refactoring snippets are fixed but perhaps there is a way to parse the $signature$ argument to extract just the name. Anyone know if that might be possible?
推荐答案
我认为您必须将其修改为类似的内容
I think you have to modify it to something like
$accessability$ $returntype$ $method$($arguments$)
{
//SteveC_TODO: implement $method$
$end$throw new $Exception$("The method or operation is not implemented.");
}
您必须声明文字的可访问性,返回类型,方法,参数...
You have to declare the literals accessability, returntype, method, arguments,...
在这里查看如何创建代码段
这篇关于Visual Studio片段是否可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!