Skip to content

Comment in chained method call pulled to previous line, indentation lost #1958

@mafredri

Description

@mafredri

While reporting #1957 I noticed that given two chained method calls and a comment in-between, the comment was pulled to the previous line and indentation for the continuation was lost.

Input:

angular.module('AngularAppModule')
  // Hello, I am comment.
  .constant('API_URL', 'http://localhost:8080/api');

Output:

angular.module('AngularAppModule')// Hello, I am comment.
.constant('API_URL', 'http://localhost:8080/api');

Expected:

Either no difference between input and output, or:

angular
  .module('AngularAppModule')
  // Hello, I am comment.
  .constant('API_URL', 'http://localhost:8080/api');

Reproduction can be found here.

Problem goes away after a third chained method call is added.

Sidenote: Sorry for the issue bombardment, I really appreciate all the work you put into prettier and I think it' awesome! Keep up the good work :-).

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions