prettier-plugin-solidity
prettier-plugin-solidity copied to clipboard
Grouping all comments in a chain at the beginning of it
addressing some issues with comments in chains. #644
For now we are grouping comments at the beginning of the chain.
This is a good first step however we must address some questions if we want to continue with this approach.
first of all in this scenario:
// Original
begin.
// Comment 1
functionCall(/* Comment about parameter */ parameter).
// Comment 2
end;
// Formatted
// Comment 1
// Comment 2
begin.
functionCall(/* Comment about parameter */ parameter).
end;
This is the expected behaviour but the order of the comments is not the same anymore. Therefore the AST comparison will fail.
Shall we remove the comments from the AST comparison understanding that Prettier already has a lot of security making sure that each comment will be printed?
In this case we are making new advances since Prettier JS does mess up with the order of the comments when the chain get a bit complex and also the indentation.
Thoughts @fvictorio @mattiaerre
there are some more ideas I have but for now this is a good first step.