I know this sounds crazy, but here's my edge case: In a file with windows-style line endings, which is also using tabs for indentation, the comments seem to be indented wrong.
Example input:
class Foo {
/**
* Comment indented with tabs in file with utf-8[dos]
*/
private $foo;
}
Output:
class Foo
{
/**
* Comment indented with tabs in file with utf-8[dos]
*/
private $foo;
}
I didn't manage to reproduce this in a test, it only breaks when i run prettier directly through the CLI 馃槙
/cc @vjeux @azz how we can tests windows, looks like tests remove windows lines
@evilebottnawi prettier shouldn't remove windows line ending. It has special logic to detect the line type and use it everywhere:
https://github.com/prettier/prettier/blob/13103101ebd6bc563fb6cc765186244b90d8300e/index.js#L20-L26
https://github.com/prettier/prettier/blob/master/src/doc/doc-printer.js#L201
Just stumbled over this line, which is probably the reason that i wasn't able to reproduce the issue in a test:
@czosel I haven't been able to reproduce this... can you confirm if this is still happening? Also adding a test here https://github.com/prettier/plugin-php/pull/406
@mgrip Looks like this has been fixed somewhere along the way (probably when we refactored comment printing) 馃憤