-
Notifications
You must be signed in to change notification settings - Fork 2
Add demo template selection with 31 categorized examples, smart file overwrite protection, and git stash integration #12
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Free review on us!CodeRabbit is offering free reviews until Wed Dec 17 2025 to showcase some of the refinements we've made. Comment |
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
|
@copilot 继续改进一下, 当创建新的模板 CMake 项目时, 如果遇到文件已存在,先检查文件内容是否一致, 如果一致, 那么跳过, 否则给用户逐个弹窗确认是否覆盖。 |
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
已完成改进!实现的功能: 文件处理:
文件夹处理:
技术改进:
提交记录:15f2da1 |
|
@copilot 继续改进, 几个问题:
|
…s, add git stash support Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
已完成所有改进! 解决的问题:
技术细节:
提交记录:dc496c5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request ports the demo template selection feature from the CLion plugin, enabling users to choose from 31 professionally-crafted EGE examples organized into 8 categories when creating new projects. The implementation includes intelligent file handling with content comparison, user confirmation prompts, and git stash integration to prevent accidental data loss.
Key Changes:
- Demo management system with bilingual (Chinese/English) metadata for 31 templates across 8 categories
- Interactive QuickPick dialog with automatic language detection
- Smart file overwrite protection comparing content before prompting users
- Git stash integration that automatically preserves changes before overwrites
- Batch operation support with "Yes to All" / "No to All" flags
Reviewed changes
Copilot reviewed 38 out of 41 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/demoOptions.ts |
New file implementing demo discovery, metadata registry, and categorization system for 31 templates |
src/setupProject.ts |
Enhanced project setup with demo selection dialog, smart file handling, and resource dependency management |
src/utils.ts |
Added file/directory copy with prompts, content comparison, git stash support, and batch operation flags |
src/i18n.ts |
Extended with new localized strings for file operation prompts and messages |
src/extension.ts |
Updated command handlers to properly await async setupProject function |
cmake_template/ege_demos/*.cpp |
31 new demo template files covering games, graphics, algorithms, physics, fractals, and image processing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }); | ||
|
|
||
| // Show QuickPick | ||
| const selected = await vscode.window.showQuickPick(items.filter(item => item.kind !== vscode.QuickPickItemKind.Separator), { |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The QuickPick is filtering out separator items, but this creates a UI inconsistency. Users won't see the category headers that provide visual organization. Consider using showQuickPick with all items including separators, or restructure to use labels without separators.
| // Stage the files first | ||
| for (const p of paths) { | ||
| runShellCommand('git', ['add', p], { cwd: workspaceDir, noErrorMsg: true }); | ||
| } |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The git add operation stages files before creating the stash. This is problematic because it modifies the git state even if the stash fails. Additionally, staging untracked or modified files may include unwanted changes. Consider using git stash push --include-untracked without pre-staging, or handle the staging rollback on failure.
| items.push({ | ||
| label: '', | ||
| kind: vscode.QuickPickItemKind.Separator | ||
| } as any); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type assertion as any is used to bypass type checking for separator items. This suppresses TypeScript's safety checks. Consider defining a proper union type or interface that accommodates both regular items and separators.
| * Demo options management for EGE VSCode Extension | ||
| */ | ||
|
|
||
| import * as path from 'path'; |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import path.
| import { ege } from './ege'; | ||
| import { copyDirRecursiveIfNotExist, copyIfNotExist } from './utils'; | ||
| import { t } from './i18n'; | ||
| import { copyDirRecursiveIfNotExist, copyIfNotExist, copyFileWithPrompt, copyDirRecursiveWithPrompt, replaceDirWithPrompt } from './utils'; |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports copyDirRecursiveIfNotExist, copyDirRecursiveWithPrompt, copyIfNotExist.
| * Show demo selection dialog | ||
| */ | ||
| async function showDemoSelectionDialog(language: string): Promise<DemoOption | undefined> { | ||
| const demoOptions = DemoOptionsManager.getDemoOptions(language); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable demoOptions.
Port demo template selection feature from CLion plugin to VSCode plugin. Users can now choose from 31 professionally-crafted examples when creating EGE projects, with intelligent file handling to prevent accidental overwrites and automatic git stash support.
Implementation
Demo Management System (
src/demoOptions.ts)DemoOptionsManager: Discovers and serves demo templates from filesystemDemoMetadataRegistry: Bilingual metadata (zh/en) for 31 demos across 8 categoriesProject Setup (
src/setupProject.ts)graph_getimage.cpp)File Handling (
src/utils.ts)copyFileWithPrompt(): Compares file content before overwriting, stashes if git-managed, prompts user if differentreplaceDirWithPrompt(): Confirms directory replacement with user, respects "Yes to All" flag, stashes before replacingcopyDirRecursiveWithPrompt(): Recursive copy with per-file/directory promptsisGitManaged(): Detects if directory is under git version controlstashFilesIfGitManaged(): Creates git stash with descriptive message before overwritingDemo Templates
31 demos organized by category:
Smart File Overwrite Protection
When creating a new project with existing files:
File Content Comparison
Individual File Confirmation
Directory Replacement
egeand.vscodefolders, user confirms before replacing entire directoryBatch Operations
Git Stash Integration
EGE Plugin: Auto-stash before overwrite (2025-12-16T10-05-19-123Z)Full Internationalization
Source files copied directly from
x-ege/ege-clion-pluginrepository under same organization.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.