Closed Devid-Ba closed 3 months ago
doc string formatter issue.
Looking at this in the context of supporting restructured text. Builtins are not in restructured text format.
The docstring for dict for example is this:
dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
Parsing this into rest, it's just one big paragraph.
Paragraphs (when shown in Markdown) eliminate extra tabs on purpose. Otherwise something like this wouldn't wrap correctly:
this is a paragraph with extra
lines that continue after a tab.
Builtins may then have to be formatted literally. Or at least special cased to add literal indents.
This issue has been fixed in prerelease version 2024.6.100, which we've just released. You can find the changelog here: CHANGELOG.md
The fix for this issue is behind an experimental feature flag:
"python.analysis.supportRestructuredText": true
If you want to try out our new restructuredText support, enable this flag. It's behind a flag at the moment until we can make sure it handles all the possible Sphinx/GoogleDoc/Epytext scenarios that customers need. Please log additional issues if this setting isn't working out for you.
Thanks :)
Environment data
Code Snippet
Repro Steps
dict()
Expected behavior
newline after
d = {}
.Actual behavior
screen shot from![Screenshot from 2022-07-31 17-33-37](https://user-images.githubusercontent.com/97880699/182052810-5feb9381-7f00-40fe-8909-4d6484fb2292.png)
help(dict)
Logs