- Notifications
You must be signed in to change notification settings - Fork679
🚀 Daily Challenges & Smart C++ Templates - Enhanced LeetCode VS Code Extension#999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
su-mt wants to merge12 commits intoLeetCode-OpenSource:masterChoose a base branch fromsu-mt:feature/daily-challenges
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
Show all changes
12 commits Select commitHold shift + click to select a range
7a94d61
feat: add daily challenges support
su-mt6632ba5
docs: add comprehensive fork documentation
su-mt9775350
docs: add comprehensive fork documentation
su-mt0424628
minor changes
su-mt4fe1a11
minor changes
su-mt7cf5e5e
minor changes
su-mtcd48255
debug templates
su-mt3e0e203
debug templates
su-mte707c70
git commit -m "feat(cpp-templates): Smart C++ debug template generation
su-mt502805e
feat(cpp-templates): Enhanced C++ debug template generation with smar…
su-mt4401c63
minor changes
su-mt3691da7
bug fix
su-mtFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -64,3 +64,6 @@ out | ||
# Mac | ||
.DS_Store | ||
test* |
1 change: 1 addition & 0 deletions.vscodeignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -12,3 +12,4 @@ tslint.json | ||
ACKNOWLEDGEMENTS.md | ||
docs | ||
.github | ||
test* |
83 changes: 83 additions & 0 deletionsBUG_FIX_INSTRUCTIONS.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# 🔧 Исправление бага с test/submit в расширении LeetCode | ||
## 📋 Проблема | ||
При использовании команд **Test** и **Submit** возникали следующие ошибки: | ||
``` | ||
- Sending code to judge | ||
(node:19982) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency | ||
(Use `node --trace-warnings ...` to show where the warning was created) | ||
(node:19982) [DEP0187] DeprecationWarning: Passing invalid argument types to fs.existsSync is deprecated | ||
``` | ||
## ✅ Исправления | ||
### 1. **Проблема с двойными кавычками в путях файлов** | ||
**Файл:** `src/leetCodeExecutor.ts` | ||
- Исправлена двойная экранировка путей к файлам в методах `testSolution`, `submitSolution` и `toggleFavorite` | ||
- `getLeetCodeBinaryPath()` уже возвращает путь в кавычках, дополнительная экранировка не нужна | ||
### 2. **Конфликт версий winston** | ||
**Файл:** `package.json` | ||
- Удален winston 3.18.3 из основных зависимостей (не используется в коде) | ||
- Устранен конфликт с winston 2.1.x из `vsc-leetcode-cli` | ||
- Решена проблема с циклическими зависимостями и `padLevels` | ||
### 3. **Некорректный исполнитель в toggleFavorite** | ||
**Файл:** `src/leetCodeExecutor.ts` | ||
- Заменен жестко заданный "node" на `this.nodeExecutable` | ||
## 🚀 Установка исправленной версии | ||
### Шаг 1: Удалите старую версию расширения | ||
1. Откройте VS Code | ||
2. Перейдите в Extensions (`Ctrl+Shift+X`) | ||
3. Найдите "LeetCode Enhanced Fork" | ||
4. Нажмите на шестеренку → Uninstall | ||
### Шаг 2: Установите новую версию | ||
```bash | ||
cd /Users/mt/vscode-leetcode | ||
code --install-extension vscode-leetcode-0.18.5.vsix | ||
``` | ||
### Шаг 3: Перезапустите VS Code | ||
1. Полностью закройте VS Code | ||
2. Откройте заново | ||
3. Проверьте что расширение активировано | ||
## 🧪 Тестирование | ||
### Test Solution | ||
1. Откройте любую задачу LeetCode | ||
2. Нажмите `Ctrl+Shift+P` → "LeetCode: Test in LeetCode" | ||
3. Выберите тип теста | ||
4. Проверьте что НЕТ предупреждений о `padLevels` и `fs.existsSync` | ||
### Submit Solution | ||
1. Откройте решенную задачу | ||
2. Нажмите `Ctrl+Shift+P` → "LeetCode: Submit to LeetCode" | ||
3. Проверьте что отправка проходит без ошибок | ||
## 📈 Ожидаемый результат | ||
После установки исправленной версии: | ||
- ✅ Команды **Test** и **Submit** работают без предупреждений | ||
- ✅ Нет сообщений о `padLevels` и циклических зависимостях | ||
- ✅ Нет предупреждений о `fs.existsSync` | ||
- ✅ Все функции Daily Challenges работают как прежде | ||
- ✅ C++ debug templates функционируют корректно | ||
## 🔍 Технические детали | ||
### Исправленные методы: | ||
- `submitSolution(filePath: string)` - убрана лишняя экранировка | ||
- `testSolution(filePath: string, testString?: string)` - убрана лишняя экранировка | ||
- `toggleFavorite(node: IProblem, addToFavorite: boolean)` - исправлен исполнитель | ||
### Удаленные зависимости: | ||
- `winston: ^3.18.3` (конфликтовал с winston 2.1.x из vsc-leetcode-cli) | ||
--- | ||
**Статус:** ✅ **ИСПРАВЛЕНО** - Все известные баги с test/submit устранены |
104 changes: 104 additions & 0 deletionsDAILY_CHALLENGES_SOURCE_CHANGES.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Daily Challenges - Изменения в исходном проекте | ||
## Внесенные изменения в папку `/out/src/vscode-leetcode/src/`: | ||
### 1. **shared.ts** | ||
```typescript | ||
export enum Category { | ||
All = "All", | ||
Difficulty = "Difficulty", | ||
Tag = "Tag", | ||
Company = "Company", | ||
Favorite = "Favorite", | ||
Daily = "Daily", // ← ДОБАВЛЕНО | ||
} | ||
``` | ||
### 2. **leetCodeExecutor.ts** | ||
- Добавлен метод `getTodayProblem(needTranslation?: boolean): Promise<any[]>` | ||
- Добавлен метод `getDailyChallengeHistory(needTranslation?: boolean, days: number = 30): Promise<any[]>` | ||
- Добавлен метод `generateCppHeaders(): string` | ||
- Обновлен метод `showProblem()` для поддержки параметра `shouldAddHeaders: boolean = false` | ||
### 3. **explorer/explorerNodeManager.ts** | ||
- Добавлены поля кеширования: | ||
```typescript | ||
private dailyChallengesCache: LeetCodeNode[] | null = null; | ||
private dailyCacheTimestamp: number | null = null; | ||
``` | ||
- Обновлен `getRootNodes()` - добавлен узел "📅 Daily Challenges" первым в списке | ||
- Добавлен метод `getDailyNodes(): Promise<LeetCodeNode[]>` с: | ||
- Кешированием на 30 минут | ||
- Сопоставлением с локальными статусами задач | ||
- Форматированием названий с датами | ||
- Обновлен `refreshCache()` - сброс кеша daily challenges | ||
- Обновлен `dispose()` - очистка кеша daily challenges | ||
### 4. **explorer/LeetCodeTreeDataProvider.ts** | ||
- Добавлен case `Category.Daily` в метод `getChildren()`: | ||
```typescript | ||
case Category.Daily: | ||
return explorerNodeManager.getDailyNodes(); | ||
``` | ||
### 5. **commands/show.ts** | ||
- Добавлена логика для C++ заголовков: | ||
```typescript | ||
const shouldAddHeaders = (language === "cpp" || language === "c"); | ||
``` | ||
- Обновлен вызов `leetCodeExecutor.showProblem()` с новым параметром | ||
## Функциональность: | ||
### 📅 **Daily Challenges папка** | ||
- Отображается первой в LeetCode Explorer | ||
- Содержит историю daily challenges за последние 30 дней | ||
- Иконка 📅 для визуального выделения | ||
### 🔥 **Форматирование задач** | ||
- Сегодняшняя задача: `🔥 [1234] Problem Name (Today)` | ||
- Вчерашняя: `[5678] Problem Name (Yesterday)` | ||
- Старые: `[9012] Problem Name (3 days ago)` | ||
### ✅ **Статусы задач** | ||
- Синхронизация с локальной базой данных решений | ||
- Зеленые галочки для решенных задач | ||
- Красные крестики для неуспешных попыток | ||
- Автоматическое обновление статусов | ||
### ⚡ **Производительность** | ||
- Кеширование на 30 минут | ||
- GraphQL API интеграция с LeetCode | ||
- Получение данных за текущий и предыдущий месяц | ||
### 🛠️ **C++ заголовки** | ||
- Автоматическое добавление стандартных заголовков для C/C++ | ||
- Поддержка всех основных STL контейнеров и алгоритмов | ||
## API интеграция: | ||
Используется LeetCode GraphQL API: | ||
```graphql | ||
query dailyCodingQuestionRecords($year: Int!, $month: Int!) { | ||
dailyCodingChallengeV2(year: $year, month: $month) { | ||
challenges { | ||
date | ||
userStatus | ||
link | ||
question { | ||
acRate | ||
difficulty | ||
frontendQuestionId: questionFrontendId | ||
# ... остальные поля | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
## Готово к компиляции! | ||
Все изменения внесены в исходный TypeScript проект. Теперь можно: | ||
1. Скомпилировать проект (`npm run compile`) | ||
2. Протестировать функциональность | ||
3. Наслаждаться Daily Challenges в LeetCode Explorer! 🎉 |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.