Skip to content

DeveloperPuneet/CodeCharm

🧠 CodeCharm β€” AI-Powered Code Comment Generator for VS Code

CodeCharm is your intelligent VS Code extension that generates inline code comments using Google Gemini models. It uses your selected code and enhances it with emoji-rich, concise comments or refactors it for readability.

πŸš€ Now updated with multi-model fallback support and secure API key input!

Version Installs Downloads Rating Stars License

🌐 πŸ”— Visit CodeCharm Web


🌟 Features

  • ✍️ Generate inline code comments with emojis β€” clean and fun.
  • ♻️ Refactor messy code to improve readability.
  • ⌨️ Shortcut support:
    • Ctrl + Win + J β†’ Add Inline Comments
    • Ctrl + Win + G β†’ Refactor Code
  • πŸ” Model Fallback Support: Uses the following Gemini models in this order:
    1. gemini-2.0-flash-lite
    2. gemini-2.0-flash
    3. gemini-2.5-flash-lite
    4. gemini-2.5-pro
  • πŸ” Secure API Key Storage in VS Code settings.
  • 🧠 Uses your API key, no sharing required.
  • πŸ†• Execute cmd() instructions inside your code
    • Add a line like: cmd(import pandas) at the top of your code block.
    • CodeCharm will first apply your instruction (e.g., add imports, modify setup)
      and then generate inline comments or refactor the code.

      Tip: You can add a cmd() instruction before running CodeCharm

Example:

cmd(import pandas)
df = pd.DataFrame({...})

This will automatically insert the required import before processing.


πŸ”‘ Setup β€” Add Your API Key

To use CodeCharm, you'll need your own Google Gemini API key:

  1. Go to Google AI Studio.
  2. Copy your API key.
  3. Open VS Code.
  4. Press Ctrl + Win + J or Ctrl + Win + G for the first time.
  5. A secure input box will appear β†’ paste your key there.
  6. It will be saved automatically in:

Tip: You can add a cmd() instruction before running CodeCharm
Example:

cmd(import pandas)
df = pd.DataFrame({...})

This will automatically insert the required import before processing.

CodeCharm.zetaFlux in your VS Code settings.

πŸ” Your key stays local & secure β€” not shared or stored remotely.


πŸš€ How to Use

  1. Select a block of code.
  2. Press:
    • Ctrl + Win + J β†’ for inline comments
    • Ctrl + Win + G β†’ to refactor code
  3. CodeCharm will generate and replace your selection with an improved version.

Tip: You can add a cmd() instruction before running CodeCharm
Example:

cmd(import pandas)
df = pd.DataFrame({...})

This will automatically insert the required import before processing.


πŸ§ͺ Example Output

Before:

function getUser(id) {
  return db.query("SELECT * FROM users WHERE id = " + id);
}

After (Ctrl + Win + J):

function getUser(id) {
  return db.query("SELECT * FROM users WHERE id = " + id); // πŸ§‘β€πŸ’» Query user by ID
}

CodeCharm Demo

πŸ“¦ Extension Info

  • πŸ“ Extension ID: CodeCharm
  • πŸ‘¨β€πŸ’» Publisher: DeveloperPuneet
  • πŸ”— GitHub Repo: CodeCharm
  • 🧩 VS Code Version: ^1.50.0 and above
  • 🧠 AI Models Used:
    • gemini-2.0-flash-lite (primary)
    • gemini-2.0-flash
    • gemini-2.5-flash-lite
    • gemini-2.5-pro

πŸ›Ÿ Troubleshooting

  • ❌ Getting No Output or Errors?

    • Make sure your Gemini API key is valid.
    • If it's missing or expired, you'll be prompted to input it when you try using the extension.
    • To manually update or check your key:
      Settings β†’ Extensions β†’ CodeCharm β†’ zetaFlux
  • ⚠️ Network Errors?

    • Check your internet connection or if Google's Gemini API is reachable.
    • Avoid hammering it with hundreds of requests/minute β€” Google don’t play 😬

🧀 Contributions

  • πŸ’¬ Ideas, feature requests, and PRs are all welcome!
  • Fork it, star it ⭐, break it, rebuild it β€” just don’t write spaghetti 🍝
  • All feedback = good feedback, especially with emojis.

πŸ“œ License

MIT β€” Use it, hack it, improve it.
You break it, you own it. πŸ’₯

πŸ’¬ Built with brain, bugs & caffeine by @DeveloperPuneet
β€œIf your code can’t explain itself, at least let it drop some emoji bars 🎯.”

About

VS Code extension that adds AI-powered inline comments to selected code using Google Gemini. Simple, fast, and emoji-rich πŸ’¬βœ¨

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published