fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

Comment between lines breaks indentation

Open pbiggar opened this issue 1 year ago • 1 comments

Issue created from fantomas-online

Code

5 =
  // a comment
  5

Result

5 =
// a comment
5

Problem description

By not indenting the second line, reformatting creates incorrect code.

Extra information

  • [x] The formatted result breaks my code.
  • [ ] The formatted result gives compiler warnings.
  • [ ] I or my company would be willing to help fix this.
  • [x] I would like a release if this problem is solved.

Options

Fantomas main branch at 1/1/1990

    { config with
                IndentSize = 2 }

pbiggar avatar Aug 08 '23 02:08 pbiggar

This is a bit tricky, I must admit. Dealing with the equals infix operator involves considering various complex scenarios. Tackling this without unintentionally causing new issues will definitely be a challenge.

I'd be happy to pair with someone if there are volunteers.

nojaf avatar Aug 16 '23 10:08 nojaf