Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs_espressif/en/additionalfeatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Additional IDE Features
Heap Tracing<additionalfeatures/heap-tracing>
Hints Viewer<additionalfeatures/hints-viewer>
Install ESP-IDF Components<additionalfeatures/install-esp-components>
Language Tools<additionalfeatures/language-tools>
NVS Partition Table Editor<additionalfeatures/nvs-partition-editor>
Partition Table Editor<additionalfeatures/partition-table-editor>
Project Configuration Editor<additionalfeatures/project-configuration>
Expand Down
145 changes: 145 additions & 0 deletions docs_espressif/en/additionalfeatures/language-tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
ESP-IDF Chat Commands
=================================

This feature lets you run ESP-IDF commands directly from the VS Code chat window.
Instead of typing terminal commands, you can simply ask in chat - and the tool will execute common ESP-IDF actions for you, like building, flashing, or monitoring your project.

.. _available-language-commands:

Available Commands
------------------

The tool supports the following ESP-IDF commands:

Command Parameters
~~~~~~~~~~~~~~~~~~

Some commands support additional parameters to customize their behavior:

* **target** - Specifies the ESP32 target device (for ``setTarget`` command). Supported values: esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux
* **partitionToUse** - Specifies which partition to build or flash (for ``build``, ``flash``, and ``buildFlashMonitor`` commands). Supported values: app, bootloader, partition-table
* **flashType** - Specifies the flash method to use (for ``flash`` and ``buildFlashMonitor`` commands). Supported values: UART, JTAG, DFU

Build and Flash Commands
~~~~~~~~~~~~~~~~~~~~~~~~

* **build** - Build the ESP-IDF project (``espIdf.buildDevice``)
* Optional parameter: ``partitionToUse`` (app, bootloader, partition-table)
* **flash** - Flash the built application to the device (``espIdf.flashDevice``)
* Optional parameters: ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)
* **monitor** - Monitor the device output (``espIdf.monitorDevice``)
* **buildFlashMonitor** - Build, flash, and monitor the project in one command (``espIdf.buildFlashMonitor``)
* Optional parameters: ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)

Project Management Commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~

* **fullClean** - Perform a full clean of the project (``espIdf.fullClean``)
* **menuconfig** - Open the ESP-IDF menuconfig interface (``espIdf.menuconfig.start``)
* **size** - Analyze the application size (``espIdf.size``)
* **eraseFlash** - Erase the device flash memory (``espIdf.eraseFlash``)

Configuration Commands
~~~~~~~~~~~~~~~~~~~~~~

* **selectPort** - Select the serial port for communication (``espIdf.selectPort``)
* **setTarget** - Set the ESP32 target device (``espIdf.setTarget``)
* Optional parameter: ``target`` (esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux)
* **doctor** - Run the ESP-IDF doctor command to diagnose issues (``espIdf.doctorCommand``)

Development Commands
~~~~~~~~~~~~~~~~~~~~

* **newProject** - Create a new ESP-IDF project (``espIdf.newProject.start``)
* **partitionTable** - Open the partition table editor (``esp.webview.open.partition-table``)
* **componentManager** - Open the ESP component manager (``esp.component-manager.ui.show``)
* **apptrace** - Start application tracing (``espIdf.apptrace``)
* **heaptrace** - Start heap tracing (``espIdf.heaptrace``)

Usage
------

Press menu ``View`` > ``Chat`` to open the chat window.

You can type in the chat windows using natural language, and the tool will interpret your request to execute the appropriate ESP-IDF command.

**Natural Language Patterns**:

- "build the project"
- "flash the device"
- "monitor the output"
- "clean the project"
- "configure the project"
- "analyze size"
- "erase flash"
- "select port"
- "set target to esp32c6"
- "run doctor"
- "create new project"
- "edit partition table"
- "manage components"
- "start app trace"
- "start heap trace"

You can alternatively type ``#espIdfCommands <tag>`` to invoke the command directly. Replace ``<tag>`` with one of the supported command tags from :ref:`Available Commands <available-language-commands>`.

