From beed394d94c2b246312145038c285e279d3ac154 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 13 Jul 2018 20:52:37 -0700 Subject: [PATCH] FAQ --- FAQ.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/FAQ.md b/FAQ.md index 2bcc431..50a7ce0 100644 --- a/FAQ.md +++ b/FAQ.md @@ -20,7 +20,8 @@ For CMake this can be achieved in a single line: `target_include_directories( .ccls` +* emacs-ccls: `(setq ccls-extra-init-params '(:clang (:extraArgs ["-isystem", "/tmp/include"])))` + ### `-std=c++1z` `-std=c++17` `bits/unordered_map.h` -In C++17 mode, it is likely to cause libclang to crash when `bits/unordered_map.h` is indexed. +In C++17 mode, it is possible to cause clang to crash when `bits/unordered_map.h` is indexed. See https://bugs.llvm.org/show_bug.cgi?id=37695 for details. The workaround is to add `-D__cpp_deduction_guides=0 -Wno-macro-redefined` to the initialization option `clang.extraArgs` @@ -59,15 +67,16 @@ In Emacs, it is: [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. +* `(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)` inhibits the behavior. -Then ccls will find `.ccls` or `compile_commands.json` in the root directory. +The root directory is sent to ccls (the language server) through the `rootUri` field in the `initialize` request. +ccls finds `.ccls` or `compile_commands.json` in the directory. ``` proj .ccls-root # Use this file if you want subproject files to be associated with the root project compile_commands.json - subproj0 + subproj0 # without .ccls-root, files will be associated with this root directory .git subproj1 .git @@ -138,11 +147,6 @@ ccls will save a file in `cacheDirectory`: ... ``` -### System header completion - -* `print '%clang\n%cpp -std=gnu++14\n-isystem/usr/include' > .ccls` -* `(setq ccls-extra-init-params '(:clang (:extraArgs ["-isystem", "/usr/include"])))` - ### AST deserialisation error when precompiled headers are used Unfortunately, libclang is very picky when it comes to precompiled headers. Even if your system compiler and the bundled libclang are the same versions there will be problems. Namely, to avoid AST deresialisation errors while using PCH, you need to create them with the same toolchain which will be used inside ccls for completions. @@ -179,7 +183,7 @@ For reference, read [Valloric/ycmd#892](https://github.com/Valloric/ycmd/issues/ * struct A:B{void f()override;}; lists `B` or `B::f()` -### `$ccls/derived` +### `textDocument/implementation` * struct B{virtual void f();}; derived classes or virtual function overrides @@ -188,20 +192,20 @@ For reference, read [Valloric/ycmd#892](https://github.com/Valloric/ycmd/issues/ * A a; lists all instances of user-defined `A`. * int i; lists all instances of `int`. -### [`$ccls/callHierarchy`](https://github.com/MaskRay/cquery/blob/master/src/messages/cquery_call_hierarchy.cc) +### [`$ccls/callHierarchy`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_callHierarchy.cc) ```elisp (ccls-call-hierarchy nil) ; caller hierarchy (ccls-call-hierarchy t) ; callee hierarchy ``` -### [`$ccls/inheritanceHierarchy`](https://github.com/MaskRay/cquery/blob/master/src/messages/cquery_inheritance_hierarchy.cc) +### [`$ccls/inheritanceHierarchy`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_inheritanceHierarchy.cc) ```elisp (ccls-inheritance-hierarchy nil) ; base hierarchy (ccls-inheritance-hierarchy t) ; derived hierarchy ``` -### [`$ccls/memberHierarchy`](https://github.com/MaskRay/cquery/blob/master/src/messages/cquery_member_hierarchy.cc) +### [`$ccls/memberHierarchy`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_memberHierarchy.cc) Recursively list members of a record type. 😂 nobody has implemented UI for the feature. Help wanted!