Skip to content

Commit 2169c28

Browse files
[VSC-1684] Run idf command from IDE AI Chat (#1621)
* add nlp idf command run language tool * fix docs issues * update redhat extension tester to last version * lower vscode to support extension tester ui tests * update set target to pass idf target argument * focus on terminal or esp idf output for lang tool cmd execution * fix set target with target string to show idf targer mismatch msg * use functions directly for language tool better feedback * fix hints theme icon * use customExecution * fix lint * fix idf size task * rm commented code, update docs * fix Task has not been executed yet issue * update docs * fix docs issues * add terminal colors * update docs
1 parent d9ecca0 commit 2169c28

File tree

26 files changed

+2155
-429
lines changed

26 files changed

+2155
-429
lines changed
13.8 KB
Loading

docs_espressif/en/additionalfeatures.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Additional IDE Features
2121
Heap Tracing<additionalfeatures/heap-tracing>
2222
Hints Viewer<additionalfeatures/hints-viewer>
2323
Install ESP-IDF Components<additionalfeatures/install-esp-components>
24+
Language Tools<additionalfeatures/language-tools>
2425
NVS Partition Table Editor<additionalfeatures/nvs-partition-editor>
2526
Partition Table Editor<additionalfeatures/partition-table-editor>
2627
Project Configuration Editor<additionalfeatures/project-configuration>
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
ESP-IDF Chat Commands
2+
=================================
3+
4+
This feature lets you run ESP-IDF commands directly from the VS Code chat window.
5+
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.
6+
7+
.. _available-language-commands:
8+
9+
Available Commands
10+
------------------
11+
12+
The tool supports the following ESP-IDF commands:
13+
14+
Command Parameters
15+
~~~~~~~~~~~~~~~~~~
16+
17+
Some commands support additional parameters to customize their behavior:
18+
19+
* **target** - Specifies the ESP32 target device (for ``setTarget`` command). Supported values: esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux
20+
* **partitionToUse** - Specifies which partition to build or flash (for ``build``, ``flash``, and ``buildFlashMonitor`` commands). Supported values: app, bootloader, partition-table
21+
* **flashType** - Specifies the flash method to use (for ``flash`` and ``buildFlashMonitor`` commands). Supported values: UART, JTAG, DFU
22+
23+
Build and Flash Commands
24+
~~~~~~~~~~~~~~~~~~~~~~~~
25+
26+
* **build** - Build the ESP-IDF project (``espIdf.buildDevice``)
27+
* Optional parameter: ``partitionToUse`` (app, bootloader, partition-table)
28+
* **flash** - Flash the built application to the device (``espIdf.flashDevice``)
29+
* Optional parameters: ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)
30+
* **monitor** - Monitor the device output (``espIdf.monitorDevice``)
31+
* **buildFlashMonitor** - Build, flash, and monitor the project in one command (``espIdf.buildFlashMonitor``)
32+
* Optional parameters: ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)
33+
34+
Project Management Commands
35+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
36+
37+
* **fullClean** - Perform a full clean of the project (``espIdf.fullClean``)
38+
* **menuconfig** - Open the ESP-IDF menuconfig interface (``espIdf.menuconfig.start``)
39+
* **size** - Analyze the application size (``espIdf.size``)
40+
* **eraseFlash** - Erase the device flash memory (``espIdf.eraseFlash``)
41+
42+
Configuration Commands
43+
~~~~~~~~~~~~~~~~~~~~~~
44+
45+
* **selectPort** - Select the serial port for communication (``espIdf.selectPort``)
46+
* **setTarget** - Set the ESP32 target device (``espIdf.setTarget``)
47+
* Optional parameter: ``target`` (esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux)
48+
* **doctor** - Run the ESP-IDF doctor command to diagnose issues (``espIdf.doctorCommand``)
49+
50+
Development Commands
51+
~~~~~~~~~~~~~~~~~~~~
52+
53+
* **newProject** - Create a new ESP-IDF project (``espIdf.newProject.start``)
54+
* **partitionTable** - Open the partition table editor (``esp.webview.open.partition-table``)
55+
* **componentManager** - Open the ESP component manager (``esp.component-manager.ui.show``)
56+
* **apptrace** - Start application tracing (``espIdf.apptrace``)
57+
* **heaptrace** - Start heap tracing (``espIdf.heaptrace``)
58+
59+
Usage
60+
------
61+
62+
Press menu ``View`` > ``Chat`` to open the chat window.
63+
64+
You can type in the chat windows using natural language, and the tool will interpret your request to execute the appropriate ESP-IDF command.
65+
66+
**Natural Language Patterns**:
67+
68+
- "build the project"
69+
- "flash the device"
70+
- "monitor the output"
71+
- "clean the project"
72+
- "configure the project"
73+
- "analyze size"
74+
- "erase flash"
75+
- "select port"
76+
- "set target to esp32c6"
77+
- "run doctor"
78+
- "create new project"
79+
- "edit partition table"
80+
- "manage components"
81+
- "start app trace"
82+
- "start heap trace"
83+
84+
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>`.
85+
86+
.. note::
87+
88+
* While the Chat can understand natural language, using the specific ``#espIdfCommands <tag>`` command format ensures accurate command execution.
89+
* The tool is designed to handle one command at a time. For multiple actions, please enter them separately.
90+
* 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>`.
91+
92+
For example, to build the project, you can type:
93+
94+
.. code-block:: text
95+
96+
build the project
97+
98+
.. code-block:: text
99+
100+
#espIdfCommands build
101+
102+
A dialog will appear to ``Confirm ESP-IDF Command``. Click ``Allow`` to proceed.
103+
104+
.. figure:: ../../_static/confirm-idf-cmd-message.png
105+
:align: center
106+
:alt: Confirm ESP-IDF Command
107+
:figclass: align-center
108+
109+
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``).
110+
111+
112+
Examples
113+
~~~~~~~~~~~~~~
114+
115+
Here are some examples of how to use the commands with parameters:
116+
117+
**Setting Target:**
118+
119+
* "set target to esp32s3"
120+
* "#espIdfCommands setTarget esp32c6"
121+
122+
**Building Specific Partitions:**
123+
124+
* "build partition-table"
125+
* "#espIdfCommands build bootloader"
126+
* "build bootloader"
127+
* "#espIdfCommands build partition-table"
128+
129+
**Flashing with Different Methods:**
130+
131+
* "flash with UART"
132+
* "#espIdfCommands flash UART"
133+
* "flash with JTAG"
134+
* "#espIdfCommands flash JTAG"
135+
* "flash with DFU"
136+
* "#espIdfCommands flash DFU"
137+
138+
**Combined Operations:**
139+
140+
* "build and flash app with UART"
141+
* "#espIdfCommands buildFlashMonitor app UART"
142+
* "build and flash bootloader with JTAG"
143+
* "#espIdfCommands buildFlashMonitor bootloader JTAG"
144+
* "build and flash partition table with DFU"
145+
* "#espIdfCommands buildFlashMonitor partition-table DFU"

