@@ -352,20 +352,28 @@ Clangd will assume the compile command is ``clang $FLAGS some_file.cc``.
352
352
Creating this file by hand is a reasonable place to start if your project is
353
353
quite simple.
354
354
355
- Project-wide Index
356
- ==================
357
-
358
- By default clangd only has a view on symbols coming from files you are
359
- currently editing. You can extend this view to whole project by providing a
360
- project-wide index to clangd. There are two ways to do this.
361
-
362
- - Pass an experimental `-background-index ` command line argument. With
363
- this feature enabled, clangd incrementally builds an index of projects
364
- that you work on and uses the just-built index automatically.
365
-
366
- - Generate an index file using `clangd-indexer
367
- <https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clangd/indexer/IndexerMain.cpp> `__
368
- Then you can pass generated index file to clangd using
369
- `-index-file=/path/to/index_file `. *Note that clangd-indexer isn't
370
- included alongside clangd in the Debian clang-tools package. You will
371
- likely have to build it from source to use this option. *
355
+ Background Indexing
356
+ ===================
357
+
358
+ clangd builds an incremental index of your project (all files listed in the
359
+ compilation database). The index improves code navigation features (go-to-definition,
360
+ find-references) and code completion.
361
+
362
+ - clangd only uses idle cores to build the index, you can limit the total
363
+ amount of cores by passing the `-j=<number> ` flag;
364
+ - the index is saved to the ``.clangd/index `` in the project root; index shards
365
+ for common headers e.g. STL will be stored in `$HOME/.clangd/index `;
366
+ - background indexing can be disabled by the ``--background-index=false `` flag;
367
+ Note that, disabling background-index will limit clangd's knowledge about your
368
+ codebase to files you are currently editing.
369
+
370
+ Build Index Manually
371
+ ====================
372
+
373
+ **DISCLAIMER: This is mainly for clangd developers. **
374
+
375
+ There is a `clangd-indexer <https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clangd/indexer/IndexerMain.cpp >`__
376
+ which generates an index file for your project. To use the index, pass the flag
377
+ `-index=file=/path/to/index_file ` to clangd. *Note that clangd-indexer isn't
378
+ included alongside clangd in the Debian clang-tools package. You will likely
379
+ have to build it from source to use this option. *
0 commit comments