Nifty Docstrings
Type three quotes under a Python function and get a Google, NumPy or Sphinx docstring with its arguments, types, returns and raises. PHPDoc, Rust and Go doc comments too.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features




- Python docstrings from the code. Type
""" on the line under a def or class and press Enter (or pick Generate docstring from the suggestions), or press Ctrl+Shift+2 anywhere in a function. You get the summary, every argument (with *args, **kwargs and defaults), the return value, yielded values and every exception the function raises. Raises inside nested functions are left out.
- Your style: Google, NumPy, Sphinx (reStructuredText) or a plain PEP 257 one-liner. Types come from annotations, or from the default value when there's none (
retries=3 is an int). Turn them off if your annotations say it all.
- Classes document their
__init__ arguments and the public attributes they set, including annotated class attributes. @property methods get a one-line summary.
- Tab through the placeholders to fill in each description.
- PHPDoc: type
/** above a function for @param (aligned, with nullable and variadic types), @return and @throws for each throw new. Above a property you get @var.
- Rust:
/// above a fn adds # Arguments, plus # Errors for Results, # Panics when the body can panic (unwrap, expect, panic!) and # Safety for unsafe fn. Attributes like #[inline] stay below the comment.
- Go:
// above a func or type starts the comment with its name, as go vet and golint expect.
- Works in the browser on vscode.dev and github.dev.
Commands
| Command |
Key |
What it does |
Nifty Docstrings: Generate Docstring |
Ctrl+Shift+2 |
Document the function or class at the cursor |
Settings
| Setting |
Default |
What it does |
nifty.docstrings.style |
google |
google, numpy, sphinx or pep257 |
nifty.docstrings.types |
always |
never leaves types to the annotations |
nifty.docstrings.quotes |
""" |
Quotes used by the command |
nifty.docstrings.generateOnEnter |
true |
Fill in the docstring on Enter after the opening quotes |
nifty.docstrings.rust.arguments |
true |
# Arguments section in Rust |
nifty.docstrings.rust.examples |
false |
# Examples section in Rust |
nifty.docstrings.languages |
all four |
Where to offer doc comments |
Install
- VS Code: search for "Nifty Docstrings" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Privacy
This extension collects no telemetry and needs no account.
- Nifty C# Templates: New Class, Record & Namespace: New C# class, interface, record, enum, test and controller files with the right namespace, plus namespace syncing. (Open VSX)
- Nifty Mermaid: Mermaid Diagram Preview & Export: Mermaid diagrams with no account: live preview beside .mmd files and Markdown, diagrams in the Markdown preview, syntax highlighting, and export to SVG or PNG. (Open VSX)
- Nifty Paste JSON as Code: JSON to Types: Turn JSON on your clipboard into types for TypeScript, C#, Go, Rust, Python, Java, Kotlin, Swift, Dart and more. (Open VSX)
- Nifty Code Runner: Run Code in 25+ Languages: Run the current file or selection in 25+ languages in the terminal, with input support, your own commands and no telemetry. (Open VSX)
- Nifty Docs: Dash, Zeal & DevDocs Lookup: Look up the word under the cursor in Dash, Zeal or DevDocs, with docsets picked from your language and frameworks. (Open VSX)
- Nifty Pretty Errors: Readable Error Messages: Readable error messages for every language: TypeScript types formatted as code, long C++ and Rust types folded, and a docs link for every error code, in the hover and a side panel. (Open VSX)
See all 35 Nifty tools at https://getnifty.dev
| |