Skip to content

Incorrect indent when methods are chained to inline new instance #435

@paustint

Description

@paustint

Sorry for the cryptic title!

Everything is indented as if the new keyword does not exist.

# Prettier options (if any):
{
  "trailingComma": "none",
  "apexInsertFinalNewline": false,
  "singleQuote": true,
  "printWidth": 140,
  "overrides": [
    {
      "files": "**/classes/**/*.cls",
      "options": { "tabWidth": 4 }
    },
    {
      "files": "**/lwc/**/*.html",
      "options": { "parser": "lwc", "tabWidth": 4 }
    },
    {
      "files": "*.{cmp,page,component}",
      "options": { "parser": "html", "tabWidth": 4 }
    }
  ]
}

Input:

new Flow.Interview.Termination_Handle_Legal_Comments_and_Chatter_Posts(new Map<String, Object>{ 'varCaseId' => currCase.Id, 'varAccountId' => currCase.AccountId, 'varType' => chatterType }).start();

Actual output:

new Flow.Interview.Termination_Handle_Legal_Comments_and_Chatter_Posts(
        new Map<String, Object>{ 'varCaseId' => currCase.Id, 'varAccountId' => currCase.AccountId, 'varType' => chatterType }
    )
    .start();

Additional example

new Flow.Interview.Termination_Handle_Legal_Comments_and_Chatter_Posts(
        new Map<String, Object>{
            'varCaseId' => currCase.Id,
            'varAccountId' => currCase.AccountId,
            'varSalesRep' => currCase.Sales_Rep__c,
            'varType' => chatterType
        }
    )
    .start();

Expected output:

// prettier-ignore
new Flow.Interview.Termination_Handle_Legal_Comments_and_Chatter_Posts(
        new Map<String, Object>{ 'varCaseId' => currCase.Id, 'varAccountId' => currCase.AccountId, 'varType' => chatterType }
)
.start();

Additional information (please fill this out):

  • OS: OSX
  • Version: "prettier-plugin-apex": "^1.10.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions