Project root

Fangrui Song 2018-04-07 16:35:15 -07:00
parent e7f72d966b
commit 82b2b9f92c

30
FAQ.md

@ -44,18 +44,36 @@ If you want the ccls binary at a specific location use a symlink - do not move t
### Project root detection ### Project root detection
For C++ projects, `compile_commands.json` is used by [emacs-ccls](https://github.com/MaskRay/emacs-cquery/) to mark the project root. This is usually a symlink to the real `compile_commands.json` in a build directory: [emacs-ccls](https://github.com/MaskRay/emacs-cquery/) locates the project root with `ccls-project-root-matchers`:
* `.ccls-root`. If this file exists in any parent directory, that directory is treated as the project root.
* `projectile-project-root`. Then this function is called. You likely don't want `/usr/include/c++/8/algorithm` to be treated as in the project `/usr/include/c++/8/`, `(setq projectile-require-project-root t)` inhibit the behavior.
Then ccls will find `.ccls` or `compile_commands.json` in the root directory.
``` ```
proj proj
build .ccls-root # Use this file if you want subproject files to be associated with the root project
gen
generated_file_in_build.cc
compile_commands.json compile_commands.json
compile_commands.json -> build/compile_commands.json subproj0
.git
subproj1
.git
``` ```
In this example, the `:rootUri` of the generated C++ file is `proj/build/` because of `proj/build/compile_commands.json`. However, the user wants it to be `proj/`. Customize `MaskRay-root-matchers`. ### Maximum number of file descriptors
When indexing ccls itself, some files require more than 1000 file descriptors. Remember to increase `RLIMIT_NOFILE`.
```zsh
ulimit -n 32768
```
`/etc/security/limits.conf`:
```
* hard nofile 32768
* soft nofile 32768
```
### Includes ### Includes