Fix for Issue #384: typehints_defaults = "braces-after" fails for a multiline :param:
entry
#464
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is another quick fix.
The fix advances the line to the last line of the last
:param:
paragraph by detecting either that the next line is empty or has no indentation and placing the default at the end of the last nonempty line.I've read somewhere else that rst docstring spec does not explicitly mention anything about multiline argument descriptions, but I understand it is widely accepted to use hanging indentation.
@gaborbernat & @hoodmane - One thing I'm not sure of is the handling of a multi-paragraph
:param:
description. It is likely rare to document in such a way. But when it does, should the default be placed at the end of the first or the last paragraph?I've gone with the latter for now, but I can see myself preferring the default to appear on the first paragraph when it happens. (2nd+ paragraphs for in-depth descriptions.) Ultimately, we can add a new option for it, but a default behavior must be set regardless. The current on-the-last-paragraph implementation is simply the last one I thought of, and I can go either way. Let me know what you guys think, and I'd be happy to modify to suit your preference.