# 交互式调试器控制台

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/clion/llms.txt).

> **TL;DR**
> 必需插件  :
>
>
>
> `JavaScript 和 TypeScript` ，  `JavaScript Debugger`  - 插件与 CLion 捆绑，并默认启用。

> **Note:**
> * 交互式 控制台 窗格仅在 [调试应用程序](debugging-javascript-in-chrome.html)或 [调试测试](unit-testing-javascript.html#running-and-debugging-tests)时显示。 在您 [运行应用程序](running-applications.html) 或 [预览网页](editing-html-files.html#ws_html_preview_output) 时不可用。
>
> * JavaScript 代码的调试仅在 [Google Chrome](http://www.google.com/chrome/)和其他 [Chromium-based browsers](https://www.chromium.org/)中受支持。

交互式   控制台  窗格显示了您的代码中所有记录的堆栈跟踪和内容（例如，使用  `console.*` ）。

控制台   窗格也是一个  read-eval-print loop  (  REPL )，因此您可以在其中运行 JavaScript 代码片段并与您当前调试的页面进行交互。

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/js_interactive_debugger_console_object_shown.mp4)

Procedure: 在控制台中运行 JavaScript

1. 在 输入字段 中的  `>`  开始键入语句。 在输入过程中，CLion 会建议补全的变体。

2. 选择相关陈述并按 `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `⏎` (Xcode), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (ReSharper), `⏎` (ReSharper (macOS)), `Enter` (QtCreator), `⏎` (QtCreator (macOS)), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS))。 CLion 在控制台中显示其值。

CLion 显示对象的预览，因此您无需展开它们。 如果您仍然展开一个对象，您只会看到其自身属性的概览，  `__proto__`  内容默认是隐藏的。

Procedure: 导航到源代码

* 在每行具有  `console.*`  输出的行， CLion 显示文件的名称以及调用所在的行。 点击此链接可跳转到源代码中的调用。

![JavaScript 交互式调试器控制台：导航到源代码](https://resources.jetbrains.com/help/img/idea/2026.3/js_interactive_debugger_console_navigate_to_source.animated.gif)

* 控制台   也显示堆栈跟踪。 点击报告问题旁边的链接以跳转到出现此问题的代码行。

![JavaScript 交互式调试器控制台：导航到错误](https://resources.jetbrains.com/help/img/idea/2026.3/js_interactive_debugger_console_navigate_from_stack_trace.animated.gif)

Procedure: 筛选消息

控制台   选项卡以树视图显示对象，默认情况下折叠堆栈跟踪。 警告  `console.warn()` 、错误  `console.error()` 和信息  `console.info()` 消息具有不同的图标和背景颜色，使它们更容易被注意到。

* 要隐藏特定类型的日志消息，请点击 ![筛选按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.filter.svg)并选择要过滤掉的严重性。

![Node.js 交互调试控制台：按类型过滤消息](https://resources.jetbrains.com/help/img/idea/2026.3/js_interactive_debugger_console_filter.png)

Procedure: 群组消息

* 通过使用  `console.group()`  和  `console.groupEnd()`  分组的日志消息将显示为树状结构。 默认情况下，要显示折叠的输出，请使用  `console.groupCollapsed()` 。

![Node.js 交互调试器控制台：日志消息分组](https://resources.jetbrains.com/help/img/idea/2026.3/js_interactive_debugger_console_group_messages.png)

Procedure: 应用 CSS 样式

* 使用 CSS 和  `%c`  标记来应用日志消息样式。

![JavaScript 交互调试器控制台：应用 CSS 样式到日志消息](https://resources.jetbrains.com/help/img/idea/2026.3/js_interactive_console_css.png)

如需更多信息，请参阅 [使用 CSS 样式化控制台输出](https://developers.google.com/web/tools/chrome-devtools/console/console-write#styling_console_output_with_css)。

