Visual Studio Docstring Extension
While it’s perfectly possible to do docstring formatting manually, the autoDocstring
Visual Studio Code extension can be helpful for automatic formatting.
Demo
This gif demonstrates the power of using autoDocstring
(note that this is not the NumPy format and is for demonstration purposes only):
To automatically insert the docstring with proper formatting, you type three quotes, """
like a normal docstring, then hit Enter to let the extension automatically format the docstring.
How To Install
To get this extension:
- Open Visual Studio Code.
- Click the button on the far left menu that looks like 4 squares with one square being disconnected from the others. This is the extension tab.
- Search “autoDocstring” in the search bar.
- Click install. This automatically enables the autoDocstring extension.
- Type, Ctrl + Shift + P to open the Visual Studio Code Command Palette.
- Search for “Preferences: Open User Settings” and hit Enter.
- In the search bar for extensions, search for “autoDocstring” and hit Enter.
- Under the “Auto Docstring: Docstring Format” setting, select the NumPy docstring format.