Back to n8n Management Hub

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 / ประโยชน์หลัก

✅ 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

วิธีทางเลือก - ติดตั้งผ่าน npm และรันจากเทอร์มินัล

🔧 Installation Guide คู่มือการติดตั้ง

Method 1: VS Code Marketplace Installation (Recommended) วิธีที่ 1: การติดตั้งจาก VS Code Marketplace (แนะนำ)

  1. Open VS Code / เปิด VS Code
  2. Open Extensions panel (Ctrl/Cmd + Shift + X) / เปิดแผง Extensions
  3. Search for "Claude Code for VS Code" / ค้นหา "Claude Code for VS Code"
  4. Look for the extension by Anthropic (publisher should show "Anthropic") / มองหาส่วนขยายโดย Anthropic (ผู้เผยแพร่ควรแสดง "Anthropic")
  5. Click "Install" / คลิก "Install"
  6. Restart VS Code if prompted / รีสตาร์ท VS Code หากมีข้อความแจ้ง
✅ Easy Installation: This is the simplest method - no CLI or npm required!
การติดตั้งที่ง่าย: นี่เป็นวิธีที่ง่ายที่สุด - ไม่ต้องใช้ CLI หรือ npm!

Method 2: CLI Installation (Alternative) วิธีที่ 2: การติดตั้งผ่าน CLI (ทางเลือก)

Step 1: Install Claude Code CLI using npm:

ขั้นตอนที่ 1: ติดตั้ง Claude Code CLI โดยใช้ npm:

npm install -g @anthropic-ai/claude-code

Step 2: Launch in VS Code:

ขั้นตอนที่ 2: เปิดใช้งานใน VS Code:

  1. Open VS Code / เปิด VS Code
  2. Open your project / เปิดโปรเจกต์ของคุณ
  3. Open integrated terminal (Ctrl/Cmd + `) / เปิดเทอร์มินัลแบบรวม
  4. Type: claude / พิมพ์: claude
claude

Authentication & Initial Setup การรับรองตัวตนและการตั้งค่าเริ่มต้น

After installing the extension (either method), you'll need to authenticate:

หลังจากติดตั้งส่วนขยายแล้ว (ทั้งสองวิธี) คุณจะต้องรับรองตัวตน:

Getting Started การเริ่มต้นใช้งาน

When prompted:

เมื่อถูกถาม:

💡 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 หลัก

1. Automatic Context Sharing / การแชร์บริบทอัตโนมัติ

The current selection/tab in the IDE is automatically shared with Claude Code:

การเลือก/แท็บปัจจุบันใน IDE จะถูกแชร์กับ Claude Code โดยอัตโนมัติ:

2. Visual Diff Viewing / การดูความแตกต่างแบบภาพ

View diffs directly in VS Code when Claude Code changes the code:

ดูความแตกต่างโดยตรงใน VS Code เมื่อ Claude Code เปลี่ยนโค้ด:

3. Diagnostic Sharing / การแชร์การวินิจฉัย

Diagnostic errors from the IDE are automatically shared:

ข้อผิดพลาดการวินิจฉัยจาก IDE ถูกแชร์โดยอัตโนมัติ:

File Reference & Image Support การอ้างอิงไฟล์และการรองรับรูปภาพ

File References:

Image Support:

🔧 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":

หากคุณเห็น "ฉันไม่มียอดเงินในบัญชีพรีเมียม":

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

⚙️ Advanced Configuration การกำหนดค่าขั้นสูง

Extension Settings การตั้งค่าส่วนขยาย

Access via VS Code Settings (Ctrl/Cmd + ,):

เข้าถึงผ่านการตั้งค่า VS Code:

{
  "claudeCodeChat.wsl.enabled": true,
  "claudeCodeChat.wsl.distro": "Ubuntu", 
  "claudeCodeChat.wsl.nodePath": "/usr/bin/node",
  "claudeCodeChat.wsl.claudePath": "/usr/local/bin/claude"
}

Custom Commands คำสั่งที่กำหนดเอง

Create custom slash commands for the extension:

สร้างคำสั่งแบบ slash ที่กำหนดเองสำหรับส่วนขยาย:

# 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 การปรับปรุงเวิร์กโฟลว์

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 สำหรับคุณสมบัติขั้นสูงและการแก้ไขปัญหา