coc-git 2.7.3 → 2.7.5
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/Readme.md +1 -1
- package/lib/index.js +38 -31
- package/package.json +7 -1
package/Readme.md
CHANGED
|
@@ -30,7 +30,7 @@ In your vim/neovim, run command:
|
|
|
30
30
|
- Git related lists, including `issues`, `gfiles`, `gstatus`, `commits`, `branches` & `bcommits`
|
|
31
31
|
- Keymaps for git chunks, including `<Plug>(coc-git-chunkinfo)` `<Plug>(coc-git-nextchunk)` & `<Plug>(coc-git-prevchunk)` ,
|
|
32
32
|
- Commands for chunks, including `git.chunkInfo` `git.chunkStage` `git.chunkUndo` and more.
|
|
33
|
-
- Keymaps for git conflicts
|
|
33
|
+
- Keymaps & commands for git conflicts.
|
|
34
34
|
- Completion support for semantic commit.
|
|
35
35
|
- Completion support for GitHub/GitLab issues.
|
|
36
36
|
|
package/lib/index.js
CHANGED
|
@@ -5853,7 +5853,8 @@ var DocumentManager = class {
|
|
|
5853
5853
|
conflict: {
|
|
5854
5854
|
enabled: config.get("conflict.enabled", true),
|
|
5855
5855
|
currentHlGroup: config.get("conflict.current.hlGroup", "DiffChange"),
|
|
5856
|
-
incomingHlGroup: config.get("conflict.incoming.hlGroup", "DiffAdd")
|
|
5856
|
+
incomingHlGroup: config.get("conflict.incoming.hlGroup", "DiffAdd"),
|
|
5857
|
+
commonHlGroup: config.get("conflict.common.hlGroup", "DiffText")
|
|
5857
5858
|
},
|
|
5858
5859
|
floatConfig: config.get("floatConfig", {}),
|
|
5859
5860
|
gstatus: {
|
|
@@ -6442,7 +6443,9 @@ var Git = class {
|
|
|
6442
6443
|
LC_ALL: "en_US.UTF-8",
|
|
6443
6444
|
LANG: "en_US.UTF-8"
|
|
6444
6445
|
});
|
|
6445
|
-
|
|
6446
|
+
if (process.platform === "win32") {
|
|
6447
|
+
options.shell = true;
|
|
6448
|
+
}
|
|
6446
6449
|
if (options.log !== false) {
|
|
6447
6450
|
this.log(`> git ${args.join(" ")}
|
|
6448
6451
|
`);
|
|
@@ -6682,6 +6685,11 @@ register("zh_CN", zh_CN_default);
|
|
|
6682
6685
|
// src/model/buffer.ts
|
|
6683
6686
|
var import_url = require("url");
|
|
6684
6687
|
var signGroup = "CocGit";
|
|
6688
|
+
var revPattern = "([0-9A-Za-z_.:/-]+)";
|
|
6689
|
+
var startPattern = new RegExp(`^<{7} (${revPattern})(:? .+)?$`);
|
|
6690
|
+
var sepPattern = new RegExp(`^={7}$`);
|
|
6691
|
+
var endPattern = new RegExp(`^>{7} (${revPattern})(:? .+)?$`);
|
|
6692
|
+
var commonPattern = /^\|{7}\smerged\scommon\sancestors/;
|
|
6685
6693
|
var GitBuffer = class {
|
|
6686
6694
|
constructor(doc, config, relpath, repo, git, channel, floatFactory) {
|
|
6687
6695
|
this.doc = doc;
|
|
@@ -7167,15 +7175,19 @@ var GitBuffer = class {
|
|
|
7167
7175
|
if (conflict.start <= line && conflict.end >= line) {
|
|
7168
7176
|
switch (part) {
|
|
7169
7177
|
case 0 /* Current */:
|
|
7170
|
-
|
|
7171
|
-
|
|
7178
|
+
let start = conflict.common ? conflict.common : conflict.sep;
|
|
7179
|
+
await nvim.command(`${start},${conflict.end}d | ${conflict.start}d`);
|
|
7180
|
+
return;
|
|
7172
7181
|
case 1 /* Incoming */:
|
|
7173
|
-
await nvim.command(`${conflict.end}d`);
|
|
7174
|
-
return
|
|
7182
|
+
await nvim.command(`${conflict.end}d | ${conflict.start},${conflict.sep}d`);
|
|
7183
|
+
return;
|
|
7175
7184
|
case 2 /* Both */:
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7185
|
+
if (conflict.common) {
|
|
7186
|
+
await nvim.command(`${conflict.end}d | ${conflict.common},${conflict.sep}d | ${conflict.start}d`);
|
|
7187
|
+
} else {
|
|
7188
|
+
await nvim.command(`${conflict.end}d | ${conflict.sep}d | ${conflict.start}d`);
|
|
7189
|
+
}
|
|
7190
|
+
return;
|
|
7179
7191
|
}
|
|
7180
7192
|
}
|
|
7181
7193
|
}
|
|
@@ -7347,8 +7359,6 @@ var GitBuffer = class {
|
|
|
7347
7359
|
nvim.call("setpos", [".", cursor], true);
|
|
7348
7360
|
await nvim.resumeNotification();
|
|
7349
7361
|
} else {
|
|
7350
|
-
console.log(33);
|
|
7351
|
-
console.log(ranges);
|
|
7352
7362
|
this.foldEnabled = true;
|
|
7353
7363
|
let [foldmethod, foldenable, foldlevel] = await nvim.eval("[&foldmethod,&foldenable,&foldlevel]");
|
|
7354
7364
|
this.foldSettings = {
|
|
@@ -7381,11 +7391,7 @@ var GitBuffer = class {
|
|
|
7381
7391
|
}
|
|
7382
7392
|
async parseConflicts() {
|
|
7383
7393
|
if (!this.hasConflicts || !this.config.conflict.enabled) return;
|
|
7384
|
-
const lines = this.doc.
|
|
7385
|
-
const revPattern = "([0-9A-Za-z_.:/-]+)";
|
|
7386
|
-
const startPattern = new RegExp(`^<{7} (${revPattern})(:? .+)?$`);
|
|
7387
|
-
const sepPattern = new RegExp(`^={7}$`);
|
|
7388
|
-
const endPattern = new RegExp(`^>{7} (${revPattern})(:? .+)?$`);
|
|
7394
|
+
const lines = this.doc.textDocument.lines;
|
|
7389
7395
|
let conflicts = [];
|
|
7390
7396
|
let conflict = null;
|
|
7391
7397
|
let state = 0 /* Initial */;
|
|
@@ -7406,11 +7412,12 @@ var GitBuffer = class {
|
|
|
7406
7412
|
}
|
|
7407
7413
|
break;
|
|
7408
7414
|
}
|
|
7415
|
+
case 2 /* MatchedCommon */:
|
|
7409
7416
|
case 1 /* MatchedStart */: {
|
|
7410
|
-
|
|
7417
|
+
let match = line.match(sepPattern);
|
|
7411
7418
|
if (match) {
|
|
7412
7419
|
conflict.sep = index + 1;
|
|
7413
|
-
state =
|
|
7420
|
+
state = 3 /* MatchedSep */;
|
|
7414
7421
|
} else {
|
|
7415
7422
|
const startMatch = line.match(startPattern);
|
|
7416
7423
|
if (startMatch) {
|
|
@@ -7419,11 +7426,14 @@ var GitBuffer = class {
|
|
|
7419
7426
|
} else if (line.match(endPattern)) {
|
|
7420
7427
|
conflict = null;
|
|
7421
7428
|
state = 0 /* Initial */;
|
|
7429
|
+
} else if (line.match(commonPattern)) {
|
|
7430
|
+
conflict.common = index + 1;
|
|
7431
|
+
state = 2 /* MatchedCommon */;
|
|
7422
7432
|
}
|
|
7423
7433
|
}
|
|
7424
7434
|
break;
|
|
7425
7435
|
}
|
|
7426
|
-
case
|
|
7436
|
+
case 3 /* MatchedSep */: {
|
|
7427
7437
|
const match = line.match(endPattern);
|
|
7428
7438
|
if (match) {
|
|
7429
7439
|
conflict.end = index + 1;
|
|
@@ -7455,23 +7465,20 @@ var GitBuffer = class {
|
|
|
7455
7465
|
let buffer = this.doc.buffer;
|
|
7456
7466
|
let currentHlGroup = this.config.conflict.currentHlGroup;
|
|
7457
7467
|
let incomingHlGroup = this.config.conflict.incomingHlGroup;
|
|
7468
|
+
let commonHlGroup = this.config.conflict.commonHlGroup;
|
|
7458
7469
|
let { nvim } = import_coc13.workspace;
|
|
7459
7470
|
nvim.pauseNotification();
|
|
7460
7471
|
buffer.clearNamespace(this.config.conflictSrcId, 0, -1);
|
|
7461
7472
|
const srcId = this.config.conflictSrcId;
|
|
7462
7473
|
conflicts.map((conflict) => {
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
buffer.addHighlight({ hlGroup: currentHlGroup, line, srcId });
|
|
7472
|
-
}
|
|
7473
|
-
for (let line = conflict.end - 1; line >= conflict.sep; line--) {
|
|
7474
|
-
buffer.addHighlight({ hlGroup: incomingHlGroup, line, srcId });
|
|
7474
|
+
let currEnd = conflict.common ? conflict.common - 1 : conflict.sep - 1;
|
|
7475
|
+
let currRange = import_coc13.Range.create(import_coc13.Position.create(conflict.start - 1, 0), import_coc13.Position.create(currEnd, 0));
|
|
7476
|
+
let incomingRange = import_coc13.Range.create(import_coc13.Position.create(conflict.sep, 0), import_coc13.Position.create(conflict.end, 0));
|
|
7477
|
+
buffer.highlightRanges(srcId, currentHlGroup, [currRange]);
|
|
7478
|
+
buffer.highlightRanges(srcId, incomingHlGroup, [incomingRange]);
|
|
7479
|
+
if (conflict.common) {
|
|
7480
|
+
let range = import_coc13.Range.create(import_coc13.Position.create(conflict.common - 1, 0), import_coc13.Position.create(conflict.sep - 1, 0));
|
|
7481
|
+
buffer.highlightRanges(srcId, commonHlGroup, [range]);
|
|
7475
7482
|
}
|
|
7476
7483
|
});
|
|
7477
7484
|
nvim.resumeNotification(false, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-git",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"description": "Git extension for coc.nvim",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"publisher": "chemzqm",
|
|
@@ -430,6 +430,12 @@
|
|
|
430
430
|
"scope": "application",
|
|
431
431
|
"description": "Highlight group for the incoming version of a merge conflict."
|
|
432
432
|
},
|
|
433
|
+
"git.conflict.common.hlGroup": {
|
|
434
|
+
"type": "string",
|
|
435
|
+
"default": "DiffText",
|
|
436
|
+
"scope": "application",
|
|
437
|
+
"description": "Highlight group for the merged common ancestors highlight group."
|
|
438
|
+
},
|
|
433
439
|
"git.gstatus.saveBeforeOpen": {
|
|
434
440
|
"type": "boolean",
|
|
435
441
|
"default": "false",
|