ruff/crates/ruff_python_formatter/src
konsti b6c4074836
Insert newline between docstring and following own line comment (#8216)
**Summary** Previously, own line comment following after a docstring
followed by newline(s) before the first content statement were treated
as trailing on the docstring and we didn't insert a newline after the
docstring as black would.

Before:
```python
class ModuleBrowser:
    """Browse module classes and functions in IDLE."""
    # This class is also the base class for pathbrowser.PathBrowser.

    def __init__(self, master, path, *, _htest=False, _utest=False):
        pass
```
After:
```python
class ModuleBrowser:
    """Browse module classes and functions in IDLE."""

    # This class is also the base class for pathbrowser.PathBrowser.

    def __init__(self, master, path, *, _htest=False, _utest=False):
        pass
```

I'm not entirely happy about hijacking
`handle_own_line_comment_between_statements`, but i don't know a better
spot to put it.

Fixes #7948

**Test Plan** Fixtures
2023-10-30 13:18:54 +00:00
..
comments Insert newline between docstring and following own line comment (#8216) 2023-10-30 13:18:54 +00:00
expression Inline ExprNumberLiteral formatting logic (#8340) 2023-10-30 14:09:38 +05:30
module Attach dangling comments to the comprehension instead of the if or iter nodes (#7693) 2023-09-29 10:45:01 +01:00
other Skip over parentheses when detecting in keyword (#8054) 2023-10-18 19:13:58 -04:00
pattern New Singleton enum for PatternMatchSingleton node (#8063) 2023-10-30 05:48:53 +00:00
snapshots Remove exception-handler lexing from unused-bound-exception fix (#5851) 2023-07-18 18:27:46 +00:00
statement Insert newline between docstring and following own line comment (#8216) 2023-10-30 13:18:54 +00:00
type_param Don't move type param opening parenthesis comment (#8163) 2023-10-24 12:02:27 +00:00
builders.rs Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00
cli.rs Add test and basic implementation for formatter preview mode (#8044) 2023-10-26 15:33:26 +00:00
context.rs Implement DerefMut for WithNodeLevel (#6443) 2023-08-11 10:41:48 +00:00
generated.rs Split Constant to individual literal nodes (#8064) 2023-10-30 12:13:23 +05:30
lib.rs Use source type to determine parser mode for formatting (#8205) 2023-10-25 19:20:02 +05:30
main.rs Formatter and parser refactoring (#7569) 2023-09-26 15:29:43 +02:00
options.rs Refine warning about incompatible isort settings (#8192) 2023-10-25 08:41:17 +01:00
prelude.rs Accept any Into<AnyNodeRef> as Comments arguments (#5205) 2023-06-20 16:49:21 +00:00
verbatim.rs Preserve trailing semicolons when using fmt: off (#8275) 2023-10-30 00:22:34 +00:00