mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-21 23:25:07 +00:00
Updated Project Setup (markdown)
parent
058203692d
commit
f9bbb4011e
@ -5,7 +5,7 @@ command lines.
|
||||
There are two main ways this happens:
|
||||
|
||||
1. Provide `compile_commands.json` at the project root
|
||||
2. Provide `.ccls`. It is a line-based text file describing compiler flags.
|
||||
2. Provide a [`.ccls` file](#ccls-file). It is a line-based text file describing compiler flags.
|
||||
Recursively listed source files (headers excluded) will be indexed.
|
||||
|
||||
If neither exists, then when ccls starts it will not index anything: instead it
|
||||
@ -131,26 +131,28 @@ with open(os.path.join(sys.argv[1], 'compile_commands.json')) as f:
|
||||
json.dump(db, sys.stdout)
|
||||
```
|
||||
|
||||
## `.ccls`
|
||||
## `.ccls` File
|
||||
|
||||
`.ccls` is a line-based text file at the project root. It's main function is
|
||||
`.ccls` is a line-based text file at the project root. Its main function is
|
||||
to specify compiler flags needed to properly index your code: `-I` `-D` etc.
|
||||
Each line consists of one argument. No whitespace splitting is performed on the
|
||||
argument, thus `-I foo` cannot be used (use `-Ifoo` or `-I\nfoo`).
|
||||
Each line consists of one argument to be added to the compiler command line.
|
||||
No whitespace splitting is performed on the argument, thus `-I foo` cannot be
|
||||
used (use `-Ifoo` or `-I\nfoo` for example).
|
||||
|
||||
Subdirectories of the project can also contain `.ccls` files, if needed, to
|
||||
specify compiler flags specific to those directories.
|
||||
|
||||
A line may start with zero or more `%` directives.
|
||||
A line may optionally start with one or more `%` directives, which specialize
|
||||
the argument on that line.
|
||||
|
||||
Available directives include:
|
||||
|
||||
### `%compile_commands.json`
|
||||
|
||||
By default `.ccls` specify compiler flags of files not listed in
|
||||
By default `.ccls` compiler flags are applied _only_ to files not listed in
|
||||
`compile_commands.json`. If this directive appears first in `.ccls` then after
|
||||
`compile_commands.json` is parsed, the rest lines of `.ccls` will be appended
|
||||
to the compiler flags.
|
||||
`compile_commands.json` is parsed, the rest of the `.ccls` arguments will be
|
||||
_appended_ to the compiler flags for files found in `compile_commands.json`.
|
||||
|
||||
### `%c` / `%cpp` / `%objective-c` / `%objective-cpp`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user