.

Fangrui Song 2018-10-14 12:24:21 -07:00
parent 3cdf79b663
commit e0dd026b5b
3 changed files with 20 additions and 2 deletions

@ -52,7 +52,7 @@ If you use other editors not listed there (LSP decouples servers and clients, so
If your project has subprojects (e.g. separate repos), some setup in your editor is needed for proper root detection: https://github.com/MaskRay/ccls/wiki/FAQ#project-root-detection If your project has subprojects (e.g. separate repos), some setup in your editor is needed for proper root detection: https://github.com/MaskRay/ccls/wiki/FAQ#project-root-detection
#### [[compile_commands.json]] (Best) #### [[compile_commands.json]]
Remember to copy/symlink it to the project root. Remember to copy/symlink it to the project root.
@ -82,6 +82,12 @@ Note:
`.ccls` does not do *word splitting* or *command substitution* for you, `.ccls` does not do *word splitting* or *command substitution* for you,
you cannot use space-separated arguments like `%cpp -std=gnu++14 -pthread` you cannot use space-separated arguments like `%cpp -std=gnu++14 -pthread`
#### No `.ccls` or `compile_commands.json`
If neither file exists, ccls assumes there is an imaginary `.ccls` with one line: `%clang`.
This is convenient for trying out a one-file project. `git init` to let the language client know it is a project, e.g. `cd /tmp; mkdir c; cd c; git init; touch a.cc`
### Windows ### Windows
If your project is compiled with MSVC, you may change the compiler driver (`%clang` above) to `clang-cl`, and use the initialization option `clang.extraArgs` to pass three options: If your project is compiled with MSVC, you may change the compiler driver (`%clang` above) to `clang-cl`, and use the initialization option `clang.extraArgs` to pass three options:

@ -32,7 +32,17 @@ let g:LanguageClient_settingsPath = '/home/YOUR_USERNAME/.config/nvim/settings.j
let g:LanguageClient_hasSnippetSupport = 0 let g:LanguageClient_hasSnippetSupport = 0
``` ```
Make sure you have `.ccls` or [[compile_commands.json]] in your project root. Open a file in the project, run `:LanguageClientStart`. First example:
```zsh
cd /tmp; mkdir c; cd c
git init # let LanguageClient-neovim know this is a project
echo '#include <stddef.h>\nint main() {}' > a.cc
nvim a.cc
# :LanguageClientStart
```
For a larger project, you'll need [[.ccls|Getting-started#ccls]] or [[compile_commands.json]] in your project root.
These features will work out-of-the-box. These features will work out-of-the-box.

@ -23,6 +23,8 @@ bear make
# generates compile_commands.json # generates compile_commands.json
``` ```
### [compiledb](https://github.com/nickdiego/compiledb)
### [scan-build](https://github.com/rizsotto/scan-build) ### [scan-build](https://github.com/rizsotto/scan-build)
scan-build is a python package that can generate a compilation database for clang tooling (uses Bear as a backend). This too can be used for any project based on a `Makefile`. scan-build is a python package that can generate a compilation database for clang tooling (uses Bear as a backend). This too can be used for any project based on a `Makefile`.