- Docstrings - In-code documentation for functions, classes, and methods (available via code lenses or direct prompting)
- Generic Documentation - README files, API docs, and module documentation (available via prompting)
Docstring Generation
Docstrings are structured comments embedded directly in your code that document functions, methods, and classes. They follow language-specific conventions (Python docstrings, JSDoc for JavaScript/TypeScript, PHPDoc for PHP, Javadoc for Java, etc.) and are used by IDEs for tooltips, API documentation generators, and code intelligence features. Unlike generic documentation that might live in separate files, docstrings stay with the code they describe.How to Generate Docstrings
There are two methods to generate docstrings with Zencoder:- Using Code Lenses - The fastest way to add documentation directly in your editor
- Direct Prompting - Generate docstrings and general documentation through the chat interface with custom requirements
Using Code Lenses
VS Code Code Lenses
When you open a file in VS Code, you’ll see aZencoder
code lens above your functions, classes, and methods.1
Click the Zencoder Code Lens
Click on the 
Zencoder
code lens that appears above your code
2
Select Add Doc Comments
From the dropdown menu, select
Add doc comments
3
Review and Apply
Review the generated docstring and apply the changes
Direct Prompting
Generate docstrings through the chat interface when code lenses aren’t available or when you need more control:1
Highlight Your Code
Highlight the code snippet or function you want to document
2
Send to Chat
Right-click and select
Zencoder
> Insert Selection into Chat
or use Ctrl + L
(Windows) / CMD + L
(Mac) to copy the selection into the chat window3
Request Docstring Generation
Type a prompt into the chat, then hit submit. For example:
4
Apply the Generated Docstring
The generated docstring will include:
- Function/method purpose
- Parameter descriptions with types
- Return value details
- Exception information when applicable
Use specific prompts to match your project’s documentation standards:
Example: Before and After
Example of generated Python docstrings:Generic Documentation Generation
Generic documentation covers entire files, modules, or projects - things like README files, API documentation, architecture guides, and user manuals. This documentation lives in separate files rather than inline with code.How to Generate Broader Documentation
1
Open Zencoder's Chat Window
Access Zencoder by opening the chat window in your IDE or web interface
2
Enable the Coding Agent
Toggle on the
Coding Agent
feature to give Zencoder more capabilities for comprehensive documentation generation3
Enter Your Documentation Request
Type a clear prompt, such as:
4
Review and Apply
The generated documentation will include:
- Code purpose and functionality
- Component descriptions, parameters, and outputs
- Usage examples where applicable
Best Practices
- Be specific in your prompts - Include details about format, style guide, or specific requirements
- Provide context - Include surrounding code when generating docstrings for better accuracy
- Iterate as needed - Complex code may require refinement over multiple attempts
- Include your standards - Add team conventions or style guides to your prompts for consistency
Always review generated documentation before committing to ensure accuracy and compliance with your project standards.
Troubleshooting
Code lenses not visible?
Code lenses not visible?
VS Code:
- Go to the Zencoder menu in VS Code
- Select
Settings
- Enable
Zencoder Enable Code Lenses
- this shows Zencoder code lenses near defined symbols to ease access to Zencoder features
- Code lenses should be automatically visible in supported IDEs (PyCharm, IntelliJ IDEA, and most others)
- If code lenses are not visible in your JetBrains IDE, please reach out to our community support for assistance
Code lens availability may vary by IDE and version. If you’re experiencing issues, our community is here to help!