Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellisense engine to search for headers automatically (VSC-165) #2

Merged
merged 3 commits into from
Jan 19, 2020
Merged
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
14 changes: 6 additions & 8 deletions docs/C_CPP_CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ The [C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vsc

The file is located in {PROJECT_DIR}/.vscode/c_cpp_properties.json and can be generated by using **Create ESP-IDF Project** command.

## Default configuration without compile_commands.json
## Default configuration

This configuration doesn't require the compile_commands.json file generated by build process but requires to use the Tag Parser IntelliSense engine of the C/C++ extension which will explore directories specified in `configurations[i].browse.path` array. An example configuration that should work with most projects is shown below.
With this configuration, the Intellisense engine of the C/C++ extension will include all header files found by performing a recursive search of the `${config:idf.espIdfPath}/components` folder. Both **Default** and **Tag Parser** engines are supported. An example configuration that should work with most projects is shown below.

```
{
Expand All @@ -17,7 +17,7 @@ This configuration doesn't require the compile_commands.json file generated by b
"name": "Linux",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${config:idf.espIdfPath}/components"],
"includePath": ["${config:idf.espIdfPath}/components/**"],
"browse": {
"path": [
"${config:idf.espIdfPath}/components"
Expand All @@ -30,11 +30,9 @@ This configuration doesn't require the compile_commands.json file generated by b
}
```

You need to have `idf.espIdfPath` and set `C_Cpp.intelliSenseEngine` to **Tag Parser** in your Visual Studio Code Settings (Directly in `settings.json` or using the **Preferences:: Open Settings (UI)** command) to allow headers to be resolved by browsing the `${config:idf.espIdfPath}/components` folder.

## Configuration with compile_commands.json

For this configuration you need to build your project beforehand to generate a `${workspaceFolder}/build/compile_commands.json`, where ${workspaceFolder} is your project directory, to able to resolve your C/C++ headers.
For this configuration, you must build your project beforehand in order to generate `${workspaceFolder}/build/compile_commands.json` (where ${workspaceFolder} is your project directory). This file will then be used to resolve your C/C++ headers.

```
{
Expand All @@ -43,9 +41,9 @@ For this configuration you need to build your project beforehand to generate a `
"name": "Linux",
"cStandard": "c11",
"cppStandard": "c++17",
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
```
```
4 changes: 2 additions & 2 deletions templates/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Linux",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": ["${config:idf.espIdfPath}/components"],
"includePath": ["${config:idf.espIdfPath}/components/**"],
"browse": {
"path": [
"${config:idf.espIdfPath}/components"
Expand All @@ -14,4 +14,4 @@
}
],
"version": 4
}
}