https://github.com/developerpuneet/codecharm
VS Code extension that adds AI-powered inline comments to selected code using Google Gemini. Simple, fast, and emoji-rich π¬β¨
https://github.com/developerpuneet/codecharm
ai ai-powered-tools ai-tool extension mit-license open-source tool vscode-extension vscode-tool
Last synced: 2 months ago
JSON representation
VS Code extension that adds AI-powered inline comments to selected code using Google Gemini. Simple, fast, and emoji-rich π¬β¨
- Host: GitHub
- URL: https://github.com/developerpuneet/codecharm
- Owner: DeveloperPuneet
- License: mit
- Created: 2025-07-13T05:01:36.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-10-23T10:16:40.000Z (8 months ago)
- Last Synced: 2025-10-23T12:22:17.370Z (8 months ago)
- Topics: ai, ai-powered-tools, ai-tool, extension, mit-license, open-source, tool, vscode-extension, vscode-tool
- Language: JavaScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=DeveloperPuneet.CodeCharm
- Size: 9.34 MB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# π§ 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**!
---
## π 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
- `Ctrl + Win + H` β Comment + Refactor (adds inline emoji comments AND refactors the code)
- `Ctrl + Win + K` β Run only the instruction inside `cmd()` (no other changes)
- π **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`
5. `gemini-2.0-flash-exp`
6. `learnlm-2.0-flash-experimental`
7. `gemini-2.0-flash-live`
8. `gemini-2.5-flash-live`
9. `gemini-2.5-flash-native-audio-dialog`
- π **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. You can also run the combined action with `Ctrl + Win + H` to perform both at once.
- Press `Ctrl + Win + K` to run only the `cmd()` instruction found in the selection (the extension sends only the `cmd()` instruction to the assistant and returns the modified code).
> **Tip:** You can add a `cmd()` instruction before running CodeCharm
> Example:
> ```js
> 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](https://aistudio.google.com/app/apikey).
2. Copy your API key.
3. Open VS Code.
4. Press `Ctrl + Win + J` or `Ctrl + Win + G` for the first time.
- Or press `Ctrl + Win + H` to run both commenting and refactoring in one step.
- Press `Ctrl + Win + K` to run only the instruction inside `cmd()` in your selection.
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:
> ```js
> 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
- `Ctrl + Win + H` β to both refactor and add inline emoji comments (follows any `cmd()` instructions)
- `Ctrl + Win + K` β to only execute the `cmd()` instruction and return the modified code (no other changes)
3. CodeCharm will generate and replace your selection with an improved version.
> **Tip:** You can add a `cmd()` instruction before running CodeCharm
> Example:
> ```js
> cmd(import pandas)
> df = pd.DataFrame({...})
> ```
> This will automatically insert the required import before processing.
---
## π§ͺ Example Output
### Before:
```js
function getUser(id) {
return db.query("SELECT * FROM users WHERE id = " + id);
}
```
## After (Ctrl + Win + J):
```js
function getUser(id) {
return db.query("SELECT * FROM users WHERE id = " + id); // π§βπ» Query user by ID
}
```
## π¦ Extension Info
- π **Extension ID**: `CodeCharm`
- π¨βπ» **Publisher**: [`DeveloperPuneet`](https://github.com/DeveloperPuneet)
- π **GitHub Repo**: [CodeCharm](https://github.com/DeveloperPuneet/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`
- + other fallback models
## π 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](https://github.com/DeveloperPuneet)
> *βIf your code canβt explain itself, at least let it drop some emoji bars π―.β*