Add IDE setting guide in `DEVELOPERS.md`

This commit is contained in:
syheliel 2023-07-19 16:48:39 +08:00 committed by pancake
parent 674617ed81
commit 7a619a13a4
1 changed files with 22 additions and 0 deletions

View File

@ -10,6 +10,28 @@ place to start if you are looking to contribute.
For information about the git process, see
[CONTRIBUTING.md](CONTRIBUTING.md#How_to_contribute).
## IDE settings
### generate compile_commands.json
compile_commands.json records the dependency relationship between `.c/.h` file.
It is used by language server(ccls, clang, e.g.) to provide accurate code
completion, syntax highlighting, and other intelligent code analysis features.
If you haven't built the project yet, you can do the following:
```
sudo apt-get install bear
bear -- ./sys/install.sh
```
If you have built the project:
```
make clean
bear -- make install
```
`bear` is tool that will hook the usage of gcc and generate `compile_commands.json`.
### language server
Both of `ccls` and `clangd` supports `compile_commands.json`. You can add
corresponding plugin for your IDE.
## Documentation
Functions should have descriptive names and parameters. It should be clear what