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
git commit -m "feat(cpp-templates): Smart C++ debug template generation
- Auto-parse test data from markdown
- Detect types (vector<string>, vector<int>, etc.)
- Extract real method names
- Match parameter counts
- Decode HTML entities
- Updated docs and dependencies"
| 🔧 **Enhanced C++ Templates**| Auto-generated headers and improved code templates| ✅ **NEW**|
37
+
| 🔧 **Enhanced C++ Debug Templates**| Auto-generated debug code with smart type detection and real method names ([📹 Demo](docs/gifs/output.gif))| ✅ **NEW**|
20
38
| 🌍 **Multi-endpoint Support**| Full support for both LeetCode.com and LeetCode.cn | ✅ **ENHANCED**|
21
39
| 📊 **Historical Tracking**| Access to 30 days of daily challenge history | ✅ **NEW**|
22
40
| 🌐 **Translation Support**| Localized content support for daily challenges | ✅ **NEW**|
@@ -69,6 +87,116 @@ LeetCode Explorer
69
87
70
88
---
71
89
90
+
## 🔧 Enhanced C++ Debug Templates
91
+
92
+
### 🎯 What It Does
93
+
The **Enhanced C++ Debug Templates** feature provides intelligent auto-generation of debug code for C++ problems, making testing and debugging significantly easier.
| 🎯 **Method Name Extraction**| Extracts real method names from problem code |`auto result = sol.twoSum(arr1, num2);` instead of `someMethod`|
101
+
| 📊 **Parameter Count Matching**| Uses only the required number of parameters based on function signature | Function expects 2 params → uses first 2 from test data |
102
+
| 🔄 **HTML Entity Decoding**| Properly handles `"` → `"` and other HTML entities | Clean string values without encoding artifacts |
103
+
| 🎨 **Deduplication**| Removes duplicate test data while preserving order | No repeated values in generated template |
104
+
| 📝 **Markdown Parsing**| Extracts test data from problem descriptions automatically | Parses `Input: nums = [2,7,11,15], target = 9`|
105
+
106
+
### 🖼️ Before vs After
107
+
108
+
#### Before (Original Extension):
109
+
```cpp
110
+
// @lc code=start
111
+
classSolution {
112
+
public:
113
+
vector<int> twoSum(vector<int>& nums, int target) {
114
+
115
+
}
116
+
};
117
+
// @lc code=end
118
+
```
119
+
120
+
#### After (Enhanced Fork):
121
+
```cpp
122
+
#include<iostream>
123
+
...<headers>...
124
+
usingnamespacestd;
125
+
126
+
/*
127
+
* @lc app=leetcode id=1 lang=cpp
128
+
*
129
+
* [1] Two Sum
130
+
*/
131
+
132
+
// @lc code=start
133
+
classSolution {
134
+
public:
135
+
vector<int> twoSum(vector<int>& nums, int target) {
136
+
137
+
}
138
+
};
139
+
// @lc code=end
140
+
141
+
intmain()
142
+
{
143
+
Solution sol;
144
+
145
+
// Тестовые данные:
146
+
vector<int> arr1 = {2, 7, 11, 15};
147
+
int num2 = 9;
148
+
vector<int> arr3 = {3, 2, 4};
149
+
int num4 = 6;
150
+
vector<int> arr5 = {3, 3};
151
+
152
+
auto result = sol.twoSum(arr1, num2);
153
+
154
+
155
+
return 0;
156
+
}
157
+
158
+
```
159
+
160
+
### 🎬 Live Demo
161
+
162
+
**Watch the Enhanced C++ Debug Templates in action:**
163
+
164
+

165
+
166
+
*The demo shows:*
167
+
- 🔍 **Automatic parsing** of Input examples from problem description
168
+
- 🧠 **Smart type detection** (`vector<string>`, `vector<int>`, `int`, etc.)
169
+
- 🎯 **Real method name extraction** (`twoSum`, `longestCommonPrefix`, etc.)
170
+
- ⚡ **Instant template generation** with properly typed variables
171
+
- 🔧 **Parameter count matching** (only uses required number of params)
172
+
173
+
### 🚀 How It Works
174
+
175
+
1.**Extract Test Data**: Parses problem description for `Input:` examples
176
+
2.**Decode HTML**: Converts HTML entities (`"` → `"`) to clean values
177
+
3.**Detect Types**: Analyzes values to determine C++ types
178
+
4.**Extract Method**: Finds real method name and parameter count from code
179
+
5.**Generate Template**: Creates properly typed variables and method call
180
+
181
+
### 🎯 Supported Data Types
182
+
183
+
```cpp
184
+
// Arrays
185
+
vector<int> nums = {1, 2, 3}; // from [1,2,3]
186
+
vector<string> strs = {"a", "b", "c"}; // from ["a","b","c"]
187
+
188
+
// Primitives
189
+
string s = "hello"; // from "hello"
190
+
int target = 42; // from 42
191
+
double rate = 3.14; // from 3.14
192
+
bool flag = true; // from true
193
+
194
+
// Method calls with correct parameter count
195
+
auto result = sol.twoSum(nums, target); // Only uses required params
196
+
```
197
+
198
+
---
199
+
72
200
## 🔧 Technical Implementation
73
201
74
202
### 📊 Architecture Overview
@@ -91,7 +219,9 @@ graph TD
91
219
|**API Methods**|`src/leetCodeExecutor.ts`| GraphQL integration for daily challenges |
92
220
|**Cache Manager**|`src/explorer/explorerNodeManager.ts`| Smart caching and data management |
93
221
|**UI Integration**|`src/explorer/LeetCodeTreeDataProvider.ts`| Explorer tree integration |
0 commit comments