New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tall style: Preserve blank line between line comments and subsequent code? #1415
Comments
Are there any situations other than the top level header where we do this? If not, should we just specialize the behavior up until the first non-comment (or is that feasible)? |
+1 Removing blank lines between comments and top level code is probably fine? I anecdotally never see code that has really used that feature, besides the exception of the copyright header and the next code line. (But it would be good to get that working.) |
I see often in large files separations like "// something or other methods" and "// fields for such and such" and "// constructors." If a comment was previously separated from the thing after it, by a blank line, and suddenly becomes quite attached to the very next element, I can see confusion ensuing. |
Here is a good code search query to look at top-level examples in google3: |
Ah, I stand corrected. People do use standalone comments for categorizing. Preserving blank lines between comments & top level code 👍 |
Preserving blank lines between comments and code was mostly working correctly except for one edge case: A blank line between the *first* comment at the top level of a file and the subsequent code would get discarded. This fixes that. Fix #1415.
Preserving blank lines between comments and code was mostly working correctly except for one edge case: A blank line between the *first* comment at the top level of a file and the subsequent code would get discarded. This fixes that. Fix #1415.
The new in-progress style removes all blank lines between a comment and subsequent code when it occurs in a block or at the top level. For example, given:
It outputs:
This is different from the current style where it will preserve a blank line after a comment and the thing that follows it. This is particularly common to separate the initial copyright comment from subsequent code:
Should the new style do that? I suspect the answer is yes.
cc @natebosch @kallentu
The text was updated successfully, but these errors were encountered: