Break Apart/Line Up Parameters/

Purpose

This Code Formatter is used to collapse the method parameters or arguments into a single line or break them apart.

Availability

Available when the caret is on a method parameter in the method declaration or method argument in its call.

Usage

Break Apart Parameters/Arguments

Follow the following steps to break the method parameters or arguments apart:

  1. Place the caret anywhere on a method parameter in the method declaration or method argument in its call.

    Note

    The blinking cursor shows the caret's position at which the Code Formatter is available.

    public CommandRegistration(IServiceProvider serviceProvider, Guid packageGuid, Guid cmdGroup) {
        this.serviceProvider = serviceProvider;
        this.packageGuid = packageGuid;
        this.cmdGroup = cmdGroup;
    }
    
  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Break Apart Parameters (Break Apart Arguments) from the menu.

BreakApart

After execution, the Code Formatter removes the line breaks and expands the method parameters to a multiple-line form.

public CommandRegistration(IServiceProvider serviceProvider,
                           Guid packageGuid, 
                           Guid cmdGroup) {
    this.serviceProvider = serviceProvider;
    this.packageGuid = packageGuid;
    this.cmdGroup = cmdGroup;
}
Note

You can configure the indentation of broken apart parameters and arguments in the Editor | <Language> | Code Actions | Break Apart Settings options page.

Line Up Parameters/Arguments

Follow the following steps to collapse the method parameters or arguments into a single line:

  1. Place the caret anywhere on a method parameter in the method declaration or method argument in its call.

    Note

    The blinking cursor shows the caret's position at which the Code Formatter is available.

    public void MergeStrings() {
            TestMethod("First Name",
            "FamilyName",
            25);
    }
    
  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Line Up Parameters or Line Up Arguments.

BreakApart

After execution, the Code Formatter removes the line breaks and converts the method parameters into a single-line form.

public void MergeStrings() {
            TestMethod("First Name", "FamilyName", 25);
}