Editor
Editor là IDE được tăng cường AI của Antigravity, được xây dựng dựa trên VS Code.
Tổng quan
Phần tiêu đề “Tổng quan”Editor là nơi bạn viết code với sự hỗ trợ của AI:
- Tab - Super autocomplete
- Command - Natural language inline instructions
- Agent Side Panel - Chat với Agent
Giao diện Editor
Phần tiêu đề “Giao diện Editor”┌─────────────────────────────────────────────────────────────┐│ Menu Bar ⚙️ │├─────────────┬───────────────────────────────┬───────────────┤│ │ │ ││ Explorer │ Code Editor │ Agent Panel ││ │ │ ││ Files │ function hello() { │ 💬 Chat ││ ├─ src/ │ return "world"; │ ││ ├─ lib/ │ } │ 📋 Artifacts ││ └─ ... │ │ ││ │ │ 🔧 Tools ││ │ │ │├─────────────┴───────────────────────────────┴───────────────┤│ Terminal / Output / Problems │└─────────────────────────────────────────────────────────────┘Tab (Autocomplete)
Phần tiêu đề “Tab (Autocomplete)”Tab là hệ thống autocomplete thông minh, vượt xa simple word completion.
Khả năng
Phần tiêu đề “Khả năng”- Multi-line suggestions - Gợi ý cả blocks of code
- Context-aware - Hiểu code xung quanh
- Semantic completion - Hiểu ý định, không chỉ syntax
Sử dụng
Phần tiêu đề “Sử dụng”- Bắt đầu gõ code
- Tab suggestion xuất hiện (grey text)
- Nhấn
Tabđể accept,Escđể dismiss
Ví dụ
Phần tiêu đề “Ví dụ”// Bạn gõ:function calculateTotalPrice(items
// Tab suggests:function calculateTotalPrice(items: CartItem[]): number { return items.reduce((total, item) => total + item.price * item.quantity, 0);}Command
Phần tiêu đề “Command”Command cho phép bạn viết instructions bằng natural language inline.
Sử dụng
Phần tiêu đề “Sử dụng”- Bắt đầu comment với
//hoặc# - Viết instruction
- Agent sẽ generate code theo instruction
Ví dụ
Phần tiêu đề “Ví dụ”// Create a function that validates email format// Agent generates:function validateEmail(email: string): boolean { const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return emailRegex.test(email);}Commands nâng cao
Phần tiêu đề “Commands nâng cao”// Refactor this to use async/awaitfetch(url) .then(res => res.json()) .then(data => console.log(data));
// Agent generates:const response = await fetch(url);const data = await response.json();console.log(data);Agent Side Panel
Phần tiêu đề “Agent Side Panel”Panel bên phải để chat trực tiếp với Agent.
Features
Phần tiêu đề “Features”- Chat interface - Conversation với Agent
- Context awareness - Agent biết file đang mở
- File references - Có thể reference files/selections
- Artifact viewer - Xem artifacts được tạo
Reference File
Phần tiêu đề “Reference File”@filename.ts - Reference entire file@selection - Reference selected codeVí dụ Chat
Phần tiêu đề “Ví dụ Chat”You: "Explain this function to me" @src/utils/auth.ts:25-40
Agent: "This function validateToken() does:1. Decodes the JWT token2. Checks expiration date3. Verifies signature4. Returns user payload or throws error"Keyboard Shortcuts
Phần tiêu đề “Keyboard Shortcuts”| Shortcut | Action |
|---|---|
Cmd+E / Ctrl+E |
Toggle Editor ↔ Agent Manager |
Cmd+P / Ctrl+P |
Quick file open |
Cmd+, / Ctrl+, |
Open Settings |
Cmd+Shift+P / Ctrl+Shift+P |
Command Palette |
Tab |
Accept autocomplete |
Esc |
Dismiss autocomplete |
Settings
Phần tiêu đề “Settings”Editor settings có thể customize:
AI Settings
Phần tiêu đề “AI Settings”- Tab autocomplete on/off
- Suggestion delay
- Max suggestion length
Editor Settings
Phần tiêu đề “Editor Settings”- Theme (light/dark)
- Font size
- Tab size
- Auto-save
Agent Settings
Phần tiêu đề “Agent Settings”- Default mode
- Review policies
- Notification preferences
Extensions
Phần tiêu đề “Extensions”Editor hỗ trợ VS Code extensions:
- Language support
- Linters
- Formatters
- Themes
Best Practices
Phần tiêu đề “Best Practices”✅ Sử dụng Tab hiệu quả
Phần tiêu đề “✅ Sử dụng Tab hiệu quả”- Đợi suggestion xuất hiện trước khi gõ tiếp
- Accept partial suggestions bằng
Tab - Dismiss bad suggestions bằng
Escvà tiếp tục gõ
✅ Command rõ ràng
Phần tiêu đề “✅ Command rõ ràng”// ❌ Vague// make this better
// ✅ Specific// refactor to use early return pattern and handle null case✅ Kết hợp với Agent Panel
Phần tiêu đề “✅ Kết hợp với Agent Panel”- Dùng Tab/Command cho quick changes
- Dùng Agent Panel cho complex tasks
- Reference selections để provide context