locked
Macro: to add parameter names to method calls RRS feed

  • Question

  • before i re-invent the wheel...

    Does any one know of a macro (or an add-in) that will add parameter names to a method call? Eg that will change:

    MyClass.MyMethod(A,B,C)

    to

    MyClass.MyMethod(Parameter1:=A, Parameter2:=B, Parameter3:=C)

    I'm working on code that has a lot of method calls with many parameters, trying to figure out which value goes to which parameter is causing my brain to ache.

    Thanks in advance

    Paul.


    • Edited by SignOut Tuesday, December 6, 2011 1:51 PM misspelling
    Tuesday, December 6, 2011 1:50 PM

Answers

  • Hi Signout,

    I don't think we have such exsiting marco for you.

    Howerver, Intellisence is real helpful for this case. You can use "Display Parameter Info" (Ctrl+Shift+Space) to show the information of the fuction parameters.

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us

    • Edited by Yi Feng Li Wednesday, December 14, 2011 7:44 AM
    • Marked as answer by Yi Feng Li Monday, January 9, 2012 6:45 AM
    Wednesday, December 14, 2011 7:43 AM

All replies

  • Hi SignOut

    The expression like "Parameter:= value" in a method call is a VB.Net build-in specific feature, it should be accepted by anyVB.Net code, includes Visual Studio Marco and VS addin (written by VB.net).

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 8, 2011 3:57 AM
  • Sorry i guess i wasn't clear enough:

    I'm looking for a macro which will add the parameter names to existing code in the solution (on a case by case basis).

    Ie, that will change

    MyClass.MyMethod(A, B, C)

    to

    MyClass.MyMethod(Parameter1:=A, Parameter2:=B, Parameter3:=C)

    I'm working on code (written by others) that has method calls that are difficult to read due to the large number of positional arguments; being able to change those positional arguments to named arguments would make the job of understanding the code a bit easier.



    • Edited by SignOut Thursday, December 8, 2011 4:05 PM emphasis
    Thursday, December 8, 2011 10:59 AM
  • Hi Signout,

    I don't think we have such exsiting marco for you.

    Howerver, Intellisence is real helpful for this case. You can use "Display Parameter Info" (Ctrl+Shift+Space) to show the information of the fuction parameters.

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us

    • Edited by Yi Feng Li Wednesday, December 14, 2011 7:44 AM
    • Marked as answer by Yi Feng Li Monday, January 9, 2012 6:45 AM
    Wednesday, December 14, 2011 7:43 AM