docs_espressif/zh_CN/additionalfeatures.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
堆跟踪<additionalfeatures/heap-tracing>
2222
提示查看器<additionalfeatures/hints-viewer>
2323
安装 ESP-IDF 组件<additionalfeatures/install-esp-components>
24+
语言工具<additionalfeatures/language-tools>
2425
NVS 分区表编辑器<additionalfeatures/nvs-partition-editor>
2526
分区表编辑器<additionalfeatures/partition-table-editor>
2627
项目配置编辑器<additionalfeatures/project-configuration>
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
ESP-IDF 聊天命令
2+
================
3+
4+
此功能允许您直接从 VS Code 聊天窗口运行 ESP-IDF 命令。
5+
无需输入终端命令,您只需在聊天中询问 - 工具将为您执行常见的 ESP-IDF 操作,如构建、烧录或监控您的项目。
6+
7+
.. _available-language-commands:
8+
9+
可用命令
10+
--------
11+
12+
该工具支持以下 ESP-IDF 命令:
13+
14+
命令参数
15+
~~~~~~~~
16+
17+
某些命令支持附加参数来自定义其行为:
18+
19+
* **target** - 指定 ESP32 目标设备(用于 ``setTarget`` 命令)。支持的值:esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux
20+
* **partitionToUse** - 指定要构建或烧录的分区(用于 ``build``、``flash`` 和 ``buildFlashMonitor`` 命令)。支持的值:app, bootloader, partition-table
21+
* **flashType** - 指定要使用的烧录方法(用于 ``flash`` 和 ``buildFlashMonitor`` 命令)。支持的值:UART, JTAG, DFU
22+
23+
构建和烧录命令
24+
~~~~~~~~~~~~~~~
25+
26+
* **build** - 构建 ESP-IDF 项目 (``espIdf.buildDevice``)
27+
* 可选参数 ``partitionToUse`` (app, bootloader, partition-table)
28+
* **flash** - 将构建的应用程序烧录到设备 (``espIdf.flashDevice``)
29+
* 可选参数 ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)
30+
* **monitor** - 监控设备输出 (``espIdf.monitorDevice``)
31+
* **buildFlashMonitor** - 在一个命令中构建、烧录和监控项目 (``espIdf.buildFlashMonitor``)
32+
* 可选参数 ``partitionToUse`` (app, bootloader, partition-table), ``flashType`` (UART, JTAG, DFU)
33+
34+
项目管理命令
35+
~~~~~~~~~~~~~
36+
37+
* **fullClean** - 执行项目的完全清理 (``espIdf.fullClean``)
38+
* **menuconfig** - 打开 ESP-IDF menuconfig 界面 (``espIdf.menuconfig.start``)
39+
* **size** - 分析应用程序大小 (``espIdf.size``)
40+
* **eraseFlash** - 擦除设备闪存 (``espIdf.eraseFlash``)
41+
42+
配置命令
43+
~~~~~~~~~
44+
45+
* **selectPort** - 选择用于通信的串口 (``espIdf.selectPort``)
46+
* **setTarget** - 设置 ESP32 目标设备 (``espIdf.setTarget``)
47+
* 可选参数:``target`` (esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux)
48+
* **doctor** - 运行 ESP-IDF doctor 命令诊断问题 (``espIdf.doctorCommand``)
49+
50+
开发命令
51+
~~~~~~~~~
52+
53+
* **newProject** - 创建新的 ESP-IDF 项目 (``espIdf.newProject.start``)
54+
* **partitionTable** - 打开分区表编辑器 (``esp.webview.open.partition-table``)
55+
* **componentManager** - 打开 ESP 组件管理器 (``esp.component-manager.ui.show``)
56+
* **apptrace** - 启动应用程序跟踪 (``espIdf.apptrace``)
57+
* **heaptrace** - 启动堆跟踪 (``espIdf.heaptrace``)
58+
59+
使用方法
60+
--------
61+
62+
按菜单 ``视图`` > ``聊天`` 打开聊天窗口。
63+
64+
您可以在聊天窗口中使用自然语言输入,工具将解释您的请求以执行相应的 ESP-IDF 命令。
65+
66+
**自然语言模式**:
67+
68+
- "构建项目"
69+
- "烧录设备"
70+
- "监控输出"
71+
- "清理项目"
72+
- "配置项目"
73+
- "分析大小"
74+
- "擦除闪存"
75+
- "选择端口"
76+
- "设置目标为 esp32c6"
77+
- "运行诊断"
78+
- "创建新项目"
79+
- "编辑分区表"
80+
- "管理组件"
81+
- "启动应用跟踪"
82+
- "启动堆跟踪"
83+
84+
您也可以输入 ``#espIdfCommands <标签>`` 来直接调用命令。将 ``<标签>`` 替换为 :ref:`可用命令 <available-language-commands>` 中列出的支持的命令标签之一。
85+
86+
.. note::
87+
88+
* 虽然聊天可以理解自然语言,但使用特定的 ``#espIdfCommands <标签>`` 命令格式可确保准确的命令执行。
89+
* 该工具设计为一次处理一个命令。对于多个操作,请分别输入。
90+
* 确保您的 ESP-IDF 环境在 VS Code 中正确设置,命令才能正常工作。请查看文档以了解 :ref:`安装 ESP-IDF 和工具 <installation>`。
91+
92+
例如,要构建项目,您可以输入:
93+
94+
.. code-block:: text
95+
96+
构建项目
97+
98+
.. code-block:: text
99+
100+
#espIdfCommands build
101+
102+
将出现一个 ``确认 ESP-IDF 命令`` 对话框。点击 ``允许`` 继续。
103+
104+
.. figure:: ../../_static/confirm-idf-cmd-message.png
105+
:align: center
106+
:alt: 确认 ESP-IDF 命令
107+
:figclass: align-center
108+
109+
命令将执行,输出将显示在终端中(如果命令使用终端)和聊天窗口中。某些命令可能不会产生输出并启动 UI(如 ``newProject``)。
110+
111+
112+
命令示例
113+
~~~~~~~~
114+
115+
以下是一些使用带参数命令的示例:
116+
117+
**设置目标:**
118+
119+
* "设置目标为 esp32s3"
120+
* "#espIdfCommands setTarget esp32c6"
121+
122+
**构建特定分区:**
123+
124+
* "构建应用"
125+
* "#espIdfCommands build bootloader"
126+
* "构建引导加载程序"
127+
* "#espIdfCommands build partition-table"
128+
129+
**使用不同方法烧录:**
130+
131+
* "使用 UART 烧录"
132+
* "#espIdfCommands flash UART"
133+
* "使用 JTAG 烧录"
134+
* "#espIdfCommands flash JTAG"
135+
* "使用 DFU 烧录"
136+
* "#espIdfCommands flash DFU"
137+
138+
**组合操作:**
139+
140+
* "构建并烧录应用使用 UART"
141+
* "#espIdfCommands buildFlashMonitor app UART"
142+
* "构建并烧录引导加载程序使用 JTAG"
143+
* "#espIdfCommands buildFlashMonitor bootloader JTAG"
144+
* "构建并烧录分区表使用 DFU"
145+
* "#espIdfCommands buildFlashMonitor partition-table DFU"

0 commit comments

Comments
 (0)