-
Notifications
You must be signed in to change notification settings - Fork 180
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
Format comments of the form (*= xx *) as docstrings when parse-docstrings is set #1810
Conversation
a258c6b
to
eb421c7
Compare
I think that for comments that a user intends to be parsed as a docstring, if parsing fails, we need to give an error or warning. The syntax of docstrings is far too undocumented and unfamiliar to silently swallow parse failures. Additionally, the behavior of wrapping paragraphs when parsing fails is in many cases only a little different, making it very hard indeed for users to know what is going on. So since:
Currently, 3 is achieved be restricting the comments that are attempted to be parsed to While I am definitely in favor of parsing more comments as docstrings, and of eliminating the separate wrap comments option, it seems necessary to introduce a comment form to indicate that the comment should be parsed as a docstring, and report an error/warning if it does not parse. Setting aside implementation issues for the moment, are there objections to using the comment form |
1605dbf
to
a725e53
Compare
That sounds like a good idea to me, I've updated the PR to see what it would look like. Having to maintain a new syntax can indeed make the transition smoother for users. So far this new feature is relying on the So after this PR the next step would be to make all other comments verbatim? and thus deprecating the |
7a00daa
to
6ace8f0
Compare
6ace8f0
to
3b295ac
Compare
Would it be possible to do the reverse? E.g. by default parse every comment as a docstring, but add an escape hatch (mainly for ASCII arts). In that case |
It sounds reasonable to me. Following the discussion of #1804 we could then:
So far it's not really planned to deprecate |
Replaced by #2028 |
This is more of a RFC, based on the discussion started in #1804, as I sitll think removing
wrap-comments
in the long run is a good idea.Should replace #1747
The idea is:
wrap-comments
is set, it has the priority (until it is removed), so the comments are wrapped (same behavior asmain
branch)parse-docstrings
is set, parse comments as docstrings if they are valid docstrings, otherwise wrap each paragraphRunning test_branch.sh with
parse-docstrings=true
shows that a lot of comments should be fixed, but there is some issue with the fallback, characters are not properly escaped, I didn't have time to have a look yet.I didn't like the idea of introducing a new syntax to format a comment as docstring, as maybe some people will ask us later to keep maitaining this syntax if we want to remove it. To me it sounds good to have it enabled with
parse-docstrings
as long as the paragraph formatting is a good fallback.For the record,
wrap-comments
andparse-docstrings
are both disabled by default on all profiles.What do you think?
cc @ceastlund as this is a feature you have been interested in