Cool new little Editor feature in the Dec CTP – Edit.PasteParameterTip


It’s really the simple things in life. Ever had a long list of parameters for a method and didn’t want to have to look down at the tooltip to know where you were at in this list? Check out Edit.PasteParameterTip. Under the General Development Settings, it is mapped to Ctrl+Alt+Shift+P, but you can change this to whatever you want under Tools – Options – Keyboard.

For example, suppose the method Foo below contained 4 or 5 parameters.

this.Foo(

Leaving the cursor right after the open parenthesis (and the tooltip showing), hit Ctrl+Alt+Shift+P. Results…

this.Foo( int i, string j, int k, string l, int m, string n )

Now you can just update the parameters with your variables without having to follow along with the tooltip.

update 1/21/2005 – 2:30pm

By the way, there’s a corresponding Edit.CopyParameterTip Ctrl+Alt+Shift+C.  Forgot to mention earlier.

Comments (7)

  1. KevMar says:

    Thanks for the tip. I know I will find that handy.

  2. I wish you would comment out the types so the pasted code syntax is correct. Typically, i name my args with the same names as the params and this would be helpful. In your example, first thing I would have to do is remove the param types.

  3. David van Leerdam says:

    It would be even more useful (and not less readable) if it got pasted in this format:

    this.Foo( (int) i, (string) j, (int) k, (string) l, (int) m, (string) n )

  4. Alex says:

    I disagree you shouldn’t put (int) i,(string) j etc… in because that would give valid but superfluous code. Personally I’d prefer:

    foo(int1, string1, int2, string2, int3, string3)

    Which leaves you in no doubt as to what the parameters are, gives you less to delete and if if you are particulary lazy is actually valid code.

  5. OK, that is just too cool! Thanks!

  6. Juan Ignacio Gelos says:

    How about (int_paramName1, string_paramName2, …), and make each one an editable field like when you use an expansion code snippet, so we can Tab through and replace them?

    Now *that* would be nice.

  7. Keith Hill says:

    Neat feature but needs a better kbd shortcut. I really like what the C# team has done with kbd shortcuts by taking advantage of chorded kbd shortcuts. This feature could use a shortcut like Ctrl+K, Ctrl+H or something akin to that. Check with Anson Horton. I think he took over the keybindings.