diff --git a/Getting-started.md b/Getting-started.md index 62b2c56..4fa8bf6 100644 --- a/Getting-started.md +++ b/Getting-started.md @@ -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 -#### [[compile_commands.json]] (Best) +#### [[compile_commands.json]] 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, 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 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: diff --git a/LanguageClient-neovim.md b/LanguageClient-neovim.md index d0a541f..4cdaf1c 100644 --- a/LanguageClient-neovim.md +++ b/LanguageClient-neovim.md @@ -32,7 +32,17 @@ let g:LanguageClient_settingsPath = '/home/YOUR_USERNAME/.config/nvim/settings.j 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 \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. diff --git a/compile_commands.json.md b/compile_commands.json.md index bd35a95..d02a8ba 100644 --- a/compile_commands.json.md +++ b/compile_commands.json.md @@ -23,6 +23,8 @@ bear make # generates compile_commands.json ``` +### [compiledb](https://github.com/nickdiego/compiledb) + ### [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`.