coc-git 2.4.5 → 2.4.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/lib/index.js +31 -27
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -4862,7 +4862,6 @@ var Bcommits = class extends import_coc2.BasicList {
|
|
|
4862
4862
|
this.name = "bcommits";
|
|
4863
4863
|
this.description = "Commits of current file.";
|
|
4864
4864
|
this.defaultAction = "show";
|
|
4865
|
-
this.actions = [];
|
|
4866
4865
|
this.addAction("preview", async (item, context) => {
|
|
4867
4866
|
let {commit, root} = item.data;
|
|
4868
4867
|
let lines = [];
|
|
@@ -4877,18 +4876,20 @@ var Bcommits = class extends import_coc2.BasicList {
|
|
|
4877
4876
|
bufname: commit ? `[commit ${commit}]` : ""
|
|
4878
4877
|
}, context);
|
|
4879
4878
|
});
|
|
4880
|
-
this.addAction("show", async (item) => {
|
|
4879
|
+
this.addAction("show", async (item, ctx) => {
|
|
4881
4880
|
let {commit, root} = item.data;
|
|
4882
4881
|
if (!commit)
|
|
4883
4882
|
return;
|
|
4884
4883
|
let hasFugitive = await nvim.getVar("loaded_fugitive");
|
|
4885
4884
|
if (hasFugitive) {
|
|
4886
|
-
|
|
4885
|
+
let cmd = ctx.options.position === "tab" ? "Gtabedit" : "Gedit";
|
|
4886
|
+
await nvim.command(`${cmd} ${commit}`);
|
|
4887
4887
|
} else {
|
|
4888
|
+
let cmd = ctx.options.position === "tab" ? "tabe" : "edit";
|
|
4888
4889
|
let content = await import_coc2.runCommand(`git --no-pager show ${commit}`, {cwd: root});
|
|
4889
4890
|
let lines = content.trim().split("\n");
|
|
4890
4891
|
nvim.pauseNotification();
|
|
4891
|
-
nvim.command(
|
|
4892
|
+
nvim.command(`${cmd} +setl\\ buftype=nofile [commit ${commit}]`, true);
|
|
4892
4893
|
nvim.command("setl foldmethod=syntax nobuflisted bufhidden=wipe", true);
|
|
4893
4894
|
nvim.command("setf git", true);
|
|
4894
4895
|
nvim.call("append", [0, lines], true);
|
|
@@ -4896,7 +4897,7 @@ var Bcommits = class extends import_coc2.BasicList {
|
|
|
4896
4897
|
nvim.command(`exe 1`, true);
|
|
4897
4898
|
await nvim.resumeNotification();
|
|
4898
4899
|
}
|
|
4899
|
-
});
|
|
4900
|
+
}, {tabPersist: true});
|
|
4900
4901
|
this.addAction("view", async (item, context) => {
|
|
4901
4902
|
let {commit, root, file} = item.data;
|
|
4902
4903
|
let {window: window9, listWindow} = context;
|
|
@@ -5129,7 +5130,6 @@ var Commits = class extends import_coc4.BasicList {
|
|
|
5129
5130
|
this.name = "commits";
|
|
5130
5131
|
this.description = "Commits of current project.";
|
|
5131
5132
|
this.defaultAction = "show";
|
|
5132
|
-
this.actions = [];
|
|
5133
5133
|
this.cachedCommits = new Map();
|
|
5134
5134
|
this.addAction("preview", async (item, context) => {
|
|
5135
5135
|
let {commit, root} = item.data;
|
|
@@ -5151,13 +5151,14 @@ var Commits = class extends import_coc4.BasicList {
|
|
|
5151
5151
|
bufname: commit ? `[commit ${commit}]` : ""
|
|
5152
5152
|
}, context);
|
|
5153
5153
|
});
|
|
5154
|
-
this.addAction("show", async (item) => {
|
|
5154
|
+
this.addAction("show", async (item, ctx) => {
|
|
5155
5155
|
let {commit, root} = item.data;
|
|
5156
5156
|
if (!commit)
|
|
5157
5157
|
return;
|
|
5158
5158
|
let hasFugitive = await nvim.getVar("loaded_fugitive");
|
|
5159
5159
|
if (hasFugitive) {
|
|
5160
|
-
|
|
5160
|
+
let cmd = ctx.options.position === "tab" ? "Gtabedit" : "Gedit";
|
|
5161
|
+
await nvim.command(`${cmd} ${commit}`);
|
|
5161
5162
|
} else {
|
|
5162
5163
|
let lines = this.cachedCommits.get(commit);
|
|
5163
5164
|
if (!lines) {
|
|
@@ -5167,8 +5168,9 @@ var Commits = class extends import_coc4.BasicList {
|
|
|
5167
5168
|
lines = content.replace(/\n$/, "").split(/\r?\n/);
|
|
5168
5169
|
this.cachedCommits.set(commit, lines);
|
|
5169
5170
|
}
|
|
5171
|
+
let cmd = ctx.options.position === "tab" ? "tabe" : "edit";
|
|
5170
5172
|
nvim.pauseNotification();
|
|
5171
|
-
nvim.command(
|
|
5173
|
+
nvim.command(`${cmd} +setl\\ buftype=nofile [commit ${commit}]`, true);
|
|
5172
5174
|
nvim.command("setl foldmethod=syntax nobuflisted bufhidden=wipe", true);
|
|
5173
5175
|
nvim.command("setf git", true);
|
|
5174
5176
|
nvim.call("append", [0, lines], true);
|
|
@@ -5176,7 +5178,7 @@ var Commits = class extends import_coc4.BasicList {
|
|
|
5176
5178
|
nvim.command(`exe 1`, true);
|
|
5177
5179
|
await nvim.resumeNotification();
|
|
5178
5180
|
}
|
|
5179
|
-
});
|
|
5181
|
+
}, {tabPersist: true});
|
|
5180
5182
|
this.addAction("reset", async (item) => {
|
|
5181
5183
|
let {root, commit} = item.data;
|
|
5182
5184
|
if (!commit)
|
|
@@ -5251,7 +5253,7 @@ var Commits = class extends import_coc4.BasicList {
|
|
|
5251
5253
|
let content = await runCommand(`git --no-pager diff ${arg}`, {cwd: list[0].data.root});
|
|
5252
5254
|
let lines = content.replace(/\n$/, "").split("\n");
|
|
5253
5255
|
let winid = context.listWindow.id;
|
|
5254
|
-
let mod = context.options.position == "
|
|
5256
|
+
let mod = context.options.position == "tab" ? "below" : "above";
|
|
5255
5257
|
nvim.pauseNotification();
|
|
5256
5258
|
nvim.command("pclose", true);
|
|
5257
5259
|
nvim.command(`${mod} ${this.previewHeight}sp +setl\\ previewwindow [diff ${arg}]`, true);
|
|
@@ -5315,12 +5317,14 @@ var Gfiles = class extends import_coc5.BasicList {
|
|
|
5315
5317
|
const preferences = import_coc5.workspace.getConfiguration("coc.preferences");
|
|
5316
5318
|
let jumpCommand = preferences.get("jumpCommand", "edit");
|
|
5317
5319
|
for (let name of ["edit", "tabe", "vsplit", "split"]) {
|
|
5318
|
-
this.addAction(name, async (item) => {
|
|
5320
|
+
this.addAction(name, async (item, ctx) => {
|
|
5319
5321
|
let {root, sha, filepath, branch} = item.data;
|
|
5320
5322
|
if (!sha)
|
|
5321
5323
|
return;
|
|
5322
5324
|
if (branch == "HEAD") {
|
|
5323
5325
|
let cmd2 = name == "edit" ? jumpCommand : name;
|
|
5326
|
+
if (ctx.options.position === "tab")
|
|
5327
|
+
cmd2 = "tabe";
|
|
5324
5328
|
let fullpath = import_path2.default.join(root, filepath);
|
|
5325
5329
|
await import_coc5.workspace.jumpTo(import_coc5.Uri.file(fullpath).toString(), null, cmd2);
|
|
5326
5330
|
return;
|
|
@@ -5336,7 +5340,7 @@ var Gfiles = class extends import_coc5.BasicList {
|
|
|
5336
5340
|
nvim.command("setl buftype=nofile nomodifiable bufhidden=wipe nobuflisted", true);
|
|
5337
5341
|
nvim.command("filetype detect", true);
|
|
5338
5342
|
await nvim.resumeNotification();
|
|
5339
|
-
});
|
|
5343
|
+
}, {tabPersist: name === "edit"});
|
|
5340
5344
|
}
|
|
5341
5345
|
this.addAction("preview", async (item, context) => {
|
|
5342
5346
|
let {root, sha, filepath, branch} = item.data;
|
|
@@ -5406,7 +5410,6 @@ var GStatus = class extends import_coc6.BasicList {
|
|
|
5406
5410
|
this.name = "gstatus";
|
|
5407
5411
|
this.description = "Git status of current project";
|
|
5408
5412
|
this.defaultAction = "open";
|
|
5409
|
-
this.actions = [];
|
|
5410
5413
|
this.addLocationActions();
|
|
5411
5414
|
this.addMultipleAction("add", async (items) => {
|
|
5412
5415
|
let {root} = items[0].data;
|
|
@@ -5631,28 +5634,26 @@ var DocumentManager = class {
|
|
|
5631
5634
|
this.conflictSrcId = conflictSrcId;
|
|
5632
5635
|
this.buffers = new Map();
|
|
5633
5636
|
this.disposables = [];
|
|
5637
|
+
this.defined = false;
|
|
5634
5638
|
this.loadConfiguration();
|
|
5635
5639
|
import_coc8.workspace.onDidChangeConfiguration(this.loadConfiguration, this, this.disposables);
|
|
5636
5640
|
this.gitStatus = new status_default(service);
|
|
5637
|
-
|
|
5638
|
-
this.defineSigns().catch((e) => {
|
|
5639
|
-
console.error(e.message);
|
|
5640
|
-
});
|
|
5641
|
-
}
|
|
5642
|
-
for (let doc of import_coc8.workspace.documents) {
|
|
5641
|
+
const createBuffer = (doc) => {
|
|
5643
5642
|
let {uri} = doc;
|
|
5644
5643
|
service.createBuffer(doc, this.config).then((buf) => {
|
|
5645
5644
|
if (!buf || import_coc8.workspace.getDocument(uri) == null)
|
|
5646
5645
|
return;
|
|
5646
|
+
this.defineSigns().catch((e) => {
|
|
5647
|
+
console.error(e.message);
|
|
5648
|
+
});
|
|
5647
5649
|
this.buffers.set(doc.bufnr, buf);
|
|
5648
5650
|
});
|
|
5651
|
+
};
|
|
5652
|
+
for (let doc of import_coc8.workspace.documents) {
|
|
5653
|
+
createBuffer(doc);
|
|
5649
5654
|
}
|
|
5650
5655
|
import_coc8.workspace.onDidOpenTextDocument(async (e) => {
|
|
5651
|
-
|
|
5652
|
-
let buf = await service.createBuffer(doc, this.config);
|
|
5653
|
-
if (!buf || !import_coc8.workspace.getDocument(e.uri))
|
|
5654
|
-
return;
|
|
5655
|
-
this.buffers.set(e.bufnr, buf);
|
|
5656
|
+
createBuffer(import_coc8.workspace.getDocument(e.bufnr));
|
|
5656
5657
|
}, null, this.disposables);
|
|
5657
5658
|
import_coc8.workspace.onDidChangeTextDocument(async (e) => {
|
|
5658
5659
|
let buf = this.buffers.get(e.bufnr);
|
|
@@ -5691,6 +5692,9 @@ var DocumentManager = class {
|
|
|
5691
5692
|
}, null, this.disposables);
|
|
5692
5693
|
}
|
|
5693
5694
|
async defineSigns() {
|
|
5695
|
+
if (!this.enableGutters || this.defined)
|
|
5696
|
+
return;
|
|
5697
|
+
this.defined = true;
|
|
5694
5698
|
let {nvim} = this;
|
|
5695
5699
|
const config = import_coc8.workspace.getConfiguration("git");
|
|
5696
5700
|
let items = ["Changed", "Added", "Removed", "TopRemoved", "ChangeRemoved"];
|
|
@@ -5700,7 +5704,7 @@ var DocumentManager = class {
|
|
|
5700
5704
|
let text = config.get(`${section}.text`, "");
|
|
5701
5705
|
let hlGroup = config.get(`${section}.hlGroup`, "");
|
|
5702
5706
|
nvim.command(`sign define CocGit${item} text=${text} texthl=CocGit${item}Sign`, true);
|
|
5703
|
-
nvim.command(`
|
|
5707
|
+
nvim.command(`highlight default link CocGit${item}Sign ${hlGroup}`, true);
|
|
5704
5708
|
}
|
|
5705
5709
|
await nvim.resumeNotification();
|
|
5706
5710
|
}
|
|
@@ -6629,6 +6633,7 @@ var GitBuffer = class {
|
|
|
6629
6633
|
await buffer.clearNamespace(virtualTextSrcId);
|
|
6630
6634
|
if (import_coc11.workspace.has("nvim-0.6.0")) {
|
|
6631
6635
|
await buffer.setExtMark(virtualTextSrcId, lnum - 1, 0, {
|
|
6636
|
+
hl_mode: "combine",
|
|
6632
6637
|
virt_text: [[prefix + blameText, "CocCodeLens"]]
|
|
6633
6638
|
});
|
|
6634
6639
|
} else {
|
|
@@ -7405,7 +7410,6 @@ function addSource(context, resolver) {
|
|
|
7405
7410
|
page_idx++;
|
|
7406
7411
|
try {
|
|
7407
7412
|
let info = await import_coc13.fetch(page_uri, {headers});
|
|
7408
|
-
console.log(JSON.stringify(info, null, 2));
|
|
7409
7413
|
if (info.length == 0) {
|
|
7410
7414
|
break;
|
|
7411
7415
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-git",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.8",
|
|
4
4
|
"description": "Git extension for coc.nvim",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"publisher": "chemzqm",
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
"@types/node": "^12.12.0",
|
|
356
356
|
"@types/uuid": "^7.0.1",
|
|
357
357
|
"@types/which": "^1.3.2",
|
|
358
|
-
"coc.nvim": "^0.0.81-next.
|
|
358
|
+
"coc.nvim": "^0.0.81-next.13",
|
|
359
359
|
"colors": "^1.4.0",
|
|
360
360
|
"debounce": "^1.2.0",
|
|
361
361
|
"esbuild": "^0.8.29",
|