coc-diff
Jelmer VernooijDiff/patch language server support for coc.nvim
A practical first workflow
Use this extension when editing a saved unified diff or patch. It connects coc.nvim to the separate diff-lsp executable. Installing the coc extension alone does not install that server. This workflow checks a patch file; for repository status and changed-line gutters, compare coc-git.
Check the server before the patch
Build or install diff-lsp using its upstream instructions, then run the following inside the editor. If the executable lookup is empty, make the server available on the editor’s PATH or set diff.serverPath to its absolute executable path in coc-settings.json.
| 1 | :echo exepath('diff-lsp') |
| 2 | :CocInstall coc-diff |
Save this as example.patch. The header deliberately claims two old and two new lines while the hunk contains one of each:
| 1 | --- a/example.txt |
| 2 | +++ b/example.txt |
| 3 | @@ -1,2 +1,2 @@ |
| 4 | -before |
| 5 | +after |
Run :CocDiagnostics. A server supporting the documented hunk-count check should report the mismatch. Change the header to @@ -1 +1 @@, save and check that the count diagnostic clears. This exercise does not apply the patch or establish that it applies cleanly to your repository.
If there is no result, check :set filetype? for diff, diff.enable, then the Diff Language Server output through :CocCommand workspace.showOutput. An executable-not-found error is a server installation problem; editing the hunk cannot repair it.
Configuration and server launch verified in coc-diff 0.1.0; diagnostic expectations follow the diff-lsp documentation. The separately installed server determines its available features; this patch check has not been run against every server version.
Site-authored guidance reviewed on 2026-09-11. Content sources and maintainers · Choose extension responsibilities
Published Package Summary
Diff/patch language server support for coc.nvim
- Diff/patch language server support for coc.nvim
- onLanguage:diff
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-diff@0.1.0.
This package does not declare any contributed commands.
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable diff language server"
}Raw JSON Schema
{
"type": "string",
"default": "diff-lsp",
"description": "Path to diff-lsp executable"
}