Claude Code中英文系列教程14:在JetBrain,Android Studio,PyCharm等IDE中使用Claude Code

Use Claude Code with JetBrains IDEs including IntelliJ, PyCharm, WebStorm, and more

使用 Claude Code 与 JetBrains IDEs,包括 IntelliJ、PyCharm、WebStorm 等

Claude Code integrates with JetBrains IDEs through a dedicated plugin, providing features like interactive diff viewing, selection context sharing, and more.

Claude Code 通过专用插件与 JetBrains IDEs 集成,提供诸如交互式差异查看、选择上下文共享等功能。

一,

Supported IDEs 支持的 IDE

The Claude Code plugin works with most JetBrains IDEs, including:

Claude Code 插件适用于大多数 JetBrains IDEs,包括:

IntelliJ IDEA

PyCharm

Android Studio

WebStorm

PhpStorm

GoLand

二,Features 功能

Quick launch: Use Cmd+Esc (Mac) or Ctrl+Esc (Windows/Linux) to open Claude Code directly from your editor, or click the Claude Code button in the UI

快速启动:使用 Cmd+Esc (Mac)或 Ctrl+Esc (Windows/Linux)从您的编辑器直接打开 Claude Code,或点击 UI 中的 Claude Code 按钮

Diff viewing: Code changes can be displayed directly in the IDE diff viewer instead of the terminal

差异查看:代码更改可以直接在 IDE 差异查看器中显示,而不是在终端中

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

选择上下文:IDE 中的当前选择/标签会自动与 Claude Code 共享

