Any idea for how to get a comment's indentation _after_ formatting?
Running Prettier twice is supposed to give the same output. There does however not appear to be a good way to figure out what a comment's indentation will be after code formatting. We therefore wrap lines at a comment's current width, but not at the width it will have after the rest of the file has been formatted:
/**
* Example example example
*/
will become:
/**
* Example example
* example
*/
which will then become:
/**
* Example example example
*/
I do run into this issue when reorganizing code.
There is a function in Prettier's API, printComment, but it is not nearly as pluggable and would require us to extend Prettier's non-exposed estree printer.
printComment is so interested. These functions (printComment, canAttachComment, isBlockComment, handleComments, ownLine) are so useful for us, but I don't test these before.
Documentation for printComment is not so clear I added it to parser object but never called I don't know why