Visual Studio 2010,如何在方法调用中使用代码片段
我从 Visual Studio 2008 迁移到 Visual Studio 2010。
我的代码片段在 Visual Studio 2010 中的行开头运行良好,但在向方法调用添加参数时运行不佳。这在 Visual Studio 2008 中确实有效。
所以当我输入:“DoSomeMethod([nowiwantmycodennippets!]
”时,代码片段不在智能感知列表中。
有谁知道这是否是一个设置,或者只是不再工作了,是否可以修复?
I moved from Visual Studio 2008 to Visual Studio 2010.
My code snippets work good in Visual Studio 2010 on the start of a line, but not when adding parameters to a methodcall. This did work in Visual Studio 2008.
So when i type this : "DoSomeMethod([nowiwantmycodennippets!]
", the code snippets are not in the intellisense list.
Does anyone know if this is a setting, or just not working anymore, and if it can be fixed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这似乎是错误。如果您键入代码片段名称(即 noiwantmycodesnippets)并按 ESC 键关闭完成列表(如果打开),则可以按 Tab 插入代码片段。所以这只是完成列表中缺少代码片段的问题。
您还可以使用
Control+K、Control+X
键和弦来显示代码片段列表。但这并不像通过完成列表使用它那么好。This appears to be bug. If you type your snippet name (i.e. noiwantmycodesnippets) and press ESC to dismiss the completion list (if open), then you can press Tab to insert your code snippet. So it's just a matter of the code snippets missing from the completion list.
You can use the
Control+K, Control+X
key chord to show the code snippets' list also. But this isn't as nice as using it through the completion list.您使用ReSharper吗?如果是这样,Resharper Intellisense 会覆盖 VS 默认的,以便 ie 代码片段不会出现在补全中。尝试在 ReSharper 选项中关闭 ReSharper Intellisense(环境 -> Intellisense -> 常规,选择 Visual Studio)。
如果 ReSharper Intellisense 是必须的,那么您必须创建一个 ReSharper“实时模板”,该模板可用于“代码片段”行为,只有 ReSharper 更先进——例如,请参阅这个 http://www.brianlow.com/index.php/2009/04/06/resharper-live-templates-for-nunit/。
Are you using ReSharper? If so, Resharper Intellisense overwrites the VS default one, so that i.e. code snippets do no appear in the completions. Try turning off ReSharper Intellisense in the ReSharper Options (Environment->Intellisense->General, choose Visual Studio).
If ReSharper Intellisense is a must, you'll have to create a ReSharper "Live Template" which opens up for "code snippets" behaviour, only ReSharper is way more advanced -- see for example this one http://www.brianlow.com/index.php/2009/04/06/resharper-live-templates-for-nunit/.
在我的机器上,我只需输入“public void Test(”,然后按 ctrl+space,然后输入我的代码片段的名称。效果就像一个魅力。我想,我有 C# 键盘快捷键。
On my machine I just type "public void Test(" and than ctrl+space and type the name of my snippet. Works like a charm. I've got the C# keyboard shortcuts, I think.