File reference shortcuts: Use Cmd+Option+K (Mac) or Alt+Ctrl+K (Linux/Windows) to insert file references (for example, @File#L1-99)

文件引用快捷方式:使用 Cmd+Option+K (Mac)或 Alt+Ctrl+K (Linux/Windows)插入文件引用(例如,@File#L1-99)

Diagnostic sharing: Diagnostic errors (lint, syntax, etc.) from the IDE are automatically shared with Claude as you work

诊断共享:IDE 中的诊断错误(如 lint、语法等)会自动与 Claude 共享

三,Installation 安装

3.1 Marketplace Installation 市场安装

Find and install the Claude Code plugin from the JetBrains marketplace and restart your IDE.

从 JetBrains 市场找到并安装 Claude Code 插件,然后重启你的 IDE。

https://plugins.jetbrains.com/plugin/27310-claude-code-beta-

四,Usage 使用方法

4.1,From Your IDE 从你的 IDE

Run claude from your IDE's integrated terminal, and all integration features will be active.

从你的 IDE 的集成终端运行 claude ,所有集成功能都将激活。

4.2,From External Terminals 从外部终端

Use the /ide command in any external terminal to connect Claude Code to your JetBrains IDE and activate all features:

在任何外部终端中使用 /ide 命令将 Claude Code 连接到您的 JetBrains IDE 并激活所有功能:

claude

> /ide

If you want Claude to have access to the same files as your IDE, start Claude Code from the same directory as your IDE project root.

如果你希望 Claude 能够访问与你的 IDE 相同的文件,请从与 IDE 项目根目录相同的目录启动 Claude Code。

五,Configuration 配置

5.1 Claude Code Settings Claude Code 设置

Configure IDE integration through Claude Code's settings:

通过 Claude Code 的设置配置 IDE 集成:

Run claude 运行 claude

Enter the /config command 输入 /config 命令

Set the diff tool to auto for automatic IDE detection

将差异工具设置为 auto 以自动检测 IDE

5.2 Plugin Settings 插件设置

Configure the Claude Code plugin by going to Settings → Tools → Claude Code [Beta]:

通过前往设置 → 工具 → Claude Code [Beta] 来配置 Claude Code 插件:

5.2.1 General Settings 常规设置

Claude command: Specify a custom command to run Claude (for example, claude, /usr/local/bin/claude, or npx @anthropic/claude)

Claude 命令:指定一个自定义命令来运行 Claude(例如, claude , /usr/local/bin/claude ,或 npx @anthropic/claude )

Suppress notification for Claude command not found: Skip notifications about not finding the Claude command

禁止显示未找到的 Claude 命令通知:跳过未找到 Claude 命令的通知

Enable using Option+Enter for multi-line prompts (macOS only): When enabled, Option+Enter inserts new lines in Claude Code prompts. Disable if experiencing issues with the Option key being captured unexpectedly (requires terminal restart)

启用 Option+Enter 进行多行提示(仅限 macOS):启用后,Option+Enter 会在 Claude Code 提示中插入新行。如果 Option 键意外被捕获导致问题,请禁用(需要终端重启)

Enable automatic updates: Automatically check for and install plugin updates (applied on restart)

启用自动更新:自动检查并安装插件更新(在重启时应用)

For WSL users: Set wsl -d Ubuntu -- bash -lic "claude" as your Claude command (replace Ubuntu with your WSL distribution name)

对于 WSL 用户:将 wsl -d Ubuntu -- bash -lic "claude" 设置为您的 Claude 命令(将 Ubuntu 替换为你的 WSL 发行版名称)

5.2.2 ESC Key Configuration ESC 键配置

If the ESC key doesn't interrupt Claude Code operations in JetBrains terminals:

如果 ESC 键在 JetBrains 终端中无法中断 Claude Code 操作:

Go to Settings → Tools → Terminal

转到设置→工具→终端

Either: 选择下面其中之一:

Uncheck "Move focus to the editor with Escape", or

取消勾选"使用 Escape 键移动焦点到编辑器",或者

Click "Configure terminal keybindings" and delete the "Switch focus to Editor" shortcut

点击"配置终端快捷键",并删除"切换焦点到编辑器"的快捷键

Apply the changes 应用更改

This allows the ESC key to properly interrupt Claude Code operations.

这样可以使 ESC 键正确地中断 Claude Code 操作。

六,Special Configurations 特殊配置

6.1 Remote Development 远程开发

When using JetBrains Remote Development, you must install the plugin in the remote host via Settings → Plugin (Host).

在使用 JetBrains 远程开发时,必须通过设置 → 插件(主机)在远程主机上安装插件。

The plugin must be installed on the remote host, not on your local client machine.

插件必须在远程主机上安装,而不是在你本地客户端机器上。

6.2 WSL Configuration WSL 配置

WSL users may need additional configuration for IDE detection to work properly.

WSL 用户可能需要额外的配置才能使 IDE 检测功能正常工作。

WSL configuration may require:

WSL 配置可能需要:

Proper terminal configuration

正确的终端配置

Networking mode adjustments

网络模式调整

Firewall settings updates

防火墙设置更新

七,Troubleshooting 故障排除

7.1,Plugin Not Working 插件无法工作

Ensure you're running Claude Code from the project root directory

确保从项目根目录运行 Claude Code

Check that the JetBrains plugin is enabled in the IDE settings

检查 IDE 设置中是否已启用 JetBrains 插件

Completely restart the IDE (you may need to do this multiple times)

完全重启 IDE(可能需要多次执行此操作)

For Remote Development, ensure the plugin is installed in the remote host

对于远程开发,请确保插件已安装在远程主机上

7.2,IDE Not Detected 未检测到 IDE

Verify the plugin is installed and enabled

验证插件是否已安装并启用

Restart the IDE completely

完全重启 IDE

Check that you're running Claude Code from the integrated terminal

确保从集成终端运行 Claude Code

7.3,Command Not Found 命令未找到

If clicking the Claude icon shows "command not found":

如果点击 Claude 图标显示"命令未找到":

Verify Claude Code is installed: npm list -g @anthropic-ai/claude-code

验证 Claude Code 是否已安装: npm list -g @anthropic-ai/claude-code

Configure the Claude command path in plugin settings

在插件设置中配置 Claude 命令路径

八,Security Considerations 安全事项

When Claude Code runs in a JetBrains IDE with auto-edit permissions enabled, it may be able to modify IDE configuration files that can be automatically executed by your IDE.

This may increase the risk of running Claude Code in auto-edit mode and allow bypassing Claude Code's permission prompts for bash execution.

当 Claude Code 在启用自动编辑权限的 JetBrains IDE 中运行时,它可能会修改 IDE 配置文件,这些文件可以被您的 IDE 自动执行。

这可能会增加在自动编辑模式下运行 Claude Code 的风险,并允许绕过 Claude Code 的 bash 执行权限提示。

When running in JetBrains IDEs, consider:

在 JetBrains IDE 中运行时,请考虑:

Using manual approval mode for edits

使用手动审批模式进行编辑

Taking extra care to ensure Claude is only used with trusted prompts

小心确保 Claude 仅使用受信任的提示词

Being aware of which files Claude Code has access to modify

意识到 Claude Code 可以访问和修改哪些文件

相关推荐
AskHarries3 小时前
在 Qoder CLI 集成墨刀 MCP(modao-proto)完整指南
人工智能·ai编程
github.com/starRTC3 小时前
Claude Code中英文系列教程15:将Claude Code集成在Github Actions工作流里面
ai编程
玉梅小洋3 小时前
Claude Code 从入门到精通(一):安装、CLI 实战与全场景集成手册
ai·大模型·编辑器·ai编程·claude
Anarkh_Lee4 小时前
【免费开源】MCP 数据库万能连接器:用自然语言查询和分析数据
数据库·开源·ai编程·claude·自然语言·mcp·cherry studio
Ftsom4 小时前
【2】kilo 消息流转过程
ai·agent·ai编程·kilo
Devlive 开源社区4 小时前
技术日报|微软数据科学课程登顶日增651星,AI编程GUI工具AionUi与React视频制作工具霸榜前三
react.js·microsoft·ai编程
studymary5 小时前
04-Agent代理模式深度解析
ai编程
铮铭5 小时前
AI编程能力的边界
ai编程
寻道码路5 小时前
【GitHub周榜】Agno:快速构建多模态智能体的轻量级框架,开发提速 10000 倍
人工智能·语言模型·开源·github·aigc·ai编程