|
| 1 | +LSP C/C++ Editor |
| 2 | +================= |
| 3 | + |
| 4 | +Starting with Espressif IDE 3.0.0, the LSP Editor is the default code editor, which differs in several ways from the previous default editor. Below are the most notable differences: |
| 5 | + |
| 6 | +Formatting |
| 7 | +---------- |
| 8 | + |
| 9 | +To customize formatting, open the ``.clang-format`` file located in your project. By default, the file contains the following content: |
| 10 | + |
| 11 | +.. code-block:: none |
| 12 | +
|
| 13 | + BasedOnStyle: LLVM |
| 14 | + UseTab: Always |
| 15 | + IndentWidth: 4 |
| 16 | + TabWidth: 4 |
| 17 | + PackConstructorInitializers: NextLineOnly |
| 18 | + BreakConstructorInitializers: AfterColon |
| 19 | + IndentAccessModifiers: false |
| 20 | + AccessModifierOffset: -4 |
| 21 | +
|
| 22 | +You can also disable formatting for specific folders by using the ``DisableFormat: true`` option. For example, if you want to disable formatting for the ``managed_components`` folder in a project structured like this: |
| 23 | + |
| 24 | +.. code-block:: none |
| 25 | +
|
| 26 | + project |
| 27 | + ├── managed_components |
| 28 | + │ └── .clang-format |
| 29 | + ├── main |
| 30 | + └── .clang-format |
| 31 | +
|
| 32 | +Add the ``DisableFormat: true`` option to the ``.clang-format`` file in the ``managed_components`` folder. This flag tells ClangFormat to completely ignore this specific ``.clang-format`` file and its formatting rules within the ``managed_components`` directory. |
| 33 | + |
| 34 | +For more information about available style options, refer to `the Clang-Format Style Options guide <https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options>`_. |
| 35 | + |
| 36 | +Search |
| 37 | +------ |
| 38 | + |
| 39 | +The "search text" option in the right-click menu is currently unavailable in the LSP-based C/C++ Editor. However, you can use the toolbar menu **Search > Text > Workspace** as a workaround. |
| 40 | + |
| 41 | +Inlay Hints |
| 42 | +----------- |
| 43 | + |
| 44 | +The LSP Editor has inlay hints enabled by default. If you prefer not to use them, you can disable this feature by editing the ``.clangd`` file: |
| 45 | + |
| 46 | +.. code-block:: none |
| 47 | +
|
| 48 | + CompileFlags: |
| 49 | + CompilationDatabase: build |
| 50 | + Remove: |
| 51 | + - -m* |
| 52 | + - -f* |
| 53 | +
|
| 54 | + InlayHints: |
| 55 | + Enabled: No |
| 56 | +
|
| 57 | +Searching ESP-IDF Components |
| 58 | +---------------------------- |
| 59 | + |
| 60 | +To browse ESP-IDF components, follow these steps: |
| 61 | + |
| 62 | +- Create a new project. |
| 63 | +- Add the ESP-IDF components folder as a virtual folder to the newly created project. |
| 64 | +- Press **Ctrl + Shift + T** or **Ctrl + Shift + R**. |
| 65 | +- You should now be able to browse the ESP-IDF component files. |
| 66 | +- To search for a specific function or keyword, use the Search menu in the toolbar. |
| 67 | + |
| 68 | +Creating a Virtual Folder |
| 69 | +------------------------- |
| 70 | + |
| 71 | +- Navigate to **New > Folder**. |
| 72 | +- Click on **Advanced**. |
| 73 | +- Select **Link to alternate Location (Linked Folder)**. |
| 74 | +- Click **Browse** and select the ``ESP-IDF components`` folder. |
| 75 | + |
| 76 | +It is recommended to always create a new project instead of modifying your current one to avoid unnecessary Git files and error markers created by the indexer for the components folder. Since both projects will be in the same workspace, you should be able to search anywhere within your workspace. |
0 commit comments