Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Code To DocNew to Visual Studio Code? Get it now.
Code To Doc

Code To Doc

YAKAZAKI

|
18 installs
| (0) | Free
Generate JSDoc comments for your code using Gemini.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Code To Doc

A Visual Studio Code extension that generates JSDoc comments for your JavaScript and TypeScript code using Google Gemini's API. Enhance your codebase with clear, professional documentation automatically!


Features

  • Generate JSDoc comments for selected code or the entire file.
  • Works for functions, classes, and other code blocks.
  • Seamless integration with Google Gemini for high-quality documentation generation.
  • Supports JavaScript and TypeScript.
  • Securely store and manage your Gemini API key.

Usage

1. Set Gemini API Key

Before using the extension, you need to set your Google Gemini API key:

  1. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
  2. Search for and run the command Set Gemini API Key.
  3. Enter your Gemini API key (e.g., AIzaSy...).
    • The key is securely stored using VS Code's SecretStorage.

2. Generate Documentation

To generate documentation:

  1. Select a Block of Code:

    • Highlight the function, class, or code snippet you want to document.
    • If nothing is selected, the extension will use the entire file.
  2. Run the Command:

    • Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
    • Search for and run the command Generate Documentation.
  3. View the Output:

    • The generated JSDoc comment will be inserted above the selected code or at the top of the file.

Example

Input Code:

function addNumbers(a, b) {
  return a + b;
}

Output Code:

/**
 * Adds two numbers together.
 *
 * @param {number} a - The first number to add.
 * @param {number} b - The second number to add.
 * @returns {number} The sum of the two numbers.
 *
 * @example
 * // returns 5
 * addNumbers(2, 3);
 *
 * @example
 * // returns 10
 * addNumbers(7, 3);
 */
function addNumbers(a, b) {
  return a + b;
}

Requirements

  • Node.js v16+
  • A Google Gemini API key (get one from Google AI Studio).

Extension Settings

This extension uses the following commands:

  1. Set Gemini API Key:

    • Command: codeToDoc.setGeminiApiKey
    • Use this to store your Gemini API key securely.
  2. Generate Documentation:

    • Command: codeToDoc.generateDocumentation
    • Use this to generate JSDoc comments.

Known Issues

  • Limited support for non-JavaScript/TypeScript code.
  • Requires an active Gemini API key, which may have usage limits.

Contributing

Contributions are welcome! If you’d like to contribute:

  1. Fork this repository.
  2. Create a new feature branch.
  3. Submit a pull request.

Support

If you encounter any issues or have questions, feel free to reach out via GitHub Issues or email.


License

This extension is licensed under the MIT License. See LICENSE for more details.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft