Skip to content

Commit 51ab80e

Browse files
authored
docs: Provide CN translation for kconfigeditor.rst (#1374)
1 parent 26e9f94 commit 51ab80e

3 files changed

Lines changed: 179 additions & 32 deletions

File tree

docs/en/additionalfeatures/kconfigeditor.rst

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
KConfig Editor
22
==============
33

4+
:link_to_translation:`zh_CN:[中文]`
5+
46
The KConfig Editor provides enhanced editing capabilities for ESP-IDF configuration files, including syntax highlighting, content assist, and intelligent editing features. It supports all KConfig file types used in ESP-IDF projects.
57

68
Supported File Types
79
--------------------
810

911
The KConfig Editor automatically recognizes and provides enhanced editing for the following file types:
1012

11-
- ``Kconfig`` - Main configuration files
12-
- ``Kconfig.projbuild`` - Project-specific configuration files
13+
- ``Kconfig`` Main configuration files
14+
- ``Kconfig.projbuild`` Project-specific configuration files
1315

1416
Features
1517
--------
@@ -19,30 +21,30 @@ Syntax Highlighting
1921

2022
The editor provides comprehensive syntax highlighting for all KConfig language constructs:
2123

22-
- **Keywords**: ``config``, ``menuconfig``, ``choice``, ``menu``, ``endmenu``, ``endchoice``
23-
- **Types**: ``bool``, ``tristate``, ``string``, ``hex``, ``int``
24-
- **Properties**: ``default``, ``depends``, ``select``, ``help``, ``prompt``
25-
- **Values**: ``y``, ``n``, ``m``, string literals, hexadecimal and integer values
26-
- **Comments**: Line comments starting with ``#``
24+
- **Keywords**: ``config``, ``menuconfig``, ``choice``, ``menu``, ``endmenu``, ``endchoice``.
25+
- **Types**: ``bool``, ``tristate``, ``string``, ``hex``, ``int``.
26+
- **Properties**: ``default``, ``depends``, ``select``, ``help``, ``prompt``.
27+
- **Values**: ``y``, ``n``, ``m``, string literals, hexadecimal and integer values.
28+
- **Comments**: Line comments starting with ``#``.
2729

2830
Content Assist
2931
~~~~~~~~~~~~~~
3032

3133
Intelligent content proposals are available when editing KConfig files:
3234

3335
- **Main Keywords**: Proposals for ``config``, ``menuconfig``, ``choice``, ``menu``, etc.
34-
- **Types**: Suggestions for ``bool``, ``tristate``, ``string``, ``hex``, ``int``
35-
- **Properties**: Auto-completion for ``default``, ``depends``, ``select``, ``help``, ``prompt``
36-
- **Values**: Context-aware suggestions for ``y``, ``n``, ``m``, and string values
36+
- **Types**: Suggestions for ``bool``, ``tristate``, ``string``, ``hex``, ``int``.
37+
- **Properties**: Auto-completion for ``default``, ``depends``, ``select``, ``help``, ``prompt``.
38+
- **Values**: Context-aware suggestions for ``y``, ``n``, ``m``, and string values.
3739

38-
Auto-closing Pairs
40+
Auto-Closing Pairs
3941
~~~~~~~~~~~~~~~~~~
4042

4143
The editor automatically handles bracket and quote pairing:
4244

43-
- **Parentheses**: Automatically closes ``(`` with ``)``
44-
- **Quotes**: Automatically closes ``"`` with ``"``
45-
- **Smart Cursor Positioning**: Cursor stays in the optimal position for continued typing
45+
- **Parentheses**: Automatically closes ``(`` with ``)``.
46+
- **Quotes**: Automatically closes ``"`` with ``"``.
47+
- **Smart Cursor Positioning**: Cursor stays in the optimal position for continued typing.
4648

4749
Example of auto-closing pairs:
4850

@@ -62,28 +64,28 @@ Smart Indentation
6264

6365
The editor provides intelligent indentation rules for KConfig structure:
6466

65-
- **Increase Indent**: After ``menu``, ``config``, ``menuconfig``, ``choice``, ``help``, ``comment``
66-
- **Decrease Indent**: After ``endmenu``, ``endchoice``, ``endif``
67-
- **Consistent Formatting**: Maintains proper KConfig file structure
67+
- **Increase Indent**: After ``menu``, ``config``, ``menuconfig``, ``choice``, ``help``, ``comment``.
68+
- **Decrease Indent**: After ``endmenu``, ``endchoice``, ``endif``.
69+
- **Consistent Formatting**: Maintains proper KConfig file structure.
6870

6971
Bracket Matching
7072
~~~~~~~~~~~~~~~~
7173

7274
Visual highlighting of matching bracket pairs:
7375

74-
- **Menu Blocks**: ``menu`` and ``endmenu`` pairs
75-
- **Choice Blocks**: ``choice`` and ``endchoice`` pairs
76-
- **Parentheses**: ``(`` and ``)`` pairs
77-
- **Quotes**: ``"`` and ``"`` pairs
76+
- **Menu Blocks**: ``menu`` and ``endmenu`` pairs.
77+
- **Choice Blocks**: ``choice`` and ``endchoice`` pairs.
78+
- **Parentheses**: ``(`` and ``)`` pairs.
79+
- **Quotes**: ``"`` and ``"`` pairs.
7880

7981
Code Folding
8082
~~~~~~~~~~~~
8183

8284
Support for folding KConfig blocks:
8385

84-
- **Menu Sections**: Fold/unfold menu blocks
85-
- **Choice Sections**: Fold/unfold choice blocks
86-
- **Comment Regions**: Fold/unfold comment sections
86+
- **Menu Sections**: Fold/unfold menu blocks.
87+
- **Choice Sections**: Fold/unfold choice blocks.
88+
- **Comment Regions**: Fold/unfold comment sections.
8789

8890
Usage
8991
-----
@@ -93,9 +95,9 @@ Opening KConfig Files
9395

9496
KConfig files are automatically opened with the enhanced editor when:
9597

96-
1. Double-clicking on any ``Kconfig`` or ``Kconfig.projbuild`` file in the Project Explorer
97-
2. Right-clicking and selecting "Open With > KConfig Editor"
98-
3. Opening files from the File menu
98+
1. Double-clicking on any ``Kconfig`` or ``Kconfig.projbuild`` file in the Project Explorer.
99+
2. Right-clicking and selecting ``Open With`` > ``KConfig Editor``.
100+
3. Opening files from the ``File`` menu.
99101

100102
The editor will automatically detect the file type and apply the appropriate syntax highlighting and features.
101103

@@ -104,10 +106,10 @@ Editing KConfig Files
104106

105107
When editing KConfig files, you can take advantage of:
106108

107-
- **Content Assist**: Press ``Ctrl+Space`` to trigger content proposals
108-
- **Auto-completion**: Type partial keywords and press ``Tab`` to complete
109-
- **Bracket Navigation**: Use ``Ctrl+Shift+P`` to jump between matching brackets
110-
- **Code Folding**: Click the fold icons in the editor gutter to collapse/expand sections
109+
- **Content Assist**: Press ``Ctrl+Space`` to trigger content proposals.
110+
- **Auto-completion**: Type partial keywords and press ``Tab`` to complete.
111+
- **Bracket Navigation**: Use ``Ctrl+Shift+P`` to jump between matching brackets.
112+
- **Code Folding**: Click the fold icons in the editor gutter to collapse/expand sections.
111113

112114
Example KConfig Entry
113115
~~~~~~~~~~~~~~~~~~~~~
@@ -141,4 +143,3 @@ References
141143
- `ESP-IDF KConfig Language Reference <https://docs.espressif.com/projects/esp-idf-kconfig/en/latest/kconfiglib/language.html>`_
142144
- `KConfig Language Documentation <https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt>`_
143145
- `Eclipse TM4E Documentation <https://github.com/eclipse/tm4e>`_
144-

docs/zh_CN/additionalfeatures.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
LSP C/C++ 编辑器 <additionalfeatures/lspeditor>
1010
CMake 编辑器 <additionalfeatures/cmakeeditor>
11+
KConfig 编辑器 <additionalfeatures/kconfigeditor>
1112
ESP-IDF 应用程序大小分析 <additionalfeatures/application-size-analysis>
1213
ESP-IDF 终端 <additionalfeatures/esp-terminal>
1314
安装 ESP-IDF 组件 <additionalfeatures/install-esp-components>
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
KConfig 编辑器
2+
==============
3+
4+
:link_to_translation:`en:[English]`
5+
6+
KConfig 编辑器为 ESP-IDF 配置文件提供增强的编辑功能,包括语法高亮、内容辅助和智能编辑。该编辑器支持 ESP-IDF 项目中使用的所有 KConfig 文件类型。
7+
8+
支持的文件类型
9+
--------------
10+
11+
KConfig 编辑器会自动识别并为下列文件类型提供增强编辑:
12+
13+
- ``Kconfig`` – 主配置文件
14+
- ``Kconfig.projbuild`` – 项目特定的配置文件
15+
16+
功能
17+
----
18+
19+
语法高亮
20+
~~~~~~~~
21+
22+
该编辑器为所有 KConfig 语言结构提供全面的语法高亮:
23+
24+
- **关键字**:``config``、``menuconfig``、``choice``、``menu``、``endmenu``、``endchoice``。
25+
- **类型**:``bool``、``tristate``、``string``、``hex``、``int``。
26+
- **属性**:``default``、``depends``、``select``、``help``、``prompt``。
27+
- **取值**:``y``、``n``、``m``、字符串字面量、十六进制与整数值。
28+
- **注释**:以 ``#`` 开头的行注释。
29+
30+
内容辅助
31+
~~~~~~~~
32+
33+
编辑 KConfig 文件时提供智能建议:
34+
35+
- **主要关键字**:对 ``config``、``menuconfig``、``choice``、``menu`` 等的建议。
36+
- **类型**:对 ``bool``、``tristate``、``string``、``hex``、``int`` 的建议。
37+
- **属性**:对 ``default``、``depends``、``select``、``help``、``prompt`` 的自动补全。
38+
- **取值**:针对 ``y``、``n``、``m`` 与字符串值的上下文感知建议。
39+
40+
自动补全成对符号
41+
~~~~~~~~~~~~~~~~
42+
43+
编辑器会自动处理括号和引号的成对输入:
44+
45+
- **圆括号**:输入 ``(`` 时自动补全 ``)``。
46+
- **引号**:输入 ``"`` 时自动补全 ``"``。
47+
- **智能光标定位**:光标保持在继续输入的最佳位置。
48+
49+
自动补全成对符号示例:
50+
51+
.. code-block:: kconfig
52+
53+
config ESP32_WIFI_ENABLED
54+
bool "Enable WiFi"
55+
default y
56+
depends on (IDF_TARGET="esp32" || IDF_TARGET="esp32s2")
57+
help
58+
"Enable WiFi support for ESP32"
59+
60+
当输入 ``depends on (`` 时,编辑器会自动补上 ``)``,并将光标置于二者之间。
61+
62+
智能缩进
63+
~~~~~~~~
64+
65+
编辑器为 KConfig 结构提供智能缩进规则:
66+
67+
- **增加缩进**:在 ``menu``、``config``、``menuconfig``、``choice``、``help``、``comment`` 之后。
68+
- **减少缩进**:在 ``endmenu``、``endchoice``、``endif`` 之后。
69+
- **格式一致性**:保持正确的 KConfig 文件结构。
70+
71+
括号匹配
72+
~~~~~~~~
73+
74+
支持高亮匹配成对符号:
75+
76+
- **菜单块**:``menu`` 与 ``endmenu`` 成对。
77+
- **选择块**:``choice`` 与 ``endchoice`` 成对。
78+
- **圆括号**:``(`` 与 ``)`` 成对。
79+
- **引号**:``"`` 与 ``"`` 成对。
80+
81+
代码折叠
82+
~~~~~~~~
83+
84+
支持折叠 KConfig 代码块:
85+
86+
- **菜单区域**:折叠或展开菜单块。
87+
- **选择区域**:折叠或展开选择块。
88+
- **注释区域**:折叠或展开注释段。
89+
90+
用法
91+
----
92+
93+
打开 KConfig 文件
94+
~~~~~~~~~~~~~~~~~
95+
96+
在以下情况下,KConfig 文件会自动使用增强型编辑器打开:
97+
98+
1. 在项目资源管理器中双击任意 ``Kconfig`` 或 ``Kconfig.projbuild`` 文件。
99+
2. 右键点击并选择 ``Open With`` > ``KConfig Editor``。
100+
3. 从 ``File`` 菜单打开文件。
101+
102+
编辑器会自动检测文件类型并应用相应的语法高亮与其他编辑功能。
103+
104+
编辑 KConfig 文件
105+
~~~~~~~~~~~~~~~~~
106+
107+
编辑 KConfig 文件时,可以使用:
108+
109+
- **内容辅助**:按 ``Ctrl+Space`` 触发内容建议。
110+
- **自动补全**:输入部分关键字后按 ``Tab`` 补全内容。
111+
- **括号导航**:使用 ``Ctrl+Shift+P`` 在匹配的括号之间跳转。
112+
- **代码折叠**:点击编辑器边栏中的折叠图标以折叠或展开内容。
113+
114+
KConfig 条目示例
115+
~~~~~~~~~~~~~~~~
116+
117+
下面是一个带有语法高亮的完整 KConfig 条目示例:
118+
119+
.. code-block:: kconfig
120+
121+
config ESP32_WIFI_ENABLED
122+
bool "Enable WiFi Support"
123+
default y
124+
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2
125+
select ESP32_WIFI
126+
help
127+
Enable WiFi support for ESP32 and ESP32-S2 chips.
128+
129+
This option enables the WiFi driver and related functionality.
130+
It requires the ESP32 or ESP32-S2 target to be selected.
131+
132+
config ESP32_WIFI_MAX_CONN_NUM
133+
int "Maximum number of WiFi connections"
134+
range 1 10
135+
default 4
136+
depends on ESP32_WIFI_ENABLED
137+
help
138+
Maximum number of concurrent WiFi connections supported.
139+
140+
参考资料
141+
--------
142+
143+
- `ESP-IDF KConfig 语言参考 <https://docs.espressif.com/projects/esp-idf-kconfig/en/latest/kconfiglib/language.html>`_
144+
- `KConfig 语言文档 <https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt>`_
145+
- `Eclipse TM4E 文档 <https://github.com/eclipse/tm4e>`_

0 commit comments

Comments
 (0)