How to get parameter hints/completion in Visual Studio?
Asked Answered
U

4

23

I usually use Eclipse for coding, which has a pretty nice parameters completion feature: when you are calling a method, just after you typed (, it will show you the list of parameters, and highlight where you are as you type:

Example of parameters completion in Eclipse

How can I get similar help in Visual Studio 2012?

I know that Ctrl + K, Ctrl + I shows some info about what your cursor currently highlights, but it doesn't work if you already have started typing something. If I type MyMethod(arg1, and then hit the shortcut (or any other, such as Ctrl + Space or Ctrl + Shift + Space), I don't get anything useful.

Unstopped answered 10/7, 2013 at 22:36 Comment(0)
M
53

You can use:

Ctrl+Shift+Space. This brings up the argument list for a method your cursor is currently in.

Example:

typing

Pressing Ctrl+Shift+Space with the cursor after "a", results in:

ctrlshiftspace

You can check this is properly assigned in the keyboard settings, as Edit.ParameterInfo:

assigned

Marnimarnia answered 10/7, 2013 at 22:42 Comment(10)
It's supposed to, but it doesn't work. Where can I check that this was not reassigned?Unstopped
YOu can look in the Keyboard settings in Visual Studio. Tools > Options > Environment > Keyboard. Check that the default template is being used.Marnimarnia
I just did, and even hit the Reset button: still nothing. Could the feature be disabled somehow?Unstopped
Yes, it is. I'm starting to despair... Thanks a lot for your help by the way, nice screenshots!Unstopped
Is the intellisense functionality working at all? If you type an opening bracket do you get the list?Marnimarnia
No, not event. I can get completion on variables and methods though, but I never get it for parameters.Unstopped
Well, I'll be damned: I restarted VS2012, and lo and behold!, it works. Sorry for wasting your time, thanks again for your help.Unstopped
Does VS show parameters after each comma, or am I dreaming this up?Disconsider
@Disconsider It should. I had the same problem that Wookai was having - Parameter Info Intellisense was not showing up despite me not messing with the default settings/keybindings. I also had to restart visual studio and then it worked fine.Buckley
Is there support for this feature on mac? I have been unable to find it if so.Goodell
E
6

For my case, neither Ctrl+Shift+Space nor Ctrl+K+P work.. eventually I nailed it down to this settings:

Visual Studio Text Editor Intellisense

Now whenever I typed (, intellisense will automatically pop up!.. nice!

As it turned out, this is caused by Resharper..., the Resharper uninstall doesn't correctly restore the original Visual Studio settings.

Elsaelsbeth answered 19/10, 2015 at 9:7 Comment(1)
This is such an underrated answer, this is exactly what should be turned on by default.Heartburn
U
1

Since Visual Studio 2019 you can get inline parameter name hints as well. It can be activated under Text Editor -> C# -> Advanced. Check Display inline parameter name hints.

enter image description here

Parameters will then show up like this in UI:

enter image description here

Unsaid answered 28/9, 2023 at 10:0 Comment(0)
S
0

visual studio 2019

you can add a button to tool bar:

view>toolbar> text editor.

Then:

view>toolbar>Customize:

Select commands tab.

Select Toolbar radio button.

On toolbar dropdown select Text Editor.

command location Press "add new command.

Select Edit [wait to populate].

Select parameter Info. command image.

Hope this helps.

Stenophyllous answered 11/2, 2020 at 1:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.