Goal: generate docstring in vscode for Python automatically and format the generated docstring to my liking.
Solution: I installed the autoDocstring extension.
Problem: I don't know how to get the generated docstring to be formatted the way I want it. In the description under the "Extension Settings" heading, it seems to suggest that you can change the default format with the "autoDocstring.docstringFormat" setting. My question is, how does one configure that setting? I've looked around and cannot find a solution.
Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, and methods. It's specified in source code that is used, like a comment, to document a specific segment of code.
How it works. Every time you press the Enter key in a python context, this extension will parse your python file up to the location of your cursor, and determine exactly how much the next line (or two in the case of hanging indents) should be indented and how much nearby lines should be un-indented.
You have to go to:
File > Preferences > Settings in Windows/Linux
Code > Preferences > Settings in Mac
Then choose at the right side of the open document if you want to change the configuration for all the user sessions or only this workspace.
The workspace case would be:
{
"autoDocstring.docstringFormat": "sphinx"
}
When moving the mouse around the option, a little pencil appears that shows all the accepted values for the option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With