|
| 1 | +KConfig Editor |
| 2 | +============== |
| 3 | + |
| 4 | +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. |
| 5 | + |
| 6 | +Supported File Types |
| 7 | +-------------------- |
| 8 | + |
| 9 | +The KConfig Editor automatically recognizes and provides enhanced editing for the following file types: |
| 10 | + |
| 11 | +- ``Kconfig`` - Main configuration files |
| 12 | +- ``Kconfig.projbuild`` - Project-specific configuration files |
| 13 | + |
| 14 | +Features |
| 15 | +-------- |
| 16 | + |
| 17 | +Syntax Highlighting |
| 18 | +~~~~~~~~~~~~~~~~~~~ |
| 19 | + |
| 20 | +The editor provides comprehensive syntax highlighting for all KConfig language constructs: |
| 21 | + |
| 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 ``#`` |
| 27 | + |
| 28 | +Content Assist |
| 29 | +~~~~~~~~~~~~~~ |
| 30 | + |
| 31 | +Intelligent content proposals are available when editing KConfig files: |
| 32 | + |
| 33 | +- **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 |
| 37 | + |
| 38 | +Auto-closing Pairs |
| 39 | +~~~~~~~~~~~~~~~~~~ |
| 40 | + |
| 41 | +The editor automatically handles bracket and quote pairing: |
| 42 | + |
| 43 | +- **Parentheses**: Automatically closes ``(`` with ``)`` |
| 44 | +- **Quotes**: Automatically closes ``"`` with ``"`` |
| 45 | +- **Smart Cursor Positioning**: Cursor stays in the optimal position for continued typing |
| 46 | + |
| 47 | +Example of auto-closing pairs: |
| 48 | + |
| 49 | +.. code-block:: kconfig |
| 50 | +
|
| 51 | + config ESP32_WIFI_ENABLED |
| 52 | + bool "Enable WiFi" |
| 53 | + default y |
| 54 | + depends on (IDF_TARGET="esp32" || IDF_TARGET="esp32s2") |
| 55 | + help |
| 56 | + "Enable WiFi support for ESP32" |
| 57 | +
|
| 58 | +When you type ``depends on (``, the editor automatically adds ``)`` and positions the cursor between them. |
| 59 | + |
| 60 | +Smart Indentation |
| 61 | +~~~~~~~~~~~~~~~~~ |
| 62 | + |
| 63 | +The editor provides intelligent indentation rules for KConfig structure: |
| 64 | + |
| 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 |
| 68 | + |
| 69 | +Bracket Matching |
| 70 | +~~~~~~~~~~~~~~~~ |
| 71 | + |
| 72 | +Visual highlighting of matching bracket pairs: |
| 73 | + |
| 74 | +- **Menu Blocks**: ``menu`` and ``endmenu`` pairs |
| 75 | +- **Choice Blocks**: ``choice`` and ``endchoice`` pairs |
| 76 | +- **Parentheses**: ``(`` and ``)`` pairs |
| 77 | +- **Quotes**: ``"`` and ``"`` pairs |
| 78 | + |
| 79 | +Code Folding |
| 80 | +~~~~~~~~~~~~ |
| 81 | + |
| 82 | +Support for folding KConfig blocks: |
| 83 | + |
| 84 | +- **Menu Sections**: Fold/unfold menu blocks |
| 85 | +- **Choice Sections**: Fold/unfold choice blocks |
| 86 | +- **Comment Regions**: Fold/unfold comment sections |
| 87 | + |
| 88 | +Usage |
| 89 | +----- |
| 90 | + |
| 91 | +Opening KConfig Files |
| 92 | +~~~~~~~~~~~~~~~~~~~~~ |
| 93 | + |
| 94 | +KConfig files are automatically opened with the enhanced editor when: |
| 95 | + |
| 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 |
| 99 | + |
| 100 | +The editor will automatically detect the file type and apply the appropriate syntax highlighting and features. |
| 101 | + |
| 102 | +Editing KConfig Files |
| 103 | +~~~~~~~~~~~~~~~~~~~~~ |
| 104 | + |
| 105 | +When editing KConfig files, you can take advantage of: |
| 106 | + |
| 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 |
| 111 | + |
| 112 | +Example KConfig Entry |
| 113 | +~~~~~~~~~~~~~~~~~~~~~ |
| 114 | + |
| 115 | +Here's an example of a complete KConfig entry with syntax highlighting: |
| 116 | + |
| 117 | +.. code-block:: kconfig |
| 118 | +
|
| 119 | + config ESP32_WIFI_ENABLED |
| 120 | + bool "Enable WiFi Support" |
| 121 | + default y |
| 122 | + depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 |
| 123 | + select ESP32_WIFI |
| 124 | + help |
| 125 | + Enable WiFi support for ESP32 and ESP32-S2 chips. |
| 126 | + |
| 127 | + This option enables the WiFi driver and related functionality. |
| 128 | + It requires the ESP32 or ESP32-S2 target to be selected. |
| 129 | +
|
| 130 | + config ESP32_WIFI_MAX_CONN_NUM |
| 131 | + int "Maximum number of WiFi connections" |
| 132 | + range 1 10 |
| 133 | + default 4 |
| 134 | + depends on ESP32_WIFI_ENABLED |
| 135 | + help |
| 136 | + Maximum number of concurrent WiFi connections supported. |
| 137 | +
|
| 138 | +Preferences |
| 139 | +----------- |
| 140 | + |
| 141 | +KConfig Editor preferences can be configured in **Eclipse > Preferences > General > Editors > Text Editors**: |
| 142 | + |
| 143 | +- **Syntax Highlighting**: Enable/disable syntax coloring |
| 144 | +- **Content Assist**: Configure auto-completion settings |
| 145 | +- **Indentation**: Adjust indentation rules and tab settings |
| 146 | +- **Bracket Matching**: Enable/disable bracket highlighting |
| 147 | + |
| 148 | +References |
| 149 | +---------- |
| 150 | + |
| 151 | +- `ESP-IDF KConfig Language Reference <https://docs.espressif.com/projects/esp-idf-kconfig/en/latest/kconfiglib/language.html>`_ |
| 152 | +- `KConfig Language Documentation <https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt>`_ |
| 153 | +- `Eclipse TM4E Documentation <https://github.com/eclipse/tm4e>`_ |
| 154 | + |
0 commit comments