.. note::

* While the Chat can understand natural language, using the specific ``#espIdfCommands <tag>`` command format ensures accurate command execution.
* The tool is designed to handle one command at a time. For multiple actions, please enter them separately.
* Ensure your ESP-IDF environment is properly set up in VS Code for the commands to work correctly. Review the documentation to :ref:`Install ESP-IDF and Tools <installation>`.

For example, to build the project, you can type:

.. code-block:: text

build the project

.. code-block:: text

#espIdfCommands build

A dialog will appear to ``Confirm ESP-IDF Command``. Click ``Allow`` to proceed.

.. figure:: ../../_static/confirm-idf-cmd-message.png
:align: center
:alt: Confirm ESP-IDF Command
:figclass: align-center

The command will execute, and the output will be displayed in the terminal (if the command uses a terminal) and the chat window. Some commands may not produce output and launch a UI (like ``newProject``).


Examples
~~~~~~~~~~~~~~

Here are some examples of how to use the commands with parameters:

**Setting Target:**

* "set target to esp32s3"
* "#espIdfCommands setTarget esp32c6"

**Building Specific Partitions:**

* "build partition-table"
* "#espIdfCommands build bootloader"
* "build bootloader"
* "#espIdfCommands build partition-table"

**Flashing with Different Methods:**

* "flash with UART"
* "#espIdfCommands flash UART"
* "flash with JTAG"
* "#espIdfCommands flash JTAG"
* "flash with DFU"
* "#espIdfCommands flash DFU"

**Combined Operations:**

* "build and flash app with UART"
* "#espIdfCommands buildFlashMonitor app UART"
* "build and flash bootloader with JTAG"
* "#espIdfCommands buildFlashMonitor bootloader JTAG"
* "build and flash partition table with DFU"
* "#espIdfCommands buildFlashMonitor partition-table DFU"
1 change: 1 addition & 0 deletions docs_espressif/zh_CN/additionalfeatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
堆跟踪<additionalfeatures/heap-tracing>
提示查看器<additionalfeatures/hints-viewer>
安装 ESP-IDF 组件<additionalfeatures/install-esp-components>
语言工具<additionalfeatures/language-tools>
NVS 分区表编辑器<additionalfeatures/nvs-partition-editor>
分区表编辑器<additionalfeatures/partition-table-editor>
项目配置编辑器<additionalfeatures/project-configuration>
Expand Down
145 changes: 145 additions & 0 deletions docs_espressif/zh_CN/additionalfeatures/language-tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
ESP-IDF 聊天命令
================

此功能允许您直接从 VS Code 聊天窗口运行 ESP-IDF 命令。
无需输入终端命令,您只需在聊天中询问 - 工具将为您执行常见的 ESP-IDF 操作,如构建、烧录或监控您的项目。

.. _available-language-commands:

可用命令
--------

该工具支持以下 ESP-IDF 命令:

命令参数
~~~~~~~~

某些命令支持附加参数来自定义其行为:

* **target** - 指定 ESP32 目标设备(用于 ``setTarget`` 命令)。支持的值:esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux
* **partitionToUse** - 指定要构建或烧录的分区(用于 ``build``、``flash`` 和 ``buildFlashMonitor`` 命令)。支持的值:app, bootloader, partition-table
* **flashType** - 指定要使用的烧录方法(用于 ``flash`` 和 ``buildFlashMonitor`` 命令)。支持的值:UART, JTAG, DFU

构建和烧录命令
~~~~~~~~~~~~~~~

* **build** - 构建 ESP-IDF 项目 (``espIdf.buildDevice``)
* 可选参数 ``partitionToUse`` (app, bootloader, partition-table)
* **flash** - 将构建的应用程序烧录到设备 (``espIdf.flashDevice``)
* 可选参数 ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)
* **monitor** - 监控设备输出 (``espIdf.monitorDevice``)
* **buildFlashMonitor** - 在一个命令中构建、烧录和监控项目 (``espIdf.buildFlashMonitor``)
* 可选参数 ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)

