简体   繁体   English

Visual Studio:如何在 IntelliSense 中显示重载?

[英]Visual Studio: How to show Overloads in IntelliSense?

Once code has been written, the only way I know of to view the overloads for a method is to actually edit the method by deleting the Parenthesis () and reopening them.编写代码后,我知道查看方法重载的唯一方法是通过删除括号()并重新打开它们来实际编辑方法。

Is there a shortcut key that I could press to activate this instead of having to edit my files?是否有一个快捷键可以让我按下来激活它而不必编辑我的文件?

For an example, please reference the ShowDialog Overload screen shot below:例如,请参考下面的ShowDialog Overload屏幕截图:

ShowDialog1 重载

With your cursor inside the parentheses, use the keyboard shortcut Ctrl - Shift - Space .将光标放在括号内,使用键盘快捷键Ctrl - Shift - Space If you changed the default, this corresponds to Edit.ParameterInfo .如果您更改了默认值,则这对应于Edit.ParameterInfo

Example:例子:

描述性屏幕截图,来自 jp2code

Ctrl + Shift + Space shows the Edit.ParameterInfo for the selected method, and by selected method I mean the caret must be within the method parentheses. Ctrl + Shift + Space显示所选方法的Edit.ParameterInfo ,通过所选方法,我的意思是插入符号必须在方法括号内。

Here is the Visual Studio 2010 Keybinding Poster .这是Visual Studio 2010 键绑定海报

And for those still using 2008 .对于那些仍在使用2008的人。

Tested only on Visual Studio 2010.仅在 Visual Studio 2010 上测试。

Place your cursor within the (), press Ctrl + K , then P .将光标放在 () 内,按Ctrl + K ,然后按P

Now navigate by pressing the / arrow keys.现在按 / 箭头键导航。

The default key binding for this is Ctrl + Shift + Space .默认的键绑定是Ctrl + Shift + Space The underlying Visual Studio command is Edit.ParameterInfo .基础 Visual Studio 命令是Edit.ParameterInfo

If the standard keybinding doesn't work for you (possible in some profiles) then you can change it via the keyboard options page如果标准键绑定对您不起作用(可能在某些配置文件中),那么您可以通过键盘选项页面更改它

  • Tools -> Options工具 -> 选项
  • Keyboard键盘
  • Type in Edit.ParameterInfo输入 Edit.ParameterInfo
  • Change the shortcut key更改快捷键
  • Hit Assign点击分配

It happens that none of the above methods work.碰巧上述方法都不起作用。 Key binding is proper, but tool tip simply doesn't show in any case, neither as completion help or on demand.键绑定是正确的,但工具提示在任何情况下都不会显示,既不是完成帮助也不是按需显示。

To fix it just go to Tools\Text Editor\C# (or all languages) and check the ' Parameter Information '.要修复它,只需转到Tools\Text Editor\C# (或所有语言)并检查“参数信息”。 Now it should work现在它应该可以工作了

Great question;好问题; I had the same issue.我遇到过同样的问题。 Turns out that there is indeed a keyboard shortcut to bring up this list: Ctrl+Shift+Space (a variation of the basic IntelliSense shortcut of Ctrl+Space).事实证明,确实有一个键盘快捷键可以显示此列表:Ctrl+Shift+Space(Ctrl+Space 的基本 IntelliSense 快捷键的变体)。

  • The command Edit.ParameterInfo (mapped to Ctrl + Shift + Space by default) will show the overload tooltip if it's invoked when the cursor is inside the parameter brackets of a method call.如果在光标位于方法调用的参数括号内时调用命令Edit.ParameterInfo (默认情况下映射到Ctrl + Shift + Space )将显示重载工具提示。

  • The command Edit.QuickInfo (mapped to Ctrl + K Ctrl + I by default) will show the tooltip that you'd see if you moused over the cursor location.命令Edit.QuickInfo (默认情况下映射到Ctrl + K Ctrl + I )将显示您将鼠标悬停在光标位置上时会看到的工具提示。

I know this is an old post, but for the newbies like myself who still hit this page this might be useful.我知道这是一篇旧帖子,但是对于像我这样仍然访问此页面的新手来说,这可能很有用。 when you hover on a method you get a non clickable info-box whereas if you just write a comma in the method parenthesis the IntelliSense will offer you the beloved info-box with the clickable arrows.当您将鼠标悬停在某个方法上时,您会得到一个不可点击的信息框,而如果您只是在方法括号中写一个逗号,IntelliSense 将为您提供带有可点击箭头的心爱的信息框。

每隔一段时间,上面的建议就会停止工作,如果我重新启动 Visual Studio,他们会再次开始工作。

Mine showed up in VS2010 after writing the first parenthesis..写完第一个括号后,我的出现在 VS2010 中。

so, prams.Add(所以,婴儿车。添加(

After doings something like that, the box with the up and down arrows appeared.做完这样的事情后,出现了带有上下箭头的框。

you mean's change overload.你的意思是改变过载。 just Press Shift + ↑ / ↓只需按 Shift + ↑ / ↓

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio Code:如何在 IntelliSense 中显示重载? - Visual Studio Code: How to show Overloads in IntelliSense? 如何在 Visual Studio 中使用键盘滚动智能感知重载 - How to scroll through intellisense overloads with keyboard in Visual Studio Visual Studio Intellisense如何工作? - How Visual Studio Intellisense works? 如何在Visual Studio的自动完成(intellisense)中查看构造函数? - How to see constructors in autocomplete (intellisense) of Visual Studio? 您如何修复 Visual Studio 以便它可以检测代码中的错误并在智能感知中显示所有选项? - How do you fix Visual studio so it can detect errors in code and also show all options in the intellisense? 如何在IntelliSense中为Visual Studio中的函数添加注释? - How to have comments in IntelliSense for function in Visual Studio? 如何为Visual Studio intellisense评论类的属性? - How to comment properties of a class for Visual Studio intellisense? 如何将按钮添加到Visual Studio Intellisense - How to add a button to Visual Studio Intellisense 如何在 Visual Studio 中更改 IntelliSense 自动完成功能? - How to change IntelliSense autocomplete in Visual Studio? 如何获取Visual Studio Intellisense工具提示以显示.NET Framework 3.5的说明? - How do I get Visual Studio Intellisense tooltips to show descriptions for .NET Framework 3.5?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM