Skip to content
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

Automatic docstring word wrapping #3794

Closed
VolkerSiep opened this issue Dec 30, 2022 · 5 comments
Closed

Automatic docstring word wrapping #3794

VolkerSiep opened this issue Dec 30, 2022 · 5 comments

Comments

@VolkerSiep
Copy link

My experience with VS Code and pylance so far is: If I miss a feature, it's just because I didn't find it yet. I assume the same to be the case here, that's why I'd like to ask carefully:

When writing docstrings (for using sphinx/autodoc), I would like the text to wrap lines and indent automatically for connected pieces of text. Ideally even, when editing the text, it should re-arrange the lines to avoid too long or unnecessarily short lines.

image
.. should be converted to ..
image

And, then, when I edit the comment:
image
... it should ideally rearrange it as follows:
image

Does this functionality already exist 😄 ?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 3, 2023

Is this what you're looking for?

image

Setting that value to 'wordWrapColumn', it automatically wraps at the 80th column.

@rchiodo rchiodo closed this as completed Jan 3, 2023
@rchiodo
Copy link
Contributor

rchiodo commented Jan 3, 2023

Granted that's not specific to doc strings. It applies to everything.

@VolkerSiep
Copy link
Author

Hi, thanks for answering. But it's not really solving it, as this only wraps the view of the line, but the line is actually long, and pylint complains (and is imho right) about it.

image

So I was looking for something that splits and indents the line, so that the file content remains according to PEP standard - like other things get corrected with the "Format Selection" feature (which btw. leaves such long line comments in peace).

However, I must say, by writing the documentation with word-wrap enabled in connected paragraphs, it is then already much easier to just insert the line feeds when done.

@DevJake
Copy link

DevJake commented Feb 13, 2025

Anything on this? It'd be really helpful for when you're mass editing docstrings, to have those longer lines automatically folded to the correct length. I have tried extensions for this, but they seem to always struggle with lists, and code blocks

@rchiodo
Copy link
Contributor

rchiodo commented Feb 13, 2025

No, sorry it's not something we have on our backlog. I recommend adding an enhancement request to the discussions so people can up vote it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants