coc-git 2.7.6 → 2.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,60 @@
1
+ # AGENTS.md
2
+
3
+ ## Repository purpose
4
+
5
+ `coc-git` is the Git integration extension for `coc.nvim`. Its runtime entry point is `src/index.ts`; the published entry point is the bundled `lib/index.js`. The extension owns Git-backed buffer state, gutters and blame text, conflict actions, Coc lists, GitHub/GitLab issue completion, and the commands/keymaps declared in `package.json`.
6
+
7
+ ## Code map
8
+
9
+ - `src/index.ts` is the activation and registration layer. Register new Coc commands, `<Plug>` keymaps, lists, completion providers, and disposables here.
10
+ - `src/manager.ts` coordinates editor events, live `GitBuffer` instances, configuration, and user-facing operations.
11
+ - `src/model/git.ts` is the low-level child-process wrapper around the configured Git executable.
12
+ - `src/model/repo.ts` implements repository-scoped Git operations; put Git command construction and output parsing there rather than in the activation layer.
13
+ - `src/model/resolver.ts` resolves documents and working directories to repositories and relative paths.
14
+ - `src/model/buffer.ts` owns per-buffer diffs, signs, blame, folds, and conflict state.
15
+ - `src/model/service.ts` owns resolver/repository lifetimes and constructs `GitBuffer` instances.
16
+ - `src/lists/` contains Coc list implementations (`gstatus`, `gfiles`, `gchanges`, `gchunks`, `branches`, `commits`, and `bcommits`). List-specific actions and rendering belong in the corresponding list class.
17
+ - `src/source.ts` implements GitHub/GitLab issue loading plus the `issues` list/completion source.
18
+ - `src/types.ts` is the shared contract for diffs, conflicts, and the configuration object passed into buffer/model code.
19
+ - `package.json` is also the Coc extension manifest: command names, activation, and all user-visible configuration schemas live there.
20
+ - `Readme.md` documents the public commands, keymaps, lists, environment variables, and settings.
21
+
22
+ ## Public-contract synchronization
23
+
24
+ When changing a user-facing feature, update every surface that represents the same contract:
25
+
26
+ - A new `git.*` command needs a `commands.registerCommand` registration in `src/index.ts` and an entry under `contributes.commands` in `package.json`. Add it to `Readme.md` when it is intended for direct use.
27
+ - A new `<Plug>(coc-git-...)` mapping needs a `workspace.registerKeymap` registration in `src/index.ts` and matching usage documentation in `Readme.md`.
28
+ - A new `git.*` setting needs a schema entry under `contributes.configuration.properties` in `package.json`, a typed field in `src/types.ts` when consumed beyond the registration layer, and loading/default logic in `DocumentManager.loadConfiguration()` in `src/manager.ts`. Keep defaults identical across those locations and `Readme.md`.
29
+ - A new list must be implemented under `src/lists/`, registered through `listManager` in `src/index.ts`, and added to the documented list names.
30
+ - Preserve the exported `ExtensionApi` shape in `src/index.ts` unless the API change is intentional; other Coc extensions can consume `git`, `resolver`, and `manager` from activation.
31
+
32
+ ## Git and editor behavior
33
+
34
+ - Use the configured executable discovered from `git.command`; do not hard-code an executable path. Model-layer Git execution should flow through `Git`, `GitRepo`, or the existing command helpers.
35
+ - Keep Git work asynchronous. Do not introduce synchronous child-process calls into buffer refresh, cursor movement, completion, or list loading paths.
36
+ - Pass arguments as arrays to `Git.exec`, `Git.stream`, or `spawnCommand` when filenames or revisions are involved. The repository already supports paths containing spaces; avoid building an unescaped shell string unless the operation specifically requires an interactive terminal command.
37
+ - Preserve cancellation and disposal behavior around spawned processes and Coc event listeners. Anything registered during activation or manager construction must be owned by the existing `subscriptions`/`disposables` lifecycle.
38
+ - Buffer refreshes are event-driven (`TextChange`, writes when realtime gutters are disabled, `FocusGained`, and `BufEnter`). Changes to diff or blame behavior must account for stale async results and for buffers disposed while repository resolution is still running.
39
+ - Keep Vim and Neovim compatibility. Virtual text, floating windows, namespaces, terminal operations, and popup behavior must retain the existing capability checks or Coc abstractions; do not use a Neovim-only API on an unconditional path.
40
+ - Git output is normalized under `LC_ALL`/`LANG=en_US.UTF-8` and decoded through `iconv-lite`. Parsing code must not depend on the user's localized Git messages.
41
+ - GitHub issue access uses `GITHUB_API_TOKEN`; GitLab access uses `GITLAB_PRIVATE_TOKEN` and `git.gitlab.hosts`. Do not log tokens or put them into rendered list/completion items.
42
+
43
+ ## Generated output and dependencies
44
+
45
+ - Do not edit or commit `lib/index.js`; `lib/` is generated and ignored. Change TypeScript under `src/` and rebuild it with `npm run build`.
46
+ - `esbuild.js` must continue to bundle `src/index.ts` for Node while leaving `coc.nvim` external. The bundle target is `node10.12`; avoid emitting runtime syntax or APIs that violate that target unless the target is deliberately raised.
47
+ - Use npm for dependency and lockfile changes. CI installs with `npm ci`, so `package.json` and `package-lock.json` must stay synchronized.
48
+ - `npm run lint` is TypeScript checking (`tsc -p tsconfig.json`), not an ESLint formatting pass. The project enables `noUnusedLocals` and emits nothing during this check.
49
+
50
+ ## Verification
51
+
52
+ Run checks according to the affected subsystem:
53
+
54
+ - Type/config/registration changes: `npm run lint` and `npm run build`.
55
+ - Git parsing, repository, buffer, manager, list, source, command, or keymap behavior: `npm test`.
56
+ - Vim-specific behavior: `npm run test:integration:vim`.
57
+ - Neovim-specific behavior: `npm run test:integration:nvim`.
58
+ - Changes intended to pass CI must succeed in both editor variants. The GitHub Actions matrix uses Node 22 and runs typechecking plus the Vim and Neovim integration suites.
59
+
60
+ For manual editor verification, load the rebuilt extension through Coc and exercise the exact public surface changed: the relevant `:CocCommand git.*`, `<Plug>(coc-git-*)` mapping, `:CocList` list, gutter/blame update, conflict action, or issue completion flow. Use a temporary Git repository containing the required staged, unstaged, untracked, renamed, conflicted, or non-UTF-8-path state rather than testing against this checkout's working tree.
package/Readme.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # coc-git
2
2
 
3
+ [![CI](https://github.com/neoclide/coc-git/actions/workflows/ci.yaml/badge.svg)](https://github.com/neoclide/coc-git/actions/workflows/ci.yaml)
4
+
3
5
  Git integration of [coc.nvim](https://github.com/neoclide/coc.nvim).
4
6
 
5
7
  **Note:** many useful features not implemented, it's recommended to
@@ -27,7 +29,7 @@ In your vim/neovim, run command:
27
29
  - Git status of current project, by `g:coc_git_status`.
28
30
  - Git status of current buffer, by`b:coc_git_status`.
29
31
  - Git status of current line, by`b:coc_git_blame` for statusline, and `addGBlameToVirtualText` for inline blames.
30
- - Git related lists, including `issues`, `gfiles`, `gstatus`, `commits`, `branches` & `bcommits`
32
+ - Git related lists, including `issues`, `gfiles`, `gstatus`, `gchanges`, `gchunks`, `commits`, `branches` & `bcommits`
31
33
  - Keymaps for git chunks, including `<Plug>(coc-git-chunkinfo)` `<Plug>(coc-git-nextchunk)` & `<Plug>(coc-git-prevchunk)` ,
32
34
  - Commands for chunks, including `git.chunkInfo` `git.chunkStage` `git.chunkUndo` and more.
33
35
  - Keymaps & commands for git conflicts.
@@ -60,14 +62,20 @@ In your vim/neovim, run command:
60
62
 
61
63
  - `git.urlFix`: a object to configure the url style of copyUrl and browserOpen, make this two command support other git services like gitlab and gitea. default: `{}`
62
64
 
65
+ - `git.diffRevision`: Revision used as the gutter diff base, default: `""` (the current index).
66
+
63
67
  - `git.issueFormat`: Formatting string for issue completion. Supported interpolation variables: %i - issue id. %r - repository name. %o - organization/owner name. %t - issue title. %b - issue body. %c - issue created at. %a - issue author. %u - issue url., default: `"#%i"`
64
68
 
65
69
  - `git.virtualTextPrefix`: Prefix of git blame infomation to virtual text, require virtual text feature of neovim., default: `" "`
66
70
 
71
+ - `git.blameFormat`: Format of git blame virtual text. Supported placeholders: `%a` author, `%t` time, `%s` summary, `%S` short sha, `%%` literal percent., default: `"(%a %t) %s"`
72
+
67
73
  - `git.addGBlameToVirtualText`: Add git blame information to virtual text, require virtual text feature of neovim., default: `false`
68
74
 
69
75
  - `git.addGBlameToBufferVar`: Add git blame information to b:coc_git_blame., default: `false`
70
76
 
77
+ - `git.blameUseRealTime`: Use an absolute local timestamp in blame information, default: `false`.
78
+
71
79
  - `git.branchCharacter`: Branch character used with g:coc_git_status, default: `""`
72
80
 
73
81
  - `git.changedDecorator`: Git changed decorator used with g:coc_git_status, default: `"*"`
@@ -86,6 +94,8 @@ In your vim/neovim, run command:
86
94
 
87
95
  - `git.signPriority`: Priority of sign gutters, default to `10`.
88
96
 
97
+ - `git.pushArguments`: Additional arguments passed to `git push`, default: `[]`.
98
+
89
99
  - `git.changedSign.text`: Text of changed sign., default: `"~"`
90
100
 
91
101
  - `git.changedSign.hlGroup`: Highlight group for changed sign., default: `"DiffChange"`
@@ -114,7 +124,7 @@ In your vim/neovim, run command:
114
124
 
115
125
  - `git.showCommitInFloating`: Show commit in floating or popup window, default: `false`
116
126
 
117
- - `git.floatConfig`: Configure style of float window/popup, extends from floatFactory.floatConfig
127
+ - `git.floatConfig`: Configure style of float window/popup, extends from floatFactory.floatConfig, default: `{}`.
118
128
 
119
129
  - `git.gitlab.hosts`: Custom GitLab hosts, default: `["gitlab.com"]`
120
130
 
@@ -124,6 +134,20 @@ In your vim/neovim, run command:
124
134
 
125
135
  - `git.conflict.incoming.hlGroup`: Highlight group for the incoming version of a merge conflict., default: `"DiffAdd"`
126
136
 
137
+ - `git.conflict.common.hlGroup`: Highlight group for diff3 common-ancestor sections, default: `"DiffText"`.
138
+
139
+ - `git.gstatus.saveBeforeOpen`: Save open buffers before loading the `gstatus` list, default: `false`.
140
+
141
+ - `coc.source.issues.enable`: Enable issue completion, default: `true`.
142
+
143
+ - `coc.source.issues.triggerCharacters`: Trigger characters for issue completion, default: `["#"]`.
144
+
145
+ - `coc.source.issues.priority`: Issue completion priority, default: `99`.
146
+
147
+ - `coc.source.issues.shortcut`: Issue completion menu shortcut, default: `"[I]"`.
148
+
149
+ - `coc.source.issues.filetypes`: Filetypes where issue completion is active, default: `["gitcommit", "gina-commit"]`.
150
+
127
151
  more information, see [package.json](https://github.com/neoclide/coc-git/blob/master/package.json)
128
152
 
129
153
  **Note** for user from [vim-gitgutter](https://github.com/airblade/vim-gitgutter),
@@ -202,10 +226,16 @@ nmap ]g <Plug>(coc-git-nextchunk)
202
226
  " navigate conflicts of current buffer
203
227
  nmap [c <Plug>(coc-git-prevconflict)
204
228
  nmap ]c <Plug>(coc-git-nextconflict)
229
+ " resolve the conflict under the cursor
230
+ nmap <leader>cc <Plug>(coc-git-keepcurrent)
231
+ nmap <leader>ci <Plug>(coc-git-keepincoming)
232
+ nmap <leader>cb <Plug>(coc-git-keepboth)
205
233
  " show chunk diff at current position
206
234
  nmap gs <Plug>(coc-git-chunkinfo)
207
235
  " show commit contains current position
208
236
  nmap gc <Plug>(coc-git-commit)
237
+ " show blame details for the current line
238
+ nmap gb <Plug>(coc-git-showblamedoc)
209
239
  " create text object for git chunks
210
240
  omap ig <Plug>(coc-git-chunk-inner)
211
241
  xmap ig <Plug>(coc-git-chunk-inner)
@@ -219,14 +249,21 @@ Use command `:CocCommand` to open commands and type `git.` to get all git
219
249
  related commands.
220
250
 
221
251
  - `:CocCommand git.copyUrl` Copy url of current line to clipboard.
252
+ - `:CocCommand git.copyPermalink` Copy a permalink for the current line to clipboard.
253
+ - `:CocCommand git.refresh` Refresh Git information for all buffers.
222
254
  - `:CocCommand git.nextChunk` Navigate to the next chunk.
223
255
  - `:CocCommand git.prevChunk` Navigate to the previous chunk.
224
256
  - `:CocCommand git.chunkInfo` Show chunk info under cursor.
257
+ - `:CocCommand git.allChunkInfo` Return all changed chunks in the current buffer.
258
+ - `:CocCommand git.keepCurrent` Keep the current part of the conflict under the cursor.
259
+ - `:CocCommand git.keepIncoming` Keep the incoming part of the conflict under the cursor.
260
+ - `:CocCommand git.keepBoth` Keep both parts of the conflict under the cursor.
225
261
  - `:CocCommand git.chunkUndo` Undo current chunk.
226
262
  - `:CocCommand git.chunkStage` Stage current chunk.
227
263
  - `:CocCommand git.chunkUnstage` Unstage chunk that contains current line.
228
264
  - `:CocCommand git.diffCached` Show cached diff in preview window.
229
265
  - `:CocCommand git.showCommit` Show commit of current chunk.
266
+ - `:CocCommand git.showBlameDoc` Show blame details for the current line.
230
267
  - `:CocCommand git.browserOpen` Open current line in browser
231
268
  - `:CocCommand git.foldUnchanged` Fold unchanged lines of current buffer.
232
269
  - `:CocCommand git.toggleGutters` Toggle git gutters in sign column.
package/history.md ADDED
@@ -0,0 +1,12 @@
1
+ ## 2.7.8
2
+
3
+ - use node24 for CI (eacd2a2)
4
+ - fix uuid, use commonjs version (8ab1a44)
5
+ - fix: narrow vim call results (b72ad90)
6
+ - fix package.json (45b1873)
7
+ - add release.yml (3e68338)
8
+ - fix: address audit findings (e767896)
9
+ - feat: add git.allChunkInfo command for all chunk info (fixes #204) (43469d2)
10
+ - feat: support configurable git blame format (fixes #127) (31e369b)
11
+ - chore: add coc-test integration tests and upgrade toolchain (b10f485)
12
+ - fix: correct warning message typo (PR #222) (f66c361)