.

Fangrui Song 2019-02-11 23:53:57 +08:00
parent dd673a61e8
commit b6d1f62e10
3 changed files with 12 additions and 22 deletions

@ -9,7 +9,7 @@ Otherwise, you'll need to build **ccls** from source. You will need:
* GCC 7.2 or higher (`optional,string_view` require libstdc++7 or higher) * GCC 7.2 or higher (`optional,string_view` require libstdc++7 or higher)
* MSVC 2017 or higher (included with VS2017 Build Tools) * MSVC 2017 or higher (included with VS2017 Build Tools)
* On POSIX systems, either GNU make or Ninja (optional on other systems) * On POSIX systems, either GNU make or Ninja (optional on other systems)
* Clang+LLVM headers and libraries * Clang+LLVM headers and libraries, version >= 7 ([0.20181225.8](https://github.com/MaskRay/ccls/releases/tag/0.20181225.8) is the last release that supports clang 6)
The simplest/quickest build with all defaults (only for POSIX systems) is: The simplest/quickest build with all defaults (only for POSIX systems) is:

@ -33,6 +33,8 @@ will show the compiler arguments used to index files.
## Initialization Options ## Initialization Options
Initialization options are defined in [config.hh](https://github.com/MaskRay/ccls/blob/master/src/config.hh).
Each language client may have its own way to specify initialization options. Each language client may have its own way to specify initialization options.
Also, initialization options can be specified on the `ccls` command line using Also, initialization options can be specified on the `ccls` command line using
the [`--init` option](#--initjson). the [`--init` option](#--initjson).

@ -33,20 +33,10 @@ The only required configuration is `ccls-executable`. Others have good defaults.
```elisp ```elisp
(setq ccls-executable "/path/to/ccls/Release/ccls") (setq ccls-executable "/path/to/ccls/Release/ccls")
;; ;; Some Linux distributions have packages that install to /usr/bin/ccls
;; (setq ccls-executable "/usr/bin/ccls")
;; ;; Log file
;; (setq ccls-args '("--log-file=/tmp/ccls.log")) ;; (setq ccls-args '("--log-file=/tmp/ccls.log"))
``` ```
A more flexible way is to leave `ccls-executable` unchanged (default: `ccls`) and create a shell wrapper named `ccls` that is in your `PATH`: You may leave `ccls-executable` unchanged (default: `ccls`) and create a [shell script wrapper](Install#shell-script-wrapper).
```zsh
#!/bin/zsh
#export CCLS_TRACEME=1 # if you want to debug ccls, stop it right after main() is called
#export LD_LIBRARY_PATH=~/llvm/Release/lib # if you link against shared library libLLVM.so, not statically
exec ~/ccls/Release/ccls --log-file=/tmp/ccls.log "$@"
```
Some common settings to lsp-mode lsp-ui and emacs-ccls: Some common settings to lsp-mode lsp-ui and emacs-ccls:
@ -58,11 +48,13 @@ Some common settings to lsp-mode lsp-ui and emacs-ccls:
When `M-x lsp` is invoked, projectile is consulted to locate the project root which determines the associated lsp-mode workspace. When `M-x lsp` is invoked, projectile is consulted to locate the project root which determines the associated lsp-mode workspace.
If your project has subprojects, `(projectile-project-root)` may think files in the subproject belong to the child workspace, which is not desired. `touch .ccls-root` in the root directory to override projectile roots. If your project has subprojects, `(projectile-project-root)` may think files in the subproject belong to the child workspace, which is not desired. `touch .ccls-root` in the root directory to override projectile roots.
Read `lsp-project-whitelist lsp-project-blacklist` if you don't want to start ccls for some paths.
#### flycheck #### flycheck
If you are flycheck user, make sure ` (setq-default flycheck-disabled-checkers '(c/c++-clang c/c++-cppcheck c/c++-gcc))`, otherwise wrong error messages may occur.
flymake is used by default.
To use flycheck, `(setq lsp-prefer-flymake nil)`. You may also need `(setq-default flycheck-disabled-checkers '(c/c++-clang c/c++-cppcheck c/c++-gcc))` to disable other checkers.
![](https://ptpb.pw/5KIc.jpg)
### Diagnostics ### Diagnostics
@ -74,9 +66,9 @@ The buffer `*lsp-ccls stderr*` and `--log-file=/tmp/cq.log` contain logs.
Also refer to [[Debugging]]. Also refer to [[Debugging]].
## [[Initialization options|Project-Setup#InitializationOptions]] ## [[Initialization options|Customization#initialization-options]]
Initialization options are defined in [config.hh](https://github.com/MaskRay/ccls/blob/master/src/config.hh), but you need to customize them in S-exp. You need to customize initialization options in S-exp.
Use `t` for true, `:json-false` for false, `:json-null` for null. Use `t` for true, `:json-false` for false, `:json-null` for null.
```elisp ```elisp
@ -208,10 +200,6 @@ Add `company-lsp` to `company-backends`. ccls has a fuzzy matching algorithm to
![company-lsp + company-quickhelp](https://ptpb.pw/AC6J.jpg) ![company-lsp + company-quickhelp](https://ptpb.pw/AC6J.jpg)
### lsp-ui-flycheck
![](https://ptpb.pw/5KIc.jpg)
### Semantic highlighting ### Semantic highlighting
To enable semantic highlighting: To enable semantic highlighting: