Claude Code VS Code Extension – Complete Setup & Usage Guide
Use Claude Code directly through VS Code's native interface with chat integration, visual diff viewing, and automatic context sharing. ใช้ Claude Code ผ่าน VS Code โดยตรงด้วยอินเตอร์เฟซแชท การแสดงผลต่างแบบภาพ และการแชร์บริบทอัตโนมัติ
🚀 Key Benefits / ประโยชน์หลัก
Native VS Code Integration - No terminal required / ไม่ต้องใช้เทอร์มินัล
Visual Chat Interface - Familiar VS Code theming / อินเตอร์เฟซแชทแบบภาพ
Visual Diff Viewing - Review changes in VS Code's diff editor / ดูการเปลี่ยนแปลงแบบภาพ
Drag & Drop Support - Files and images / ลากและวางไฟล์และรูปภาพ
✅ Official VS Code Extension Availableมีส่วนขยายอย่างเป็นทางการใน VS Code
Great News: There IS an official "Claude Code for VS Code" extension published by Anthropic in the VS Code Extensions marketplace. You can install it directly from the marketplace or use the CLI method. ข่าวดี: มีส่วนขยาย "Claude Code for VS Code" อย่างเป็นทางการที่เผยแพร่โดย Anthropic ใน VS Code Extensions marketplace คุณสามารถติดตั้งได้โดยตรงจาก marketplace หรือใช้วิธี CLI
📥 Installation Methodsวิธีการติดตั้ง
✅ Method 1: VS Code Marketplace (Recommended)
Official extension by Anthropic - Easy installation directly from VS Code
ส่วนขยายอย่างเป็นทางการโดย Anthropic - ติดตั้งง่ายโดยตรงจาก VS Code
✅ Method 2: CLI Installation
Alternative method - Install via npm and run from terminal
Start using commands like "understand my codebase" / เริ่มใช้คำสั่งเช่น "เข้าใจโค้ดเบสของฉัน"
💡 Important: Ensure your Claude Pro/Max subscription is active and has remaining usage allowance. สำคัญ: ตรวจสอบให้แน่ใจว่าการสมัครสมาชิก Claude Pro/Max ของคุณยังใช้งานได้และมีการใช้งานเหลืออยู่
🖥️ Using the VS Code Interfaceการใช้งานอินเตอร์เฟซ VS Code
Launching the Extension Interfaceการเปิดอินเตอร์เฟซส่วนขยาย
Method 1: Activity Bar
Click the Claude icon in the activity bar
คลิกไอคอน Claude ในแถบกิจกรรม
Method 2: Keyboard Shortcut
Cmd/Ctrl + Esc
ทางลัดแป้นพิมพ์
Method 3: Command Palette
Ctrl/Cmd + Shift + P
Type "Claude Code: Open Chat"
พิมพ์ "Claude Code: Open Chat"
Core IDE Integration Featuresคุณสมบัติการรวม IDE หลัก
Type @filename to reference files / พิมพ์ @filename เพื่ออ้างอิงไฟล์
Drag and drop files into chat / ลากและวางไฟล์ลงในแชท
Use Cmd/Ctrl + Option/Alt + K for quick file references / ใช้ Cmd/Ctrl + Option/Alt + K สำหรับการอ้างอิงไฟล์อย่างรวดเร็ว
Image Support:
Paste screenshots directly into chat / วางสกรีนช็อตลงในแชทโดยตรง
Drag image files into chat / ลากไฟล์รูปภาพลงในแชท
Claude analyzes UI mockups, diagrams, etc. / Claude วิเคราะห์ mockup UI, ไดอะแกรม ฯลฯ
🔧 Troubleshooting Common Issuesการแก้ไขปัญหาที่พบบ่อย
Extension Not Appearing / ส่วนขยายไม่ปรากฏ
# Check VS Code Extensions panel
# Restart VS Code completely
# Look for Claude icon in Activity Bar
# Try keyboard shortcut Cmd/Ctrl + Esc
Account Balance / ยอดเงินในบัญชี
If you see "I don't have a balance in my premium account":
หากคุณเห็น "ฉันไม่มียอดเงินในบัญชีพรีเมียม":
Check claude.ai account status / ตรวจสอบสถานะบัญชี claude.ai
Verify subscription is active and paid / ตรวจสอบว่าการสมัครสมาชิกยังใช้งานได้และจ่ายแล้ว
Wait for billing cycle reset if at usage limits / รอให้รีเซ็ตรอบการเรียกเก็บเงินหากถึงขีดจำกัดการใช้งาน
Context Not Sharing / บริบทไม่แชร์
# Ensure you've selected code before opening Claude
# Check that diagnostic sharing is enabled
# Verify the file is saved (unsaved changes may not share)
# Restart extension if context seems stale
# Create custom commands directory
mkdir .claude/commands/
# Add custom command file
# Example: security-review.md
echo "Analyze this code for security vulnerabilities and suggest fixes" > .claude/commands/security-review.md
Usage in extension: Type /security-review in chat
การใช้งานในส่วนขยาย: พิมพ์ /security-review ในแชท
💡 Best Practices & Tipsแนวปฏิบัติที่ดีและเคล็ดลับ
Workflow Optimizationการปรับปรุงเวิร์กโฟลว์
Pin Claude Code to sidebar for quick access / ปักหมุด Claude Code ไว้ที่แถบด้านข้างเพื่อเข้าถึงได้ง่าย
Use keyboard shortcuts for faster launching / ใช้ทางลัดแป้นพิมพ์เพื่อเปิดได้เร็วขึ้น
Select code first then ask questions for better context / เลือกโค้ดก่อนแล้วถามเพื่อบริบทที่ดีกว่า
Review diffs carefully in VS Code's diff viewer / ตรวจสอบความแตกต่างอย่างระมัดระวังในเครื่องดูความแตกต่างของ VS Code
Test Commands to Tryคำสั่งทดสอบที่ควรลอง
# Basic commands to test your setup
"Understand my codebase"
"What does this selected code do?"
"Help me fix this error"
"Refactor this function"
"Add comments to explain this code"
🎉 Success! You're Ready to Code with Claude
You've successfully set up Claude Code VS Code extension. You can now enjoy AI-powered development directly within VS Code with visual interfaces, automatic context sharing, and seamless workflow integration! คุณได้ตั้งค่าส่วนขยาย Claude Code VS Code เรียบร้อยแล้ว ตอนนี้คุณสามารถเพลิดเพลินกับการพัฒนาที่ขับเคลื่อนด้วย AI โดยตรงภายใน VS Code พร้อมอินเตอร์เฟซแบบภาพ การแชร์บริบทอัตโนมัติ และการรวมเวิร์กโฟลว์อย่างราบรื่น!
🚀 What You Can Do Now:
✅ Chat with Claude directly in VS Code
✅ Get automatic context from selected code
✅ View code changes with visual diffs
✅ Drag and drop files and images
✅ Use custom commands and shortcuts
Need more help? Visit the official Claude Code documentation for advanced features and troubleshooting. ต้องการความช่วยเหลือเพิ่มเติม? เยี่ยมชมเอกสารทางการของ Claude Code สำหรับคุณสมบัติขั้นสูงและการแก้ไขปัญหา