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
95 changes: 95 additions & 0 deletions docs_espressif/en/additionalfeatures/language-tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
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.

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 listed below.

**#espIdfCommands Tags**: build, flash, monitor, buildFlashMonitor, fullClean, menuconfig, size, eraseFlash, selectPort, setTarget, doctor, newProject, partitionTable, componentManager, apptrace, heaptrace

.. note::

* While the tool can understand natural language, using the specific ``#espIdfCommands <tag>`` 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``).

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

The tool supports the following ESP-IDF commands:

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

* **``build``** - Build the ESP-IDF project (``espIdf.buildDevice``)
* **``flash``** - Flash the built application to the device (``espIdf.flashDevice``)
* **``monitor``** - Monitor the device output (``espIdf.monitorDevice``)
* **``buildFlashMonitor``** - Build, flash, and monitor the project in one command (``espIdf.buildFlashMonitor``)

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``)
* **``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``)
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
95 changes: 95 additions & 0 deletions docs_espressif/zh_CN/additionalfeatures/language-tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
ESP-IDF 聊天命令
================

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

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

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

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

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

您也可以输入 ``#espIdfCommands <标签>`` 来直接调用命令。将 ``<标签>`` 替换为下面列出的支持的命令标签之一。

**#espIdfCommands 标签**: build, flash, monitor, buildFlashMonitor, fullClean, menuconfig, size, eraseFlash, selectPort, setTarget, doctor, newProject, partitionTable, componentManager, apptrace, heaptrace

.. 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``)。

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

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

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

* **``build``** - 构建 ESP-IDF 项目 (``espIdf.buildDevice``)
* **``flash``** - 将构建的应用程序烧录到设备 (``espIdf.flashDevice``)
* **``monitor``** - 监控设备输出 (``espIdf.monitorDevice``)
* **``buildFlashMonitor``** - 在一个命令中构建、烧录和监控项目 (``espIdf.buildFlashMonitor``)

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

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

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

* **``selectPort``** - 选择用于通信的串口 (``espIdf.selectPort``)
* **``setTarget``** - 设置 ESP32 目标设备 (``espIdf.setTarget``)
* **``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``)
154 changes: 151 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"theme": "dark"
},
"engines": {
"vscode": "^1.82.0"
"vscode": "^1.100.3"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -109,6 +109,7 @@
"onView:idfPartitionExplorer",
"onView:espRainmaker",
"onView:idfComponents",
"onLanguageModelTool:espIdfCommands",
"workspaceContains:**/CMakeLists.txt"
],
"main": "./dist/extension",
Expand Down Expand Up @@ -2505,6 +2506,153 @@
"type"
]
}
],
"languageModelTools": [
{
"name": "espIdfCommands",
"displayName": "ESP-IDF Commands",
"modelDescription": "Execute ESP-IDF extension commands for building, flashing, monitoring, and managing ESP32 projects. ALWAYS use this tool for ESP-IDF development tasks instead of shell commands or terminal tasks. When users ask to 'build the project', 'flash the device', 'monitor output', 'clean project', 'configure project', 'analyze size', 'create new project', 'set target to esp32s3', or any ESP-IDF related task, use this tool. Supports: build, flash, monitor, menuconfig, size analysis, project creation, component management, target setting, and more. For setTarget command, you can specify a target parameter (esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux) to set it directly. For build, flash, and buildFlashMonitor commands, you can optionally specify partitionToUse (app, bootloader, partition-table) and flashType (UART, JTAG, DFU) parameters. This tool provides detailed feedback about command execution status, automatically focuses the terminal for task commands, and shows the ESP-IDF output channel for other operations. This is the ONLY way to interact with ESP-IDF projects in VS Code - do not use shell commands for ESP-IDF tasks.",
"canBeReferencedInPrompt": true,
"toolReferenceName": "espIdfCommands",
"tags": [
"esp-idf",
"idf",
"idf.py",
"build",
"flash",
"monitor",
"buildFlashMonitor",
"fullClean",
"menuconfig",
"size",
"eraseFlash",
"selectPort",
"setTarget",
"doctor",
"newProject",
"partitionTable",
"componentManager",
"apptrace",
"heaptrace",
"project",
"development",
"build the project",
"flash the device",
"monitor the output",
"clean the project",
"configure the project",
"analyze size",
"erase flash",
"select port",
"set target",
"set target to esp32",
"set target to esp32s2",
"set target to esp32s3",
"set target to esp32c3",
"set target to esp32c6",
"set target to esp32h2",
"set target to esp32p4",
"set target to esp32c2",
"set target to esp32c5",
"set target to esp32c61",
"set target to esp32h21",
"set target to esp32h4",
"set target to linux",
"run doctor",
"create new project",
"edit partition table",
"manage components",
"start app trace",
"start heap trace",
"build app",
"build bootloader",
"build partition table",
"flash app",
"flash bootloader",
"flash partition table",
"build and flash app",
"build and flash bootloader",
"build and flash partition table"
],
"icon": "$(run-view-icon)",
"inputSchema": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The ESP-IDF command to execute. Use this for ESP-IDF project operations like building, flashing, monitoring, and project management.",
"enum": [
"build",
"flash",
"monitor",
"buildFlashMonitor",
"fullClean",
"menuconfig",
"size",
"eraseFlash",
"selectPort",
"setTarget",
"doctor",
"newProject",
"partitionTable",
"componentManager",
"apptrace",
"heaptrace"
],
"default": "build"
},
"target": {
"type": "string",
"description": "The ESP-IDF target to set when using the setTarget command. Common targets include: esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2, esp32p4, esp32c2, esp32c5, esp32c61, esp32h21, esp32h4, linux. This parameter is only used when command is 'setTarget'.",
"enum": [
"esp32",
"esp32s2",
"esp32c3",
"esp32s3",
"esp32c2",
"esp32c6",
"esp32h2",
"esp32p4",
"linux",
"esp32c5",
"esp32c61",
"esp32h21",
"esp32h4"
]
},
"partitionToUse": {
"oneOf": [
{
"type": "string",
"description": "Specifies which partition to build or flash. This parameter is optional and only used for build, flash, and buildFlashMonitor commands.",
"enum": [
"app",
"bootloader",
"partition-table"
]
},
{
"type": "null",
"description": "Use undefined to explicitly use the default configuration"
}
],
"description": "Specifies which partition to build or flash. Use undefined to explicitly use the default configuration. This parameter is optional and only used for build, flash, and buildFlashMonitor commands."
},
"flashType": {
"type": "string",
"description": "Specifies the flash method to use. This parameter is optional and only used for flash and buildFlashMonitor commands.",
"enum": [
"UART",
"JTAG",
"DFU"
]
}
},
"required": [
"command"
]
}
}
]
},
"scripts": {
Expand Down Expand Up @@ -2541,7 +2689,7 @@
"@types/sanitize-html": "^2.6.2",
"@types/tar-fs": "^2.0.1",
"@types/tmp": "0.0.33",
"@types/vscode": "^1.82.0",
"@types/vscode": "^1.100.3",
"@types/ws": "^7.2.5",
"@types/xml2js": "^0.4.11",
"@types/yauzl": "^2.9.1",
Expand Down Expand Up @@ -2578,7 +2726,7 @@
"ts-loader": "^9.4.4",
"typescript": "^5.2.2",
"vite": "^5.4.20",
"vscode-extension-tester": "^8.15.0",
"vscode-extension-tester": "^8.17.0",
"vue-hot-reload-api": "^2.3.2",
"vue-loader": "^17.2.2",
"vue-router": "^4.2.4",
Expand Down
Loading