vs-code-extension-development
maintained by khuongsatou
star
0
account_tree
0
verified_user
MIT License
name: VS Code Extension Development description: Skill for developing, building, and packaging VS Code extensions with TypeScript + React webview
VS Code Extension Development Skill
Project Architecture
mtips5s_mcp_codex/
├── src/ ← Extension backend (TypeScript)
│ ├── extension.ts ← Entry point, activate/deactivate
│ ├── services/
│ │ ├── AutoRetryService.ts ← Core auto-retry logic, orchestrator
│ │ ├── CDPHandler.ts ← CDP WebSocket connections, DOM manipulation
│ │ └── Relauncher.ts ← Reconnection & restart logic
│ └── ui/
│ └── SidePanelProvider.ts ← Webview provider, message bridge
├── webview/ ← Frontend (React + Vite + shadcn/ui)
│ ├── src/
│ │ ├── App.tsx ← Main webview component
│ │ ├── components/ui/ ← shadcn/ui components
│ │ └── index.css ← Styles
│ └── vite.config.ts
├── dist/ ← Build output (DO NOT EDIT)
├── scripts/cdp-tools/ ← CDP debug scripts
├── docs/ ← Documentation
└── package.json ← Extension manifest
Key Concepts
1. Extension ↔ Webview Communication
Webview (React) ←→ SidePanelProvider ←→ AutoRetryService ←→ CDPHandler
postMessage() onDidReceiveMessage() WebSocket
-
Webview → Extension:
vscode.postMessage({ type, data }) -
Extension → Webview:
this._view.webview.postMessage({ type, data }) - Message types defined in
SidePanelProvider.tsswitch cases
2. CDP Connection Flow
1. Scan ports 31902-31908 → find active port (31905)
2. GET /json/list → list page targets
3. Connect WebSocket to each target
4. Inject JS via Runtime.evaluate
5. Monitor DOM for retry buttons → auto-click
3. Configuration (package.json contributes.configuration)
| Setting | Default | Description |
|---|---|---|
smartAutoRetry.enabled |
true | Enable extension |
smartAutoRetry.autoStart |
false | Auto-start on launch |
smartAutoRetry.cdpPort |
31905 | CDP port |
smartAutoRetry.cdpPortRange |
3 | Port scan range |
smartAutoRetry.pollInterval |
1000 | Retry check interval (ms) |
smartAutoRetry.cooldown |
5000 | Cooldown after click (ms) |
Build Commands
# Build everything (extension + webview)
npm run build
# Build extension only (fast, ~1s)
npm run build:extension
# Build webview only
npm run build:webview
# Watch mode (extension)
npm run dev
# Watch mode (webview)
npm run dev:webview
# Package .vsix
npm run package
# Publish to marketplace
npm run publish
Dev Workflow
- Sửa code trong
src/hoặcwebview/src/ -
npm run build - Reload Window trong Antigravity (Cmd+Shift+P → Reload)
- Test từ sidebar panel
Thêm command mới
- Thêm entry trong
package.json→contributes.commands - Register handler trong
extension.ts→vscode.commands.registerCommand - Build & reload
Thêm setting mới
- Thêm property trong
package.json→contributes.configuration.properties - Đọc trong service:
vscode.workspace.getConfiguration('smartAutoRetry').get('key')
Thêm message type mới (Webview ↔ Extension)
- Webview React:
vscode.postMessage({ type: 'newAction', data: {...} }) - SidePanelProvider: thêm case trong
switch (message.type) - Xử lý logic và gửi response:
postMessage({ type: 'newActionResult', data: {...} })
chat Comments (0)
Sign in to join the discussion and leave a comment.
Skill Details
GitHub Stars
0
GitHub Forks
0
Created
Mar 2026
Last Updated
il y a 3 mois
tools
tools ide plugins
Related Skills
Build your own?
Join 12,000+ developers contributing to the Claude ecosystem.
No comments yet. Be the first to share your thoughts!