coc-clangd
clangdclangd extension for coc.nvim
Published Package Summary
coc-clangd
This extension connects coc.nvim to the clangd language server.
Quick Start
- install Node.js.
coc.nvimandcoc-clangdrun on Node.js. - install
coc.nvim. Instructions usingvim-plug(check out coc.nvim Wiki other options):- add to
.vimrc:vim Plug 'neoclide/coc.nvim', {'branch': 'release'} - in vim, run
:PlugInstall
- add to
- in vim, run
:CocInstall coc-clangd coc-clangdwill try to findclangdfrom your$PATH, if not found, you can run:CocCommand clangd.installto install the latest release from GitHub- follow Project setup to generate
compile_commands.jsonfor your project
Note: If you've configured
clangdas a languageServer incoc-settings.json, you should remove it to avoid running clangd twice!
Protocol extensions
clangd supports some extensions that are not in the official Language Server Protocol specification.
coc-clangd adds support for:
- Switching between header and implementation file:
:CocCommand clangd.switchSourceHeader- You can open in split buffer by
:CocCommand clangd.switchSourceHeader vsplit
- You can open in split buffer by
- File status monitor, shows on NeoVim statusline
- Describe symbol under the cursor:
:CocCommand clangd.symbolInfo - Completions that adjust text near the cursor (e.g. correcting
.to->)
Configurations
:CocConfig opens your global coc-settings.json. :CocLocalConfig opens local configuration for your project ($PROJECTROOT/.vim/coc-settings.json)
| Configurations | Description | Default |
|---|---|---|
| clangd.enabled | enable coc-clangd | true |
| clangd.arguments | arguments for clangd server | [] |
| clangd.checkUpdates | check for clangd language server updates on startup | false |
| clangd.disableCompletion | disable completion source from clangd | false |
| clangd.disableDiagnostics | disable diagnostics from clangd | false |
| clangd.disableSnippetCompletion | disable completion snippet from clangd | false |
| clangd.disableProgressNotifications | disable indexing progress notifications from clangd | false |
| clangd.compilationDatabasePath | specifies the directory containing the compilation database | '' |
| clangd.compilationDatabaseCandidates | specifies directories that may contain the compilation database, you can use ${workspaceFolder} variables https://code.visualstudio.com/docs/editor/variables-reference | [] |
| clangd.fallbackFlags | extra clang flags used to parse files when no compilation database is found | [] |
| clangd.path | path to clangd executable | clangd |
Note:
Semantic highlighting is disabled by default in coc.nvim, you can enable it with semanticTokens.enable.
License
Apache 2.0 with LLVM Exception
This is the standard LLVM license.
This extension is built with create-coc-extension
- clangd extension for coc.nvim
- onLanguage:c
- onLanguage:cpp
- onLanguage:cuda
- onLanguage:objc
- onLanguage:objcpp
- onLanguage:opencl
- onLanguage:objective-c
- onLanguage:objective-cpp
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for coc-clangd@0.33.0.
| Command (:CocCommand) | Description |
|---|---|
| clangd.ast | Show AST |
| clangd.switchSourceHeader | Switch between source/header |
| clangd.symbolInfo | Resolve symbol info under the cursor |
| clangd.memoryUsage | Show memory usage |
| clangd.projectConfig | Open project configuration file |
| clangd.userConfig | Open user configuration file |
| clangd.install | Install latest clangd language server binary release |
| clangd.update | Check for updates to clangd language server |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "string",
"default": "",
"description": "The path to clangd executable, e.g.: /usr/bin/clangd"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable coc-clangd extension"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Arguments for clangd server"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Names a file that clangd should log a performance trace to, in chrome trace-viewer JSON format, can be loaded in `chrome://tracing`."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Check for clangd language server updates on startup."
}Raw JSON Schema
{
"enum": [
"off",
"messages",
"verbose"
],
"type": "string",
"default": "off",
"description": "Trace requests to clangd"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Extra clang flags used to parse files when no compilation database is found."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Disable completion source from clangd"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Disable fileStatus from clangd"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Disable diagnostics from clangd"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Specifies the directory containing the compilation database"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Disable completion snippet from clangd"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Show notifications while DB files changed"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Disable indexing progress notifications from clangd"
}Raw JSON Schema
{
"type": "array",
"default": [],
"description": "Specifies the directories that may contain a compilation database"
}