You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ CodeCharm is your intelligent VS Code extension that generates **inline code com
25
25
- ⌨️ **Shortcut support**:
26
26
-`Ctrl + Win + J` → Add Inline Comments
27
27
-`Ctrl + Win + G` → Refactor Code
28
+
-`Ctrl + Win + H` → Comment + Refactor (adds inline emoji comments AND refactors the code)
29
+
-`Ctrl + Win + K` → Run only the instruction inside `cmd()` (no other changes)
28
30
- 🔁 **Model Fallback Support**: Uses the following Gemini models in this order:
29
31
1.`gemini-2.0-flash-lite`
30
32
2.`gemini-2.0-flash`
@@ -40,7 +42,8 @@ CodeCharm is your intelligent VS Code extension that generates **inline code com
40
42
- 🆕 **Execute `cmd()` instructions inside your code**
41
43
- Add a line like: `cmd(import pandas)` at the top of your code block.
42
44
- CodeCharm will first apply your instruction (e.g., add imports, modify setup)
43
-
and then generate inline comments or refactor the code.
45
+
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.
46
+
- 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).
44
47
> **Tip:** You can add a `cmd()` instruction before running CodeCharm
45
48
> Example:
46
49
> ```js
@@ -60,6 +63,8 @@ To use CodeCharm, you'll need your **own Google Gemini API key**:
60
63
2. Copy your API key.
61
64
3. Open VS Code.
62
65
4. Press `Ctrl + Win +J` or `Ctrl + Win +G` for the first time.
66
+
- Or press `Ctrl + Win +H` to run both commenting and refactoring in one step.
67
+
- Press `Ctrl + Win +K` to run only the instruction inside `cmd()` in your selection.
63
68
5. A secure input box will appear → paste your key there.
64
69
6. It will be saved automatically in:
65
70
> **Tip:** You can add a `cmd()` instruction before running CodeCharm
@@ -82,6 +87,8 @@ To use CodeCharm, you'll need your **own Google Gemini API key**:
82
87
2. Press:
83
88
- `Ctrl + Win +J` → for inline comments
84
89
- `Ctrl + Win +G` → to refactor code
90
+
- `Ctrl + Win +H` → to both refactor and add inline emoji comments (follows any `cmd()` instructions)
91
+
- `Ctrl + Win +K` → to only execute the `cmd()` instruction and return the modified code (no other changes)
85
92
3. CodeCharm will generate and replace your selection with an improved version.
86
93
> **Tip:** You can add a `cmd()` instruction before running CodeCharm
@@ -99,18 +160,28 @@ async function activate(context) {
99
160
}
100
161
});
101
162
102
-
context.subscriptions.push(commentCommand,readableCommand,setApiKeyCommand);// Add subscriptions to context
163
+
context.subscriptions.push(commentCommand,readableCommand,combinedCommand,runCmdCommand,setApiKeyCommand);// Add subscriptions to context
103
164
104
165
vscode.window.showInformationMessage("💫 CodeCharm loaded!");// Show startup message
105
166
}
106
167
107
168
Additional_functionalies=`Before doing anything, check if the provided code contains a pattern like cmd(...); if found, treat the text inside cmd() as an instruction to modify the code first (for example, cmd(import pandas library) means you should add "import pandas as pd" at the top). If no cmd() is found, do not print any messages or placeholders—simply continue processing the code silently.`
? `You are a strict code-commenting assistant. Only add inline comments (4–5 words max) using emojis. Do NOT explain or return markdown. Return ONLY the modified code. ${Additional_functionalies} \n\n${code}`
113
-
: `Refactor this code for readability. Rename unclear variables, break down complex parts. DO NOT return explanation. ONLY the cleaned code. ${Additional_functionalies} \n\n${code}`;
prompt=`You are a strict code-commenting assistant. Only add inline comments (4–5 words max) using emojis. Do NOT explain or return markdown. Return ONLY the modified code. ${Additional_functionalies} \n\n${code}`;
175
+
}elseif(mode==="readability"){
176
+
prompt=`Refactor this code for readability. Rename unclear variables, break down complex parts. DO NOT return explanation. ONLY the cleaned code. ${Additional_functionalies} \n\n${code}`;
177
+
}elseif(mode==="both"){
178
+
prompt=`You are a code refactoring assistant. Thoroughly refactor the provided code to maximize readability while preserving behavior: rename unclear variables to descriptive names, simplify complex expressions and control flow, extract repeated or large blocks into helper functions, and improve formatting. After refactoring, add concise inline comments (4–5 words max) must using emojis to clarify intent. Do NOT include explanations or markdown — return ONLY the modified code (remove any cmd() lines or placeholders). ${Additional_functionalies} \n\n${code}`;
179
+
}elseif(mode==="cmd"){
180
+
constinstr=cmdInstruction ? cmdInstruction : "";
181
+
prompt=`You are a code assistant. There is an instruction inside cmd(): "${instr}". Apply ONLY that instruction to the provided code. Do NOT refactor, add comments, or provide explanations. Remove the cmd() line from the output. Return ONLY the modified code. ${Additional_functionalies} \n\n${code}`;
0 commit comments