项目管理命令
~~~~~~~~~~~~~

* **fullClean** - 执行项目的完全清理 (``espIdf.fullClean``)
* **menuconfig** - 打开 ESP-IDF menuconfig 界面 (``espIdf.menuconfig.start``)
* **size** - 分析应用程序大小 (``espIdf.size``)
* **eraseFlash** - 擦除设备闪存 (``espIdf.eraseFlash``)

配置命令
~~~~~~~~~

* **selectPort** - 选择用于通信的串口 (``espIdf.selectPort``)
* **setTarget** - 设置 ESP32 目标设备 (``espIdf.setTarget``)
* 可选参数:``target`` (esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux)
* **doctor** - 运行 ESP-IDF doctor 命令诊断问题 (``espIdf.doctorCommand``)

开发命令
~~~~~~~~~

* **newProject** - 创建新的 ESP-IDF 项目 (``espIdf.newProject.start``)
* **partitionTable** - 打开分区表编辑器 (``esp.webview.open.partition-table``)
* **componentManager** - 打开 ESP 组件管理器 (``esp.component-manager.ui.show``)
* **apptrace** - 启动应用程序跟踪 (``espIdf.apptrace``)
* **heaptrace** - 启动堆跟踪 (``espIdf.heaptrace``)

使用方法
--------

按菜单 ``视图`` > ``聊天`` 打开聊天窗口。

您可以在聊天窗口中使用自然语言输入,工具将解释您的请求以执行相应的 ESP-IDF 命令。

**自然语言模式**:

- "构建项目"
- "烧录设备"
- "监控输出"
- "清理项目"
- "配置项目"
- "分析大小"
- "擦除闪存"
- "选择端口"
- "设置目标为 esp32c6"
- "运行诊断"
- "创建新项目"
- "编辑分区表"
- "管理组件"
- "启动应用跟踪"
- "启动堆跟踪"

您也可以输入 ``#espIdfCommands <标签>`` 来直接调用命令。将 ``<标签>`` 替换为 :ref:`可用命令 <available-language-commands>` 中列出的支持的命令标签之一。

.. note::

* 虽然聊天可以理解自然语言,但使用特定的 ``#espIdfCommands <标签>`` 命令格式可确保准确的命令执行。
* 该工具设计为一次处理一个命令。对于多个操作,请分别输入。
* 确保您的 ESP-IDF 环境在 VS Code 中正确设置,命令才能正常工作。请查看文档以了解 :ref:`安装 ESP-IDF 和工具 <installation>`。

例如,要构建项目,您可以输入:

.. code-block:: text

构建项目

.. code-block:: text

#espIdfCommands build

将出现一个 ``确认 ESP-IDF 命令`` 对话框。点击 ``允许`` 继续。

.. figure:: ../../_static/confirm-idf-cmd-message.png
:align: center
:alt: 确认 ESP-IDF 命令
:figclass: align-center

命令将执行,输出将显示在终端中(如果命令使用终端)和聊天窗口中。某些命令可能不会产生输出并启动 UI(如 ``newProject``)。


命令示例
~~~~~~~~

以下是一些使用带参数命令的示例:

**设置目标:**

* "设置目标为 esp32s3"
* "#espIdfCommands setTarget esp32c6"

**构建特定分区:**

* "构建应用"
* "#espIdfCommands build bootloader"
* "构建引导加载程序"
* "#espIdfCommands build partition-table"

**使用不同方法烧录:**

* "使用 UART 烧录"
* "#espIdfCommands flash UART"
* "使用 JTAG 烧录"
* "#espIdfCommands flash JTAG"
* "使用 DFU 烧录"
* "#espIdfCommands flash DFU"

**组合操作:**

* "构建并烧录应用使用 UART"
* "#espIdfCommands buildFlashMonitor app UART"
* "构建并烧录引导加载程序使用 JTAG"
* "#espIdfCommands buildFlashMonitor bootloader JTAG"
* "构建并烧录分区表使用 DFU"
* "#espIdfCommands buildFlashMonitor partition-table DFU"
Loading