From f9bbb4011e1068f05cf03e49299c31a4582b0158 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 19 Jan 2019 15:15:52 -0500 Subject: [PATCH] Updated Project Setup (markdown) --- Project-Setup.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Project-Setup.md b/Project-Setup.md index 997f52c..893dab2 100644 --- a/Project-Setup.md +++ b/Project-Setup.md @@ -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`