3 This extension connects [coc.nvim][] to the [clangd][] language server.
7 1. install [Node.js][]. `coc.nvim` and `coc-clangd` run on Node.js.
8 1. install `coc.nvim`. Instructions using `vim-plug` (check out [coc.nvim Wiki][] other options):
9 - add to `.vimrc`: `vim Plug 'neoclide/coc.nvim', {'branch': 'release'}`
10 - in vim, run `:PlugInstall`
11 1. in vim, run `:CocInstall coc-clangd`
12 1. `coc-clangd` will try to find `clangd` from your `$PATH`, if not found, you can run `:CocCommand clangd.install` to install the [latest release][] from GitHub
13 1. follow [Project setup][] to generate `compile_commands.json` for your project
15 > **Note**: If you've configured `clangd` as a languageServer in `coc-settings.json`, you should remove it to avoid running clangd twice!
17 ## Protocol extensions
19 `clangd` supports some [extensions][] that are not in the official [Language Server Protocol specification][lsp].
21 `coc-clangd` adds support for:
23 - Switching between header and implementation file: `:CocCommand clangd.switchSourceHeader`
24 - File status monitor, shows on NeoVim statusline
25 - Describe symbol under the cursor: `:CocCommand clangd.symbolInfo`
26 - Completions that adjust text near the cursor (e.g. correcting `.` to `->`)
30 `:CocConfig` opens your global `coc-settings.json`, or `:CocLocalConfig` opens local configuration in your project `.vim/coc-settings.json`.
32 | Configurations | Description | Default |
34 | clangd.enabled | enable `coc-clangd` | `true` |
35 | clangd.arguments | arguments for `clangd` server | `[]` |
36 | clangd.checkUpdates | check for clangd language server updates on startup | `false` |
37 | clangd.disableCompletion | disable completion source from clangd | `false` |
38 | clangd.disableDiagnostics | disable diagnostics from clangd | `false` |
39 | clangd.disableSnippetCompletion | disable completion snippet from clangd | `false` |
40 | clangd.compilationDatabasePath | specifies the directory containing the compilation database | `''` |
41 | clangd.fallbackFlags | extra clang flags used to parse files when no compilation database is found | `[]` |
42 | clangd.path | path to `clangd` executable | `clangd` |
43 | clangd.semanticHighlighting | enable semantic highlighting, requires [jackguo380/vim-lsp-cxx-highlight](https://github.com/jackguo380/vim-lsp-cxx-highlight) to work | `false` |
44 | clangd.serverCompletionRanking | always rank compilation items on the server as you type | `true` |
48 - `clangd.switchSourceHeader`: switch between source/header files
49 - `clangd.symbolInfo`: resolve symbol info under the cursor
50 - `clangd.install`: install latest clangd release from GitHub
51 - `clangd.update`: check for updates to clangd from GitHub
55 Apache 2.0 with LLVM Exception
57 This is the [standard LLVM license](https://llvm.org/foundation/relicensing/).
61 > This extension is created by [create-coc-extension](https://github.com/fannheyward/create-coc-extension)
63 [node.js]: https://nodejs.org/en/
64 [clangd]: https://clangd.llvm.org/installation.html
65 [coc.nvim]: https://github.com/neoclide/coc.nvim
66 [coc.nvim wiki]: https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim
67 [lsp]: https://microsoft.github.io/language-server-protocol/specification
68 [extensions]: https://clangd.llvm.org/extensions.html
69 [latest release]: https://github.com/clangd/clangd/releases
70 [project setup]: https://clangd.llvm.org/installation.html#project-setup