coc-git 2.4.11 → 2.5.2
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 +326 -216
- package/package.json +70 -2
package/lib/index.js
CHANGED
|
@@ -670,17 +670,17 @@ var require_zalgo = __commonJS((exports2, module2) => {
|
|
|
670
670
|
|
|
671
671
|
// node_modules/colors/lib/maps/america.js
|
|
672
672
|
var require_america = __commonJS((exports2, module2) => {
|
|
673
|
-
module2["exports"] = function(
|
|
673
|
+
module2["exports"] = function(colors5) {
|
|
674
674
|
return function(letter, i, exploded) {
|
|
675
675
|
if (letter === " ")
|
|
676
676
|
return letter;
|
|
677
677
|
switch (i % 3) {
|
|
678
678
|
case 0:
|
|
679
|
-
return
|
|
679
|
+
return colors5.red(letter);
|
|
680
680
|
case 1:
|
|
681
|
-
return
|
|
681
|
+
return colors5.white(letter);
|
|
682
682
|
case 2:
|
|
683
|
-
return
|
|
683
|
+
return colors5.blue(letter);
|
|
684
684
|
}
|
|
685
685
|
};
|
|
686
686
|
};
|
|
@@ -688,22 +688,22 @@ var require_america = __commonJS((exports2, module2) => {
|
|
|
688
688
|
|
|
689
689
|
// node_modules/colors/lib/maps/zebra.js
|
|
690
690
|
var require_zebra = __commonJS((exports2, module2) => {
|
|
691
|
-
module2["exports"] = function(
|
|
691
|
+
module2["exports"] = function(colors5) {
|
|
692
692
|
return function(letter, i, exploded) {
|
|
693
|
-
return i % 2 === 0 ? letter :
|
|
693
|
+
return i % 2 === 0 ? letter : colors5.inverse(letter);
|
|
694
694
|
};
|
|
695
695
|
};
|
|
696
696
|
});
|
|
697
697
|
|
|
698
698
|
// node_modules/colors/lib/maps/rainbow.js
|
|
699
699
|
var require_rainbow = __commonJS((exports2, module2) => {
|
|
700
|
-
module2["exports"] = function(
|
|
700
|
+
module2["exports"] = function(colors5) {
|
|
701
701
|
var rainbowColors = ["red", "yellow", "green", "blue", "magenta"];
|
|
702
702
|
return function(letter, i, exploded) {
|
|
703
703
|
if (letter === " ") {
|
|
704
704
|
return letter;
|
|
705
705
|
} else {
|
|
706
|
-
return
|
|
706
|
+
return colors5[rainbowColors[i++ % rainbowColors.length]](letter);
|
|
707
707
|
}
|
|
708
708
|
};
|
|
709
709
|
};
|
|
@@ -711,7 +711,7 @@ var require_rainbow = __commonJS((exports2, module2) => {
|
|
|
711
711
|
|
|
712
712
|
// node_modules/colors/lib/maps/random.js
|
|
713
713
|
var require_random = __commonJS((exports2, module2) => {
|
|
714
|
-
module2["exports"] = function(
|
|
714
|
+
module2["exports"] = function(colors5) {
|
|
715
715
|
var available = [
|
|
716
716
|
"underline",
|
|
717
717
|
"inverse",
|
|
@@ -732,40 +732,40 @@ var require_random = __commonJS((exports2, module2) => {
|
|
|
732
732
|
"brightMagenta"
|
|
733
733
|
];
|
|
734
734
|
return function(letter, i, exploded) {
|
|
735
|
-
return letter === " " ? letter :
|
|
735
|
+
return letter === " " ? letter : colors5[available[Math.round(Math.random() * (available.length - 2))]](letter);
|
|
736
736
|
};
|
|
737
737
|
};
|
|
738
738
|
});
|
|
739
739
|
|
|
740
740
|
// node_modules/colors/lib/colors.js
|
|
741
741
|
var require_colors = __commonJS((exports2, module2) => {
|
|
742
|
-
var
|
|
743
|
-
module2["exports"] =
|
|
744
|
-
|
|
742
|
+
var colors5 = {};
|
|
743
|
+
module2["exports"] = colors5;
|
|
744
|
+
colors5.themes = {};
|
|
745
745
|
var util2 = require("util");
|
|
746
|
-
var ansiStyles =
|
|
746
|
+
var ansiStyles = colors5.styles = require_styles();
|
|
747
747
|
var defineProps = Object.defineProperties;
|
|
748
748
|
var newLineRegex = new RegExp(/[\r\n]+/g);
|
|
749
|
-
|
|
750
|
-
if (typeof
|
|
751
|
-
|
|
749
|
+
colors5.supportsColor = require_supports_colors().supportsColor;
|
|
750
|
+
if (typeof colors5.enabled === "undefined") {
|
|
751
|
+
colors5.enabled = colors5.supportsColor() !== false;
|
|
752
752
|
}
|
|
753
|
-
|
|
754
|
-
|
|
753
|
+
colors5.enable = function() {
|
|
754
|
+
colors5.enabled = true;
|
|
755
755
|
};
|
|
756
|
-
|
|
757
|
-
|
|
756
|
+
colors5.disable = function() {
|
|
757
|
+
colors5.enabled = false;
|
|
758
758
|
};
|
|
759
|
-
|
|
759
|
+
colors5.stripColors = colors5.strip = function(str) {
|
|
760
760
|
return ("" + str).replace(/\x1B\[\d+m/g, "");
|
|
761
761
|
};
|
|
762
|
-
var stylize =
|
|
763
|
-
if (!
|
|
762
|
+
var stylize = colors5.stylize = function stylize2(str, style) {
|
|
763
|
+
if (!colors5.enabled) {
|
|
764
764
|
return str + "";
|
|
765
765
|
}
|
|
766
766
|
var styleMap = ansiStyles[style];
|
|
767
|
-
if (!styleMap && style in
|
|
768
|
-
return
|
|
767
|
+
if (!styleMap && style in colors5) {
|
|
768
|
+
return colors5[style](str);
|
|
769
769
|
}
|
|
770
770
|
return styleMap.open + str + styleMap.close;
|
|
771
771
|
};
|
|
@@ -797,7 +797,7 @@ var require_colors = __commonJS((exports2, module2) => {
|
|
|
797
797
|
});
|
|
798
798
|
return ret;
|
|
799
799
|
}();
|
|
800
|
-
var proto = defineProps(function
|
|
800
|
+
var proto = defineProps(function colors6() {
|
|
801
801
|
}, styles);
|
|
802
802
|
function applyStyle() {
|
|
803
803
|
var args = Array.prototype.slice.call(arguments);
|
|
@@ -808,7 +808,7 @@ var require_colors = __commonJS((exports2, module2) => {
|
|
|
808
808
|
return util2.inspect(arg);
|
|
809
809
|
}
|
|
810
810
|
}).join(" ");
|
|
811
|
-
if (!
|
|
811
|
+
if (!colors5.enabled || !str) {
|
|
812
812
|
return str;
|
|
813
813
|
}
|
|
814
814
|
var newLinesPresent = str.indexOf("\n") != -1;
|
|
@@ -825,22 +825,22 @@ var require_colors = __commonJS((exports2, module2) => {
|
|
|
825
825
|
}
|
|
826
826
|
return str;
|
|
827
827
|
}
|
|
828
|
-
|
|
828
|
+
colors5.setTheme = function(theme) {
|
|
829
829
|
if (typeof theme === "string") {
|
|
830
830
|
console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");
|
|
831
831
|
return;
|
|
832
832
|
}
|
|
833
833
|
for (var style in theme) {
|
|
834
834
|
(function(style2) {
|
|
835
|
-
|
|
835
|
+
colors5[style2] = function(str) {
|
|
836
836
|
if (typeof theme[style2] === "object") {
|
|
837
837
|
var out = str;
|
|
838
838
|
for (var i in theme[style2]) {
|
|
839
|
-
out =
|
|
839
|
+
out = colors5[theme[style2][i]](out);
|
|
840
840
|
}
|
|
841
841
|
return out;
|
|
842
842
|
}
|
|
843
|
-
return
|
|
843
|
+
return colors5[theme[style2]](str);
|
|
844
844
|
};
|
|
845
845
|
})(style);
|
|
846
846
|
}
|
|
@@ -861,27 +861,27 @@ var require_colors = __commonJS((exports2, module2) => {
|
|
|
861
861
|
exploded = exploded.map(map2);
|
|
862
862
|
return exploded.join("");
|
|
863
863
|
};
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
for (var map in
|
|
864
|
+
colors5.trap = require_trap();
|
|
865
|
+
colors5.zalgo = require_zalgo();
|
|
866
|
+
colors5.maps = {};
|
|
867
|
+
colors5.maps.america = require_america()(colors5);
|
|
868
|
+
colors5.maps.zebra = require_zebra()(colors5);
|
|
869
|
+
colors5.maps.rainbow = require_rainbow()(colors5);
|
|
870
|
+
colors5.maps.random = require_random()(colors5);
|
|
871
|
+
for (var map in colors5.maps) {
|
|
872
872
|
(function(map2) {
|
|
873
|
-
|
|
874
|
-
return sequencer(
|
|
873
|
+
colors5[map2] = function(str) {
|
|
874
|
+
return sequencer(colors5.maps[map2], str);
|
|
875
875
|
};
|
|
876
876
|
})(map);
|
|
877
877
|
}
|
|
878
|
-
defineProps(
|
|
878
|
+
defineProps(colors5, init());
|
|
879
879
|
});
|
|
880
880
|
|
|
881
881
|
// node_modules/colors/safe.js
|
|
882
882
|
var require_safe = __commonJS((exports2, module2) => {
|
|
883
|
-
var
|
|
884
|
-
module2["exports"] =
|
|
883
|
+
var colors5 = require_colors();
|
|
884
|
+
module2["exports"] = colors5;
|
|
885
885
|
});
|
|
886
886
|
|
|
887
887
|
// node_modules/debounce/index.js
|
|
@@ -4508,7 +4508,7 @@ var require_lib = __commonJS((exports2, module2) => {
|
|
|
4508
4508
|
__export(exports, {
|
|
4509
4509
|
activate: () => activate
|
|
4510
4510
|
});
|
|
4511
|
-
var
|
|
4511
|
+
var import_coc15 = __toModule(require("coc.nvim"));
|
|
4512
4512
|
|
|
4513
4513
|
// src/constants.ts
|
|
4514
4514
|
var DEFAULT_TYPES = [
|
|
@@ -4924,11 +4924,11 @@ var Bcommits = class extends import_coc2.BasicList {
|
|
|
4924
4924
|
}, {tabPersist: true});
|
|
4925
4925
|
this.addAction("view", async (item, context) => {
|
|
4926
4926
|
let {commit, root, file} = item.data;
|
|
4927
|
-
let {window:
|
|
4927
|
+
let {window: window10} = context;
|
|
4928
4928
|
let content = await import_coc2.runCommand(`git show ${commit}:${shellescape(file)}`, {cwd: root});
|
|
4929
4929
|
let lines = content.replace(/\n$/, "").split("\n");
|
|
4930
4930
|
nvim.pauseNotification();
|
|
4931
|
-
nvim.call("win_gotoid", [
|
|
4931
|
+
nvim.call("win_gotoid", [window10.id], true);
|
|
4932
4932
|
nvim.command(`exe "tabe ".fnameescape('(${commit}) ${file}')`, true);
|
|
4933
4933
|
nvim.call("append", [0, lines], true);
|
|
4934
4934
|
nvim.command("normal! Gdd", true);
|
|
@@ -5529,6 +5529,9 @@ var GStatus = class extends import_coc6.BasicList {
|
|
|
5529
5529
|
throw new Error(`Can't resolve git root.`);
|
|
5530
5530
|
return;
|
|
5531
5531
|
}
|
|
5532
|
+
if (this.manager.gstatusSaveBeforeOpen) {
|
|
5533
|
+
await this.nvim.command(`wa`);
|
|
5534
|
+
}
|
|
5532
5535
|
let output = await runCommand(`git status --porcelain -uall ${context.args.join(" ")}`, {cwd: root});
|
|
5533
5536
|
output = output.replace(/\s+$/, "");
|
|
5534
5537
|
if (!output)
|
|
@@ -5557,19 +5560,90 @@ var GStatus = class extends import_coc6.BasicList {
|
|
|
5557
5560
|
};
|
|
5558
5561
|
var gstatus_default = GStatus;
|
|
5559
5562
|
|
|
5563
|
+
// src/lists/gchunks.ts
|
|
5564
|
+
var import_coc7 = __toModule(require("coc.nvim"));
|
|
5565
|
+
var import_safe3 = __toModule(require_safe());
|
|
5566
|
+
var GChunks = class extends import_coc7.BasicList {
|
|
5567
|
+
constructor(nvim, manager) {
|
|
5568
|
+
super(nvim);
|
|
5569
|
+
this.manager = manager;
|
|
5570
|
+
this.name = "gchunks";
|
|
5571
|
+
this.description = "Git changes of current buffer";
|
|
5572
|
+
this.defaultAction = "jump";
|
|
5573
|
+
this.actions.push({
|
|
5574
|
+
name: "jump",
|
|
5575
|
+
execute: (item) => {
|
|
5576
|
+
if (Array.isArray(item))
|
|
5577
|
+
return;
|
|
5578
|
+
import_coc7.window.moveTo({line: Math.max(item.data.line - 1, 0), character: 0});
|
|
5579
|
+
}
|
|
5580
|
+
});
|
|
5581
|
+
}
|
|
5582
|
+
async loadItems(context) {
|
|
5583
|
+
let buf = this.manager.getBuffer(context.buffer.id);
|
|
5584
|
+
if (!buf) {
|
|
5585
|
+
throw new Error(`Can't resolve git root.`);
|
|
5586
|
+
return;
|
|
5587
|
+
}
|
|
5588
|
+
let res = [];
|
|
5589
|
+
let diffs = buf.cachedDiffs;
|
|
5590
|
+
if (diffs && diffs.length > 0) {
|
|
5591
|
+
for (let diff of diffs) {
|
|
5592
|
+
let stagedSign = " ";
|
|
5593
|
+
res.push({
|
|
5594
|
+
label: `${stagedSign} Line:${diff.start} ${diff.lines[0]}`,
|
|
5595
|
+
sortText: `${diff.start}`,
|
|
5596
|
+
data: {
|
|
5597
|
+
line: diff.start
|
|
5598
|
+
}
|
|
5599
|
+
});
|
|
5600
|
+
}
|
|
5601
|
+
}
|
|
5602
|
+
try {
|
|
5603
|
+
let {relpath} = buf;
|
|
5604
|
+
let stagedDiff = await buf.repo.getStagedChunks(relpath);
|
|
5605
|
+
let chunks = Object.values(stagedDiff)[0];
|
|
5606
|
+
if (chunks.length > 0) {
|
|
5607
|
+
for (let diff of chunks) {
|
|
5608
|
+
let adjust = 0;
|
|
5609
|
+
let stagedSign = import_safe3.default.green("*");
|
|
5610
|
+
let line = diff.add.lnum;
|
|
5611
|
+
for (let diff2 of diffs) {
|
|
5612
|
+
if (diff2.end >= line) {
|
|
5613
|
+
break;
|
|
5614
|
+
}
|
|
5615
|
+
adjust += diff2.added.count;
|
|
5616
|
+
adjust -= diff2.removed.count;
|
|
5617
|
+
}
|
|
5618
|
+
line += adjust;
|
|
5619
|
+
res.push({
|
|
5620
|
+
label: `${stagedSign} Line:${line} ${diff.lines[0]}`,
|
|
5621
|
+
data: {
|
|
5622
|
+
line: `${line}`
|
|
5623
|
+
}
|
|
5624
|
+
});
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
} catch (e) {
|
|
5628
|
+
}
|
|
5629
|
+
return res;
|
|
5630
|
+
}
|
|
5631
|
+
};
|
|
5632
|
+
var gchunks_default = GChunks;
|
|
5633
|
+
|
|
5560
5634
|
// src/manager.ts
|
|
5561
|
-
var
|
|
5635
|
+
var import_coc9 = __toModule(require("coc.nvim"));
|
|
5562
5636
|
var import_debounce = __toModule(require_debounce());
|
|
5563
5637
|
|
|
5564
5638
|
// src/model/status.ts
|
|
5565
|
-
var
|
|
5639
|
+
var import_coc8 = __toModule(require("coc.nvim"));
|
|
5566
5640
|
var GitStatus = class {
|
|
5567
5641
|
constructor(service) {
|
|
5568
5642
|
this.service = service;
|
|
5569
5643
|
this.disposables = [];
|
|
5570
5644
|
this._enabled = false;
|
|
5571
|
-
this.mutex = new
|
|
5572
|
-
let config =
|
|
5645
|
+
this.mutex = new import_coc8.Mutex();
|
|
5646
|
+
let config = import_coc8.workspace.getConfiguration("git");
|
|
5573
5647
|
this._enabled = config.get("enableGlobalStatus", true);
|
|
5574
5648
|
this.branchCharacter = config.get("branchCharacter", "");
|
|
5575
5649
|
this.characters = {
|
|
@@ -5578,10 +5652,10 @@ var GitStatus = class {
|
|
|
5578
5652
|
stagedDecorator: config.get("stagedDecorator"),
|
|
5579
5653
|
untrackedDecorator: config.get("untrackedDecorator")
|
|
5580
5654
|
};
|
|
5581
|
-
|
|
5582
|
-
|
|
5655
|
+
import_coc8.events.on("BufEnter", this.refresh, this, this.disposables);
|
|
5656
|
+
import_coc8.events.on("FocusGained", this.refresh, this, this.disposables);
|
|
5583
5657
|
let timer;
|
|
5584
|
-
|
|
5658
|
+
import_coc8.events.on("BufWritePost", () => {
|
|
5585
5659
|
timer = setTimeout(() => {
|
|
5586
5660
|
this.refresh();
|
|
5587
5661
|
}, 300);
|
|
@@ -5616,14 +5690,14 @@ var GitStatus = class {
|
|
|
5616
5690
|
if (this.gitStatus == status)
|
|
5617
5691
|
return;
|
|
5618
5692
|
this.gitStatus = status;
|
|
5619
|
-
let {nvim} =
|
|
5693
|
+
let {nvim} = import_coc8.workspace;
|
|
5620
5694
|
nvim.pauseNotification();
|
|
5621
5695
|
nvim.setVar("coc_git_status", status, true);
|
|
5622
5696
|
nvim.call("coc#util#do_autocmd", ["CocGitStatusChange"], true);
|
|
5623
5697
|
nvim.resumeNotification(false, true);
|
|
5624
5698
|
}
|
|
5625
5699
|
dispose() {
|
|
5626
|
-
|
|
5700
|
+
import_coc8.disposeAll(this.disposables);
|
|
5627
5701
|
}
|
|
5628
5702
|
};
|
|
5629
5703
|
var status_default = GitStatus;
|
|
@@ -5659,12 +5733,12 @@ var DocumentManager = class {
|
|
|
5659
5733
|
this.disposables = [];
|
|
5660
5734
|
this.defined = false;
|
|
5661
5735
|
this.loadConfiguration();
|
|
5662
|
-
|
|
5736
|
+
import_coc9.workspace.onDidChangeConfiguration(this.loadConfiguration, this, this.disposables);
|
|
5663
5737
|
this.gitStatus = new status_default(service);
|
|
5664
5738
|
const createBuffer = (doc) => {
|
|
5665
5739
|
let {uri} = doc;
|
|
5666
5740
|
service.createBuffer(doc, this.config).then((buf) => {
|
|
5667
|
-
if (!buf ||
|
|
5741
|
+
if (!buf || import_coc9.workspace.getDocument(uri) == null)
|
|
5668
5742
|
return;
|
|
5669
5743
|
this.defineSigns().catch((e) => {
|
|
5670
5744
|
console.error(e.message);
|
|
@@ -5672,43 +5746,43 @@ var DocumentManager = class {
|
|
|
5672
5746
|
this.buffers.set(doc.bufnr, buf);
|
|
5673
5747
|
});
|
|
5674
5748
|
};
|
|
5675
|
-
for (let doc of
|
|
5749
|
+
for (let doc of import_coc9.workspace.documents) {
|
|
5676
5750
|
createBuffer(doc);
|
|
5677
5751
|
}
|
|
5678
|
-
|
|
5679
|
-
createBuffer(
|
|
5752
|
+
import_coc9.workspace.onDidOpenTextDocument(async (e) => {
|
|
5753
|
+
createBuffer(import_coc9.workspace.getDocument(e.bufnr));
|
|
5680
5754
|
}, null, this.disposables);
|
|
5681
|
-
|
|
5755
|
+
import_coc9.workspace.onDidChangeTextDocument(async (e) => {
|
|
5682
5756
|
let buf = this.buffers.get(e.bufnr);
|
|
5683
5757
|
if (buf)
|
|
5684
5758
|
buf.refresh();
|
|
5685
5759
|
}, null, this.disposables);
|
|
5686
|
-
|
|
5760
|
+
import_coc9.workspace.onDidCloseTextDocument((e) => {
|
|
5687
5761
|
let buf = this.buffers.get(e.bufnr);
|
|
5688
5762
|
if (buf)
|
|
5689
5763
|
buf.dispose();
|
|
5690
5764
|
this.buffers.delete(e.bufnr);
|
|
5691
5765
|
this.service.resolver.delete(e.uri);
|
|
5692
5766
|
}, null, this.disposables);
|
|
5693
|
-
|
|
5767
|
+
import_coc9.events.on("CursorMoved", import_debounce.default(async (bufnr, cursor) => {
|
|
5694
5768
|
let buf = this.buffers.get(bufnr);
|
|
5695
5769
|
if (buf)
|
|
5696
5770
|
await buf.showBlameInfo(cursor[0]);
|
|
5697
5771
|
}, 100), null, this.disposables);
|
|
5698
|
-
|
|
5772
|
+
import_coc9.events.on("BufWritePre", (bufnr) => {
|
|
5699
5773
|
if (!this.enableGutters || this.config.realtimeGutters)
|
|
5700
5774
|
return;
|
|
5701
5775
|
let buf = this.buffers.get(bufnr);
|
|
5702
5776
|
if (buf)
|
|
5703
5777
|
buf.updateGutters();
|
|
5704
5778
|
}, null, this.disposables);
|
|
5705
|
-
|
|
5779
|
+
import_coc9.events.on("FocusGained", async () => {
|
|
5706
5780
|
let bufnr = await nvim.call("bufnr", ["%"]);
|
|
5707
5781
|
let buf = this.buffers.get(bufnr);
|
|
5708
5782
|
if (buf)
|
|
5709
5783
|
buf.refresh();
|
|
5710
5784
|
}, null, this.disposables);
|
|
5711
|
-
|
|
5785
|
+
import_coc9.events.on("BufEnter", (bufnr) => {
|
|
5712
5786
|
let buf = this.buffers.get(bufnr);
|
|
5713
5787
|
if (buf)
|
|
5714
5788
|
buf.refresh();
|
|
@@ -5719,7 +5793,7 @@ var DocumentManager = class {
|
|
|
5719
5793
|
return;
|
|
5720
5794
|
this.defined = true;
|
|
5721
5795
|
let {nvim} = this;
|
|
5722
|
-
const config =
|
|
5796
|
+
const config = import_coc9.workspace.getConfiguration("git");
|
|
5723
5797
|
let items = ["Changed", "Added", "Removed", "TopRemoved", "ChangeRemoved"];
|
|
5724
5798
|
nvim.pauseNotification();
|
|
5725
5799
|
for (let item of items) {
|
|
@@ -5734,13 +5808,13 @@ var DocumentManager = class {
|
|
|
5734
5808
|
loadConfiguration(e) {
|
|
5735
5809
|
if (e && !e.affectsConfiguration("git"))
|
|
5736
5810
|
return;
|
|
5737
|
-
let config =
|
|
5811
|
+
let config = import_coc9.workspace.getConfiguration("git");
|
|
5738
5812
|
let obj = {
|
|
5739
5813
|
remoteName: config.get("remoteName", "origin"),
|
|
5740
5814
|
diffRevision: config.get("diffRevision", ""),
|
|
5741
5815
|
issueFormat: config.get("issueFormat", "#%i"),
|
|
5742
5816
|
virtualTextPrefix: config.get("virtualTextPrefix", " "),
|
|
5743
|
-
addGBlameToVirtualText:
|
|
5817
|
+
addGBlameToVirtualText: import_coc9.workspace.nvim.hasFunction("nvim_buf_set_virtual_text") && config.get("addGBlameToVirtualText", false),
|
|
5744
5818
|
addGBlameToBufferVar: config.get("addGBlameToBufferVar", false),
|
|
5745
5819
|
blameUseRealTime: config.get("blameUseRealTime", false),
|
|
5746
5820
|
enableGutters: config.get("enableGutters", true),
|
|
@@ -5774,6 +5848,10 @@ var DocumentManager = class {
|
|
|
5774
5848
|
currentHlGroup: config.get("conflict.current.hlGroup", "DiffChange"),
|
|
5775
5849
|
incomingHlGroup: config.get("conflict.incoming.hlGroup", "DiffAdd")
|
|
5776
5850
|
},
|
|
5851
|
+
floatConfig: config.get("floatConfig", {}),
|
|
5852
|
+
gstatus: {
|
|
5853
|
+
saveBeforeOpen: config.get("gstatus.saveBeforeOpen", false)
|
|
5854
|
+
},
|
|
5777
5855
|
virtualTextSrcId: this.virtualTextSrcId,
|
|
5778
5856
|
conflictSrcId: this.conflictSrcId
|
|
5779
5857
|
};
|
|
@@ -5782,12 +5860,15 @@ var DocumentManager = class {
|
|
|
5782
5860
|
get enableGutters() {
|
|
5783
5861
|
return this.config.enableGutters;
|
|
5784
5862
|
}
|
|
5863
|
+
get gstatusSaveBeforeOpen() {
|
|
5864
|
+
return this.config.gstatus.saveBeforeOpen;
|
|
5865
|
+
}
|
|
5785
5866
|
get git() {
|
|
5786
5867
|
return this.service.git;
|
|
5787
5868
|
}
|
|
5788
5869
|
async toggleGutters() {
|
|
5789
5870
|
let enabled = this.enableGutters;
|
|
5790
|
-
let config =
|
|
5871
|
+
let config = import_coc9.workspace.getConfiguration("git");
|
|
5791
5872
|
config.update("enableGutters", !enabled, true);
|
|
5792
5873
|
for (let buf of this.buffers.values()) {
|
|
5793
5874
|
await buf.toggleGutters(!enabled);
|
|
@@ -5799,7 +5880,7 @@ var DocumentManager = class {
|
|
|
5799
5880
|
await buf.toggleFold();
|
|
5800
5881
|
}
|
|
5801
5882
|
async resolveGitRootFromBufferOrCwd(bufnr) {
|
|
5802
|
-
let doc =
|
|
5883
|
+
let doc = import_coc9.workspace.getDocument(bufnr);
|
|
5803
5884
|
let root;
|
|
5804
5885
|
let {resolver} = this.service;
|
|
5805
5886
|
if (doc) {
|
|
@@ -5901,36 +5982,36 @@ var DocumentManager = class {
|
|
|
5901
5982
|
}
|
|
5902
5983
|
}
|
|
5903
5984
|
async push(args) {
|
|
5904
|
-
let bufnr = await
|
|
5985
|
+
let bufnr = await import_coc9.workspace.nvim.call("bufnr", "%");
|
|
5905
5986
|
let root = await this.resolveGitRootFromBufferOrCwd(bufnr);
|
|
5906
5987
|
let extra = this.config.pushArguments;
|
|
5907
5988
|
if (!root) {
|
|
5908
|
-
|
|
5989
|
+
import_coc9.window.showMessage(`not belongs to git repository.`, "warning");
|
|
5909
5990
|
return;
|
|
5910
5991
|
}
|
|
5911
5992
|
if (args && args.length) {
|
|
5912
|
-
await
|
|
5993
|
+
await import_coc9.window.runTerminalCommand(`git push ${[...args, ...extra].join(" ")}`, root, true);
|
|
5913
5994
|
return;
|
|
5914
5995
|
}
|
|
5915
5996
|
let repo = this.service.getRepoFromRoot(root);
|
|
5916
5997
|
let output = await repo.safeRun(["remote"]);
|
|
5917
5998
|
let remote = output.trim().split(/\r?\n/)[0];
|
|
5918
5999
|
if (!remote) {
|
|
5919
|
-
|
|
6000
|
+
import_coc9.window.showMessage(`remote not found`, "warning");
|
|
5920
6001
|
return;
|
|
5921
6002
|
}
|
|
5922
6003
|
output = await repo.safeRun(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
5923
6004
|
if (!output) {
|
|
5924
|
-
|
|
6005
|
+
import_coc9.window.showMessage(`current branch not found`, "warning");
|
|
5925
6006
|
return;
|
|
5926
6007
|
}
|
|
5927
|
-
await
|
|
6008
|
+
await import_coc9.window.runTerminalCommand(`git push ${remote} ${output}${extra.length ? " " + extra.join(" ") : ""}`, root, true);
|
|
5928
6009
|
}
|
|
5929
6010
|
get buffer() {
|
|
5930
|
-
return
|
|
6011
|
+
return import_coc9.workspace.nvim.call("bufnr", "%").then((bufnr) => {
|
|
5931
6012
|
let buf = this.buffers.get(bufnr);
|
|
5932
6013
|
if (!buf)
|
|
5933
|
-
|
|
6014
|
+
import_coc9.window.showMessage(`Cant't resolve git repository for current buffer.`, "warning");
|
|
5934
6015
|
return buf;
|
|
5935
6016
|
});
|
|
5936
6017
|
}
|
|
@@ -5944,13 +6025,13 @@ var DocumentManager = class {
|
|
|
5944
6025
|
buf.dispose();
|
|
5945
6026
|
}
|
|
5946
6027
|
this.buffers.clear();
|
|
5947
|
-
|
|
6028
|
+
import_coc9.disposeAll(this.disposables);
|
|
5948
6029
|
}
|
|
5949
6030
|
};
|
|
5950
6031
|
var manager_default = DocumentManager;
|
|
5951
6032
|
|
|
5952
6033
|
// src/model/service.ts
|
|
5953
|
-
var
|
|
6034
|
+
var import_coc13 = __toModule(require("coc.nvim"));
|
|
5954
6035
|
|
|
5955
6036
|
// src/model/repo.ts
|
|
5956
6037
|
var import_fs2 = __toModule(require("fs"));
|
|
@@ -6223,7 +6304,7 @@ function parseDiff(diffStr) {
|
|
|
6223
6304
|
|
|
6224
6305
|
// src/model/git.ts
|
|
6225
6306
|
var cp = __toModule(require("child_process"));
|
|
6226
|
-
var
|
|
6307
|
+
var import_coc10 = __toModule(require("coc.nvim"));
|
|
6227
6308
|
var import_iconv_lite = __toModule(require_lib());
|
|
6228
6309
|
var import_path5 = __toModule(require("path"));
|
|
6229
6310
|
var Git = class {
|
|
@@ -6300,11 +6381,11 @@ async function exec2(child, cancellationToken) {
|
|
|
6300
6381
|
const disposables = [];
|
|
6301
6382
|
const once = (ee, name, fn) => {
|
|
6302
6383
|
ee.once(name, fn);
|
|
6303
|
-
disposables.push(
|
|
6384
|
+
disposables.push(import_coc10.Disposable.create(() => ee.removeListener(name, fn)));
|
|
6304
6385
|
};
|
|
6305
6386
|
const on = (ee, name, fn) => {
|
|
6306
6387
|
ee.on(name, fn);
|
|
6307
|
-
disposables.push(
|
|
6388
|
+
disposables.push(import_coc10.Disposable.create(() => ee.removeListener(name, fn)));
|
|
6308
6389
|
};
|
|
6309
6390
|
let result = Promise.all([
|
|
6310
6391
|
new Promise((c, e) => {
|
|
@@ -6338,12 +6419,12 @@ async function exec2(child, cancellationToken) {
|
|
|
6338
6419
|
const [exitCode, stdout, stderr] = await result;
|
|
6339
6420
|
return {exitCode, stdout, stderr};
|
|
6340
6421
|
} finally {
|
|
6341
|
-
|
|
6422
|
+
import_coc10.disposeAll(disposables);
|
|
6342
6423
|
}
|
|
6343
6424
|
}
|
|
6344
6425
|
|
|
6345
6426
|
// src/model/resolver.ts
|
|
6346
|
-
var
|
|
6427
|
+
var import_coc11 = __toModule(require("coc.nvim"));
|
|
6347
6428
|
var import_fs3 = __toModule(require("fs"));
|
|
6348
6429
|
var import_path6 = __toModule(require("path"));
|
|
6349
6430
|
var import_util9 = __toModule(require("util"));
|
|
@@ -6354,7 +6435,7 @@ async function getRealPath(fullpath) {
|
|
|
6354
6435
|
} catch (e) {
|
|
6355
6436
|
if (e.message.includes("ENOENT")) {
|
|
6356
6437
|
try {
|
|
6357
|
-
resolved = await
|
|
6438
|
+
resolved = await import_coc11.workspace.nvim.call("expand", [fullpath]);
|
|
6358
6439
|
} catch (e2) {
|
|
6359
6440
|
}
|
|
6360
6441
|
}
|
|
@@ -6395,7 +6476,7 @@ var Resolver = class {
|
|
|
6395
6476
|
if (doc.buftype != "" || doc.schema != "file") {
|
|
6396
6477
|
return null;
|
|
6397
6478
|
}
|
|
6398
|
-
let fullpath = await getRealPath(
|
|
6479
|
+
let fullpath = await getRealPath(import_coc11.Uri.parse(uri).fsPath);
|
|
6399
6480
|
if (process.platform == "win32") {
|
|
6400
6481
|
fullpath = import_path6.default.win32.normalize(fullpath);
|
|
6401
6482
|
}
|
|
@@ -6424,12 +6505,12 @@ var Resolver = class {
|
|
|
6424
6505
|
return root;
|
|
6425
6506
|
}
|
|
6426
6507
|
async resolveRootFromCwd() {
|
|
6427
|
-
let parts =
|
|
6508
|
+
let parts = import_coc11.workspace.cwd.split(import_path6.default.sep);
|
|
6428
6509
|
let idx = parts.indexOf(".git");
|
|
6429
6510
|
if (idx !== -1)
|
|
6430
6511
|
return parts.slice(0, idx).join(import_path6.default.sep);
|
|
6431
6512
|
try {
|
|
6432
|
-
return await this.git.getRepositoryRoot(
|
|
6513
|
+
return await this.git.getRepositoryRoot(import_coc11.workspace.cwd);
|
|
6433
6514
|
} catch (e) {
|
|
6434
6515
|
}
|
|
6435
6516
|
return null;
|
|
@@ -6442,7 +6523,8 @@ var Resolver = class {
|
|
|
6442
6523
|
var resolver_default = Resolver;
|
|
6443
6524
|
|
|
6444
6525
|
// src/model/buffer.ts
|
|
6445
|
-
var
|
|
6526
|
+
var import_coc12 = __toModule(require("coc.nvim"));
|
|
6527
|
+
var import_debounce2 = __toModule(require_debounce());
|
|
6446
6528
|
|
|
6447
6529
|
// node_modules/timeago.js/esm/lang/en_US.js
|
|
6448
6530
|
var EN_US = ["second", "minute", "hour", "day", "week", "month", "year"];
|
|
@@ -6520,7 +6602,6 @@ register("en_US", en_US_default);
|
|
|
6520
6602
|
register("zh_CN", zh_CN_default);
|
|
6521
6603
|
|
|
6522
6604
|
// src/model/buffer.ts
|
|
6523
|
-
var import_debounce2 = __toModule(require_debounce());
|
|
6524
6605
|
var import_url = __toModule(require("url"));
|
|
6525
6606
|
var signGroup = "CocGit";
|
|
6526
6607
|
var GitBuffer = class {
|
|
@@ -6540,7 +6621,7 @@ var GitBuffer = class {
|
|
|
6540
6621
|
this.hasConflicts = false;
|
|
6541
6622
|
this.foldEnabled = false;
|
|
6542
6623
|
this._disposed = false;
|
|
6543
|
-
this.mutex = new
|
|
6624
|
+
this.mutex = new import_coc12.Mutex();
|
|
6544
6625
|
this.refresh = import_debounce2.default(() => {
|
|
6545
6626
|
this._refresh().catch((e) => {
|
|
6546
6627
|
channel.append(`[Error] ${e.message}`);
|
|
@@ -6585,7 +6666,7 @@ var GitBuffer = class {
|
|
|
6585
6666
|
});
|
|
6586
6667
|
}
|
|
6587
6668
|
async chunkUndo() {
|
|
6588
|
-
let line = await
|
|
6669
|
+
let line = await import_coc12.workspace.nvim.call("line", ".");
|
|
6589
6670
|
let diff = this.getChunk(line);
|
|
6590
6671
|
if (!diff)
|
|
6591
6672
|
return;
|
|
@@ -6605,10 +6686,10 @@ var GitBuffer = class {
|
|
|
6605
6686
|
}
|
|
6606
6687
|
async chunkStage() {
|
|
6607
6688
|
let relpath = toUnixSlash(this.relpath);
|
|
6608
|
-
let line = await
|
|
6689
|
+
let line = await import_coc12.workspace.nvim.call("line", ".");
|
|
6609
6690
|
let diff = this.getChunk(line);
|
|
6610
6691
|
if (!diff) {
|
|
6611
|
-
|
|
6692
|
+
import_coc12.window.showMessage("Not positioned in git chunk", "error");
|
|
6612
6693
|
return;
|
|
6613
6694
|
}
|
|
6614
6695
|
let head;
|
|
@@ -6636,7 +6717,7 @@ var GitBuffer = class {
|
|
|
6636
6717
|
}
|
|
6637
6718
|
}
|
|
6638
6719
|
async chunkUnstage() {
|
|
6639
|
-
let {nvim} =
|
|
6720
|
+
let {nvim} = import_coc12.workspace;
|
|
6640
6721
|
const {diffs} = this;
|
|
6641
6722
|
let line = await nvim.call("line", ".");
|
|
6642
6723
|
let adjust = 0;
|
|
@@ -6644,7 +6725,7 @@ var GitBuffer = class {
|
|
|
6644
6725
|
for (let diff of diffs) {
|
|
6645
6726
|
if (diff.end >= line) {
|
|
6646
6727
|
if (diff.start <= line && diff.changeType != ChangeType.Delete) {
|
|
6647
|
-
|
|
6728
|
+
import_coc12.window.showErrorMessage(`Current line contains unstaged change.`);
|
|
6648
6729
|
invalid = true;
|
|
6649
6730
|
}
|
|
6650
6731
|
break;
|
|
@@ -6658,12 +6739,12 @@ var GitBuffer = class {
|
|
|
6658
6739
|
let stagedDiff = await this.repo.getStagedChunks(this.relpath);
|
|
6659
6740
|
let chunks = Object.values(stagedDiff)[0];
|
|
6660
6741
|
if (!chunks.length) {
|
|
6661
|
-
|
|
6742
|
+
import_coc12.window.showErrorMessage(`Staged chunk not found`);
|
|
6662
6743
|
return;
|
|
6663
6744
|
}
|
|
6664
6745
|
let chunk = chunks.find((o) => o.add.lnum <= line && o.add.lnum + o.add.count >= line);
|
|
6665
6746
|
if (!chunk) {
|
|
6666
|
-
|
|
6747
|
+
import_coc12.window.showErrorMessage(`Unable to find staged chunk on current line`);
|
|
6667
6748
|
return;
|
|
6668
6749
|
}
|
|
6669
6750
|
this.channel.appendLine(`[Info] resolved chunk ${JSON.stringify(chunk, null, 2)}`);
|
|
@@ -6674,52 +6755,77 @@ var GitBuffer = class {
|
|
|
6674
6755
|
await this.git.exec(this.repo.root, ["apply", "--cached", "--unidiff-zero", "-"], {input: patch});
|
|
6675
6756
|
this.refresh();
|
|
6676
6757
|
} catch (e) {
|
|
6677
|
-
|
|
6758
|
+
import_coc12.window.showErrorMessage(`Unable to apply patch: ${e.message}`);
|
|
6678
6759
|
this.channel.appendLine(`[Error] ${e.message}`);
|
|
6679
6760
|
}
|
|
6680
6761
|
}
|
|
6681
6762
|
async nextChunk() {
|
|
6682
6763
|
const {diffs} = this;
|
|
6683
|
-
let {nvim} =
|
|
6764
|
+
let {nvim} = import_coc12.workspace;
|
|
6684
6765
|
if (!diffs || diffs.length == 0)
|
|
6685
6766
|
return;
|
|
6686
6767
|
let line = await nvim.call("line", ".");
|
|
6687
6768
|
for (let diff of diffs) {
|
|
6688
6769
|
if (diff.start > line) {
|
|
6689
|
-
await
|
|
6770
|
+
await import_coc12.window.moveTo({line: Math.max(diff.start - 1, 0), character: 0});
|
|
6690
6771
|
return;
|
|
6691
6772
|
}
|
|
6692
6773
|
}
|
|
6693
6774
|
if (await nvim.getOption("wrapscan")) {
|
|
6694
|
-
await
|
|
6775
|
+
await import_coc12.window.moveTo({line: Math.max(diffs[0].start - 1, 0), character: 0});
|
|
6695
6776
|
}
|
|
6696
6777
|
}
|
|
6697
6778
|
async prevChunk() {
|
|
6698
|
-
const {nvim} =
|
|
6779
|
+
const {nvim} = import_coc12.workspace;
|
|
6699
6780
|
let {diffs} = this;
|
|
6700
6781
|
let line = await nvim.call("line", ".");
|
|
6701
6782
|
if (!diffs || diffs.length == 0)
|
|
6702
6783
|
return;
|
|
6703
6784
|
for (let diff of diffs.slice().reverse()) {
|
|
6704
6785
|
if (diff.end < line) {
|
|
6705
|
-
await
|
|
6786
|
+
await import_coc12.window.moveTo({line: Math.max(diff.start - 1, 0), character: 0});
|
|
6706
6787
|
return;
|
|
6707
6788
|
}
|
|
6708
6789
|
}
|
|
6709
6790
|
if (await nvim.getOption("wrapscan")) {
|
|
6710
|
-
await
|
|
6791
|
+
await import_coc12.window.moveTo({line: Math.max(diffs[diffs.length - 1].start - 1, 0), character: 0});
|
|
6711
6792
|
}
|
|
6712
6793
|
}
|
|
6713
6794
|
async chunkInfo() {
|
|
6714
|
-
let line = await
|
|
6795
|
+
let line = await import_coc12.workspace.nvim.call("line", ".");
|
|
6715
6796
|
let diff = this.getChunk(line);
|
|
6716
6797
|
if (diff) {
|
|
6717
6798
|
let content = diff.head + "\n" + diff.lines.join("\n");
|
|
6718
6799
|
await this.showDoc(content, "diff");
|
|
6800
|
+
} else {
|
|
6801
|
+
let chunks;
|
|
6802
|
+
try {
|
|
6803
|
+
let stagedDiff = await this.repo.getStagedChunks(this.relpath);
|
|
6804
|
+
chunks = Object.values(stagedDiff)[0];
|
|
6805
|
+
} catch (e) {
|
|
6806
|
+
return;
|
|
6807
|
+
}
|
|
6808
|
+
if (!chunks.length) {
|
|
6809
|
+
return;
|
|
6810
|
+
}
|
|
6811
|
+
let adjust = 0;
|
|
6812
|
+
for (let diff2 of this.diffs) {
|
|
6813
|
+
if (diff2.end >= line) {
|
|
6814
|
+
break;
|
|
6815
|
+
}
|
|
6816
|
+
adjust -= diff2.added.count;
|
|
6817
|
+
adjust += diff2.removed.count;
|
|
6818
|
+
}
|
|
6819
|
+
line = line + adjust;
|
|
6820
|
+
let chunk = chunks.find((o) => o.add.lnum <= line && o.add.lnum + o.add.count >= line);
|
|
6821
|
+
if (chunk) {
|
|
6822
|
+
let content = "Staged chagnes\n" + chunk.lines.join("\n");
|
|
6823
|
+
await this.showDoc(content, "diff");
|
|
6824
|
+
}
|
|
6719
6825
|
}
|
|
6720
6826
|
}
|
|
6721
6827
|
async showBlameInfo(lnum) {
|
|
6722
|
-
let {nvim} =
|
|
6828
|
+
let {nvim} = import_coc12.workspace;
|
|
6723
6829
|
let {virtualTextSrcId, addGBlameToBufferVar, addGBlameToVirtualText} = this.config;
|
|
6724
6830
|
if (!this.showBlame)
|
|
6725
6831
|
return;
|
|
@@ -6751,7 +6857,7 @@ var GitBuffer = class {
|
|
|
6751
6857
|
if (addGBlameToVirtualText) {
|
|
6752
6858
|
const prefix = this.config.virtualTextPrefix;
|
|
6753
6859
|
await buffer.clearNamespace(virtualTextSrcId);
|
|
6754
|
-
if (
|
|
6860
|
+
if (import_coc12.workspace.has("nvim-0.6.0")) {
|
|
6755
6861
|
await buffer.setExtMark(virtualTextSrcId, lnum - 1, 0, {
|
|
6756
6862
|
hl_mode: "combine",
|
|
6757
6863
|
virt_text: [[prefix + blameText, "CocCodeLens"]]
|
|
@@ -6765,7 +6871,7 @@ var GitBuffer = class {
|
|
|
6765
6871
|
async showBlameDoc(lnum) {
|
|
6766
6872
|
let indexed = await this.repo.isIndexed(this.relpath);
|
|
6767
6873
|
if (!indexed) {
|
|
6768
|
-
|
|
6874
|
+
import_coc12.window.showMessage("File not indexed");
|
|
6769
6875
|
} else {
|
|
6770
6876
|
let infos = await this.getBlameInfo();
|
|
6771
6877
|
let info = infos.find((o) => lnum >= o.startLnum && lnum <= o.endLnum);
|
|
@@ -6776,13 +6882,13 @@ var GitBuffer = class {
|
|
|
6776
6882
|
blameText.push(`${info.sha.substring(0, 7)}`);
|
|
6777
6883
|
await this.showDoc(blameText.join("\n\n"), "text");
|
|
6778
6884
|
} else {
|
|
6779
|
-
|
|
6885
|
+
import_coc12.window.showMessage("Not committed yet");
|
|
6780
6886
|
}
|
|
6781
6887
|
}
|
|
6782
6888
|
}
|
|
6783
6889
|
async diffDocument(force = false) {
|
|
6784
6890
|
var _a;
|
|
6785
|
-
let {nvim} =
|
|
6891
|
+
let {nvim} = import_coc12.workspace;
|
|
6786
6892
|
let revision = this.config.diffRevision;
|
|
6787
6893
|
const {bufnr} = this.doc;
|
|
6788
6894
|
const diffs = await this.repo.getDiff(this.relpath, this.doc.content, revision);
|
|
@@ -6861,7 +6967,7 @@ var GitBuffer = class {
|
|
|
6861
6967
|
return;
|
|
6862
6968
|
if (!this.config.enableGutters)
|
|
6863
6969
|
return;
|
|
6864
|
-
let {nvim} =
|
|
6970
|
+
let {nvim} = import_coc12.workspace;
|
|
6865
6971
|
let {bufnr} = this.doc;
|
|
6866
6972
|
let {signPriority} = this.config;
|
|
6867
6973
|
let signs = this.currentSigns;
|
|
@@ -6934,10 +7040,10 @@ var GitBuffer = class {
|
|
|
6934
7040
|
async diffCached() {
|
|
6935
7041
|
let res = await this.repo.safeRun(["diff", "--cached"]);
|
|
6936
7042
|
if (!res.trim()) {
|
|
6937
|
-
|
|
7043
|
+
import_coc12.window.showMessage("Empty diff");
|
|
6938
7044
|
return;
|
|
6939
7045
|
}
|
|
6940
|
-
let {nvim} =
|
|
7046
|
+
let {nvim} = import_coc12.workspace;
|
|
6941
7047
|
nvim.pauseNotification();
|
|
6942
7048
|
nvim.command(`keepalt above new +setl\\ previewwindow`, true);
|
|
6943
7049
|
nvim.call("append", [0, res.split(/\r?\n/)], true);
|
|
@@ -6948,44 +7054,44 @@ var GitBuffer = class {
|
|
|
6948
7054
|
await nvim.resumeNotification();
|
|
6949
7055
|
}
|
|
6950
7056
|
async nextConflict() {
|
|
6951
|
-
let {nvim} =
|
|
7057
|
+
let {nvim} = import_coc12.workspace;
|
|
6952
7058
|
if (!this.conflicts.length) {
|
|
6953
|
-
|
|
7059
|
+
import_coc12.window.showMessage("No conflicts detected", "warning");
|
|
6954
7060
|
return;
|
|
6955
7061
|
}
|
|
6956
7062
|
let line = await nvim.call("line", ".");
|
|
6957
7063
|
for (let conflict of this.conflicts) {
|
|
6958
7064
|
if (conflict.start > line) {
|
|
6959
|
-
await
|
|
7065
|
+
await import_coc12.window.moveTo({line: Math.max(conflict.start - 1, 0), character: 0});
|
|
6960
7066
|
return;
|
|
6961
7067
|
}
|
|
6962
7068
|
}
|
|
6963
7069
|
if (await nvim.getOption("wrapscan")) {
|
|
6964
|
-
await
|
|
7070
|
+
await import_coc12.window.moveTo({line: Math.max(this.conflicts[0].start - 1, 0), character: 0});
|
|
6965
7071
|
}
|
|
6966
7072
|
}
|
|
6967
7073
|
async prevConflict() {
|
|
6968
|
-
let {nvim} =
|
|
7074
|
+
let {nvim} = import_coc12.workspace;
|
|
6969
7075
|
if (!this.conflicts.length) {
|
|
6970
|
-
|
|
7076
|
+
import_coc12.window.showMessage("No conflicts detected", "warning");
|
|
6971
7077
|
return;
|
|
6972
7078
|
}
|
|
6973
7079
|
let line = await nvim.call("line", ".");
|
|
6974
7080
|
for (let conflict of this.conflicts) {
|
|
6975
7081
|
if (conflict.start > line) {
|
|
6976
|
-
await
|
|
7082
|
+
await import_coc12.window.moveTo({line: Math.max(conflict.start - 1, 0), character: 0});
|
|
6977
7083
|
return;
|
|
6978
7084
|
}
|
|
6979
7085
|
}
|
|
6980
7086
|
if (await nvim.getOption("wrapscan")) {
|
|
6981
|
-
await
|
|
7087
|
+
await import_coc12.window.moveTo({line: Math.max(this.conflicts[0].start - 1, 0), character: 0});
|
|
6982
7088
|
}
|
|
6983
7089
|
}
|
|
6984
7090
|
async conflictKeepPart(part) {
|
|
6985
|
-
const {nvim} =
|
|
7091
|
+
const {nvim} = import_coc12.workspace;
|
|
6986
7092
|
let conflicts = this.conflicts;
|
|
6987
7093
|
if (!conflicts || conflicts.length == 0) {
|
|
6988
|
-
|
|
7094
|
+
import_coc12.window.showMessage("No conflicts detected");
|
|
6989
7095
|
return;
|
|
6990
7096
|
}
|
|
6991
7097
|
let line = await nvim.call("line", ".");
|
|
@@ -7005,11 +7111,11 @@ var GitBuffer = class {
|
|
|
7005
7111
|
}
|
|
7006
7112
|
}
|
|
7007
7113
|
}
|
|
7008
|
-
|
|
7114
|
+
import_coc12.window.showMessage("Not positioned on a conflict");
|
|
7009
7115
|
}
|
|
7010
7116
|
async browser(action = "open", range, permalink = false) {
|
|
7011
|
-
let {nvim} =
|
|
7012
|
-
let config =
|
|
7117
|
+
let {nvim} = import_coc12.workspace;
|
|
7118
|
+
let config = import_coc12.workspace.getConfiguration("git");
|
|
7013
7119
|
let head = (await this.repo.safeRun(["rev-parse", "HEAD"])).trim();
|
|
7014
7120
|
let branch = config.get("browserBranchName", "").trim();
|
|
7015
7121
|
if (!branch.length) {
|
|
@@ -7028,7 +7134,7 @@ var GitBuffer = class {
|
|
|
7028
7134
|
}
|
|
7029
7135
|
let output = await this.repo.safeRun(["remote"]);
|
|
7030
7136
|
if (!output.trim()) {
|
|
7031
|
-
|
|
7137
|
+
import_coc12.window.showMessage(`No remote found`, "warning");
|
|
7032
7138
|
return;
|
|
7033
7139
|
}
|
|
7034
7140
|
let names = output.trim().split(/\r?\n/);
|
|
@@ -7037,7 +7143,7 @@ var GitBuffer = class {
|
|
|
7037
7143
|
if (names.includes(browserRemoteName)) {
|
|
7038
7144
|
names = [browserRemoteName];
|
|
7039
7145
|
} else {
|
|
7040
|
-
|
|
7146
|
+
import_coc12.window.showMessage("Configured git.browserRemoteName missing from remote list", "warning");
|
|
7041
7147
|
return;
|
|
7042
7148
|
}
|
|
7043
7149
|
}
|
|
@@ -7060,19 +7166,19 @@ var GitBuffer = class {
|
|
|
7060
7166
|
}
|
|
7061
7167
|
if (urls.length == 1) {
|
|
7062
7168
|
if (action == "open") {
|
|
7063
|
-
await
|
|
7169
|
+
await import_coc12.workspace.openResource(urls[0]);
|
|
7064
7170
|
} else {
|
|
7065
7171
|
nvim.command(`let @+ = '${urls[0]}'`, true);
|
|
7066
|
-
|
|
7172
|
+
import_coc12.window.showMessage("Copied url to clipboard");
|
|
7067
7173
|
}
|
|
7068
7174
|
} else if (urls.length > 1) {
|
|
7069
|
-
let idx = await
|
|
7175
|
+
let idx = await import_coc12.window.showQuickpick(urls, "Select url:");
|
|
7070
7176
|
if (idx >= 0) {
|
|
7071
7177
|
if (action == "open") {
|
|
7072
|
-
await
|
|
7178
|
+
await import_coc12.workspace.openResource(urls[idx]);
|
|
7073
7179
|
} else {
|
|
7074
7180
|
nvim.command(`let @+ = '${urls[idx]}'`, true);
|
|
7075
|
-
|
|
7181
|
+
import_coc12.window.showMessage("Copied url to clipboard");
|
|
7076
7182
|
}
|
|
7077
7183
|
}
|
|
7078
7184
|
}
|
|
@@ -7080,10 +7186,10 @@ var GitBuffer = class {
|
|
|
7080
7186
|
async showCommit() {
|
|
7081
7187
|
let indexed = await this.repo.isIndexed(this.relpath);
|
|
7082
7188
|
if (!indexed) {
|
|
7083
|
-
|
|
7189
|
+
import_coc12.window.showMessage(`"${this.relpath}" not indexed.`, "warning");
|
|
7084
7190
|
return;
|
|
7085
7191
|
}
|
|
7086
|
-
let nvim =
|
|
7192
|
+
let nvim = import_coc12.workspace.nvim;
|
|
7087
7193
|
let line = await nvim.eval('line(".")');
|
|
7088
7194
|
let args = ["--no-pager", "blame", "-l", "--root", "-t", `-L${line},${line}`, this.relpath];
|
|
7089
7195
|
let res = await this.repo.exec(args);
|
|
@@ -7092,7 +7198,7 @@ var GitBuffer = class {
|
|
|
7092
7198
|
return;
|
|
7093
7199
|
let commit = output.match(/^\S+/)[0];
|
|
7094
7200
|
if (/^0+$/.test(commit)) {
|
|
7095
|
-
|
|
7201
|
+
import_coc12.window.showMessage("not committed yet!", "warning");
|
|
7096
7202
|
return;
|
|
7097
7203
|
}
|
|
7098
7204
|
let useFloating = this.config.showCommitInFloating;
|
|
@@ -7123,16 +7229,16 @@ var GitBuffer = class {
|
|
|
7123
7229
|
}
|
|
7124
7230
|
}
|
|
7125
7231
|
async toggleFold() {
|
|
7126
|
-
let {nvim} =
|
|
7232
|
+
let {nvim} = import_coc12.workspace;
|
|
7127
7233
|
let buf = this.doc.buffer;
|
|
7128
7234
|
let win = await nvim.window;
|
|
7129
7235
|
let bufnr = buf.id;
|
|
7130
|
-
let doc =
|
|
7236
|
+
let doc = import_coc12.workspace.getDocument(bufnr);
|
|
7131
7237
|
if (!doc)
|
|
7132
7238
|
return;
|
|
7133
7239
|
let infos = this.currentSigns;
|
|
7134
7240
|
if (!infos || infos.length == 0) {
|
|
7135
|
-
|
|
7241
|
+
import_coc12.window.showMessage("No changes", "warning");
|
|
7136
7242
|
return;
|
|
7137
7243
|
}
|
|
7138
7244
|
let lnums = infos.map((o) => o.lnum);
|
|
@@ -7190,7 +7296,7 @@ var GitBuffer = class {
|
|
|
7190
7296
|
}
|
|
7191
7297
|
async toggleGutters(enabled) {
|
|
7192
7298
|
this.config.enableGutters = enabled;
|
|
7193
|
-
let {nvim} =
|
|
7299
|
+
let {nvim} = import_coc12.workspace;
|
|
7194
7300
|
if (!enabled) {
|
|
7195
7301
|
nvim.call("sign_unplace", [signGroup, {buffer: this.doc.bufnr}], true);
|
|
7196
7302
|
} else {
|
|
@@ -7275,7 +7381,7 @@ var GitBuffer = class {
|
|
|
7275
7381
|
let buffer = this.doc.buffer;
|
|
7276
7382
|
let currentHlGroup = this.config.conflict.currentHlGroup;
|
|
7277
7383
|
let incomingHlGroup = this.config.conflict.incomingHlGroup;
|
|
7278
|
-
let {nvim} =
|
|
7384
|
+
let {nvim} = import_coc12.workspace;
|
|
7279
7385
|
nvim.pauseNotification();
|
|
7280
7386
|
buffer.clearNamespace(this.config.conflictSrcId, 0, -1);
|
|
7281
7387
|
conflicts.map((conflict) => {
|
|
@@ -7296,12 +7402,12 @@ var GitBuffer = class {
|
|
|
7296
7402
|
nvim.resumeNotification(false, true);
|
|
7297
7403
|
}
|
|
7298
7404
|
async showDoc(content, filetype = "diff") {
|
|
7299
|
-
if (
|
|
7405
|
+
if (this.floatFactory) {
|
|
7300
7406
|
let docs = [{content, filetype}];
|
|
7301
|
-
await this.floatFactory.show(docs);
|
|
7407
|
+
await this.floatFactory.show(docs, this.config.floatConfig);
|
|
7302
7408
|
} else {
|
|
7303
7409
|
const lines = content.split("\n");
|
|
7304
|
-
|
|
7410
|
+
import_coc12.workspace.nvim.call("coc#util#preview_info", [lines, "diff"], true);
|
|
7305
7411
|
}
|
|
7306
7412
|
}
|
|
7307
7413
|
setBufferStatus(status) {
|
|
@@ -7309,7 +7415,7 @@ var GitBuffer = class {
|
|
|
7309
7415
|
if (exists == status)
|
|
7310
7416
|
return;
|
|
7311
7417
|
this.gitStatus = status;
|
|
7312
|
-
let {nvim} =
|
|
7418
|
+
let {nvim} = import_coc12.workspace;
|
|
7313
7419
|
let buffer = nvim.createBuffer(this.doc.bufnr);
|
|
7314
7420
|
nvim.pauseNotification();
|
|
7315
7421
|
buffer.setVar("coc_git_status", status, true);
|
|
@@ -7335,7 +7441,7 @@ var GitBuffer = class {
|
|
|
7335
7441
|
return this.config.addGBlameToVirtualText || this.config.addGBlameToBufferVar;
|
|
7336
7442
|
}
|
|
7337
7443
|
dispose() {
|
|
7338
|
-
let {nvim} =
|
|
7444
|
+
let {nvim} = import_coc12.workspace;
|
|
7339
7445
|
let {bufnr} = this.doc;
|
|
7340
7446
|
let buffer = nvim.createBuffer(bufnr);
|
|
7341
7447
|
buffer.setVar("coc_git_status", "", true);
|
|
@@ -7363,10 +7469,12 @@ var import_path7 = __toModule(require("path"));
|
|
|
7363
7469
|
var GitService = class {
|
|
7364
7470
|
constructor(gitInfo) {
|
|
7365
7471
|
this.repos = new Map();
|
|
7366
|
-
const outputChannel = this.outputChannel =
|
|
7472
|
+
const outputChannel = this.outputChannel = import_coc13.window.createOutputChannel("git");
|
|
7367
7473
|
this._git = new git_default(gitInfo, outputChannel);
|
|
7368
7474
|
this._resolver = new resolver_default(this._git, outputChannel);
|
|
7369
|
-
|
|
7475
|
+
if (typeof import_coc13.window.createFloatFactory === "function") {
|
|
7476
|
+
this.floatFactory = import_coc13.window.createFloatFactory({modes: ["n"]});
|
|
7477
|
+
}
|
|
7370
7478
|
}
|
|
7371
7479
|
getRepoFromRoot(root) {
|
|
7372
7480
|
if (this.repos.has(root)) {
|
|
@@ -7392,11 +7500,11 @@ var GitService = class {
|
|
|
7392
7500
|
return new buffer_default(doc, config, relpath, repo, this.git, this.outputChannel, this.floatFactory);
|
|
7393
7501
|
}
|
|
7394
7502
|
async getCurrentRepo() {
|
|
7395
|
-
let {nvim} =
|
|
7503
|
+
let {nvim} = import_coc13.workspace;
|
|
7396
7504
|
let [fullpath, buftype] = await nvim.eval('[expand("%:p"),&buftype]');
|
|
7397
7505
|
if (!import_path7.default.isAbsolute(fullpath) || buftype != "")
|
|
7398
7506
|
return void 0;
|
|
7399
|
-
let root = await this.resolver.resolveGitRoot({uri:
|
|
7507
|
+
let root = await this.resolver.resolveGitRoot({uri: import_coc13.Uri.file(fullpath).toString(), schema: "file", buftype: ""});
|
|
7400
7508
|
if (root == null)
|
|
7401
7509
|
return void 0;
|
|
7402
7510
|
return this.getRepoFromRoot(root);
|
|
@@ -7411,7 +7519,8 @@ var GitService = class {
|
|
|
7411
7519
|
this.outputChannel.appendLine(text);
|
|
7412
7520
|
}
|
|
7413
7521
|
dispose() {
|
|
7414
|
-
|
|
7522
|
+
var _a;
|
|
7523
|
+
(_a = this.floatFactory) == null ? void 0 : _a.dispose();
|
|
7415
7524
|
this._resolver.dispose();
|
|
7416
7525
|
this.outputChannel.dispose();
|
|
7417
7526
|
this.repos.clear();
|
|
@@ -7420,15 +7529,15 @@ var GitService = class {
|
|
|
7420
7529
|
var service_default = GitService;
|
|
7421
7530
|
|
|
7422
7531
|
// src/source.ts
|
|
7423
|
-
var
|
|
7424
|
-
var
|
|
7532
|
+
var import_coc14 = __toModule(require("coc.nvim"));
|
|
7533
|
+
var import_safe4 = __toModule(require_safe());
|
|
7425
7534
|
function byteSlice(content, start, end) {
|
|
7426
7535
|
let buf = Buffer.from(content, "utf8");
|
|
7427
7536
|
return buf.slice(start, end).toString("utf8");
|
|
7428
7537
|
}
|
|
7429
7538
|
var issuesMap = new Map();
|
|
7430
7539
|
function issuesFiletypes() {
|
|
7431
|
-
return
|
|
7540
|
+
return import_coc14.workspace.getConfiguration().get("coc.source.issues.filetypes");
|
|
7432
7541
|
}
|
|
7433
7542
|
function getOrganizationNameAndRepoNameFromGitHubRemoteUrl(remoteUrl) {
|
|
7434
7543
|
try {
|
|
@@ -7467,7 +7576,7 @@ function renderWord(issue, issueFormat) {
|
|
|
7467
7576
|
}
|
|
7468
7577
|
function addSource(context, resolver) {
|
|
7469
7578
|
let {subscriptions, logger} = context;
|
|
7470
|
-
let statusItem =
|
|
7579
|
+
let statusItem = import_coc14.window.createStatusBarItem(0, {progress: true});
|
|
7471
7580
|
statusItem.text = "loading issues";
|
|
7472
7581
|
let statusItemCounter = 0;
|
|
7473
7582
|
function onStartLoading() {
|
|
@@ -7510,7 +7619,7 @@ function addSource(context, resolver) {
|
|
|
7510
7619
|
const pageUri = `${uri}&page=${pageIndex}`;
|
|
7511
7620
|
pageIndex++;
|
|
7512
7621
|
try {
|
|
7513
|
-
let info = await
|
|
7622
|
+
let info = await import_coc14.fetch(pageUri, {headers: {"Private-Token": token}});
|
|
7514
7623
|
if (!info.length) {
|
|
7515
7624
|
break;
|
|
7516
7625
|
}
|
|
@@ -7546,7 +7655,7 @@ function addSource(context, resolver) {
|
|
|
7546
7655
|
let page_uri = `${uri}&page=${page_idx}`;
|
|
7547
7656
|
page_idx++;
|
|
7548
7657
|
try {
|
|
7549
|
-
let info = await
|
|
7658
|
+
let info = await import_coc14.fetch(page_uri, {headers});
|
|
7550
7659
|
if (info.length == 0) {
|
|
7551
7660
|
break;
|
|
7552
7661
|
}
|
|
@@ -7571,7 +7680,7 @@ function addSource(context, resolver) {
|
|
|
7571
7680
|
return issues;
|
|
7572
7681
|
}
|
|
7573
7682
|
async function loadIssues(root) {
|
|
7574
|
-
let config =
|
|
7683
|
+
let config = import_coc14.workspace.getConfiguration("git");
|
|
7575
7684
|
const issueSources = (await safeRun(`git config --get coc-git.issuesources`, {cwd: root}) || "").trim();
|
|
7576
7685
|
if (issueSources) {
|
|
7577
7686
|
return Array.prototype.concat.apply([], await Promise.all(issueSources.split(",").map((issueSource) => {
|
|
@@ -7614,14 +7723,14 @@ function addSource(context, resolver) {
|
|
|
7614
7723
|
}
|
|
7615
7724
|
}).catch(onError);
|
|
7616
7725
|
};
|
|
7617
|
-
for (let doc of
|
|
7726
|
+
for (let doc of import_coc14.workspace.documents) {
|
|
7618
7727
|
if (issuesFiletypes().includes(doc.filetype)) {
|
|
7619
7728
|
loadIssuesFromDocument(doc);
|
|
7620
7729
|
}
|
|
7621
7730
|
}
|
|
7622
|
-
|
|
7731
|
+
import_coc14.workspace.onDidOpenTextDocument(async (e) => {
|
|
7623
7732
|
if (issuesFiletypes().includes(e.languageId)) {
|
|
7624
|
-
let doc =
|
|
7733
|
+
let doc = import_coc14.workspace.getDocument(e.uri);
|
|
7625
7734
|
loadIssuesFromDocument(doc);
|
|
7626
7735
|
}
|
|
7627
7736
|
}, null, subscriptions);
|
|
@@ -7630,7 +7739,7 @@ function addSource(context, resolver) {
|
|
|
7630
7739
|
async doComplete(opt) {
|
|
7631
7740
|
let pre = byteSlice(opt.line, 0, opt.colnr - 1);
|
|
7632
7741
|
if (pre && pre.endsWith("#")) {
|
|
7633
|
-
const config =
|
|
7742
|
+
const config = import_coc14.workspace.getConfiguration("git");
|
|
7634
7743
|
const issueFormat = config.get("issueFormat", "#%i");
|
|
7635
7744
|
let issues = issuesMap.get(opt.bufnr);
|
|
7636
7745
|
if (!issues || issues.length == 0)
|
|
@@ -7656,14 +7765,14 @@ function addSource(context, resolver) {
|
|
|
7656
7765
|
};
|
|
7657
7766
|
}
|
|
7658
7767
|
};
|
|
7659
|
-
subscriptions.push(
|
|
7768
|
+
subscriptions.push(import_coc14.sources.createSource(source));
|
|
7660
7769
|
let list = {
|
|
7661
7770
|
name: "issues",
|
|
7662
7771
|
actions: [{
|
|
7663
7772
|
name: "open",
|
|
7664
7773
|
execute: async (item) => {
|
|
7665
7774
|
let {url} = item.data;
|
|
7666
|
-
await
|
|
7775
|
+
await import_coc14.workspace.openResource(url);
|
|
7667
7776
|
},
|
|
7668
7777
|
multiple: false
|
|
7669
7778
|
}, {
|
|
@@ -7673,7 +7782,7 @@ function addSource(context, resolver) {
|
|
|
7673
7782
|
let {body, id} = item.data;
|
|
7674
7783
|
let lines = body.split(/\r?\n/);
|
|
7675
7784
|
let mod = context2.options.position == "top" ? "below" : "above";
|
|
7676
|
-
let {nvim} =
|
|
7785
|
+
let {nvim} = import_coc14.workspace;
|
|
7677
7786
|
nvim.pauseNotification();
|
|
7678
7787
|
nvim.command("pclose", true);
|
|
7679
7788
|
nvim.command(`${mod} ${lines.length}sp +setl\\ previewwindow [issue ${id}]`, true);
|
|
@@ -7692,141 +7801,142 @@ function addSource(context, resolver) {
|
|
|
7692
7801
|
description: "issues on github/gitlab",
|
|
7693
7802
|
loadItems: async (context2) => {
|
|
7694
7803
|
let buf = await context2.window.buffer;
|
|
7695
|
-
let root = await resolver.resolveGitRoot(
|
|
7804
|
+
let root = await resolver.resolveGitRoot(import_coc14.workspace.getDocument(buf.id));
|
|
7696
7805
|
if (!root)
|
|
7697
7806
|
return [];
|
|
7698
7807
|
let issues = await loadIssues(root);
|
|
7699
7808
|
return issues.map((o) => {
|
|
7700
7809
|
return {
|
|
7701
|
-
label: `${
|
|
7810
|
+
label: `${import_safe4.default.red("#" + o.id.toFixed(0))} ${o.title} (${import_safe4.default.green(o.createAt.toUTCString())}) <${import_safe4.default.blue(o.creator)}>`,
|
|
7702
7811
|
data: {id: o.id, url: o.url, body: o.body}
|
|
7703
7812
|
};
|
|
7704
7813
|
});
|
|
7705
7814
|
}
|
|
7706
7815
|
};
|
|
7707
|
-
subscriptions.push(
|
|
7816
|
+
subscriptions.push(import_coc14.listManager.registerList(list));
|
|
7708
7817
|
}
|
|
7709
7818
|
|
|
7710
7819
|
// src/index.ts
|
|
7711
7820
|
async function activate(context) {
|
|
7712
|
-
const config =
|
|
7821
|
+
const config = import_coc15.workspace.getConfiguration("git");
|
|
7713
7822
|
const {subscriptions} = context;
|
|
7714
7823
|
let gitInfo;
|
|
7715
7824
|
try {
|
|
7716
7825
|
let pathHint = config.get("command");
|
|
7717
7826
|
gitInfo = await findGit(pathHint, (path8) => context.logger.info(`Looking for git in: ${path8}`));
|
|
7718
7827
|
} catch (e) {
|
|
7719
|
-
|
|
7828
|
+
import_coc15.window.showMessage("git command required for coc-git", "error");
|
|
7720
7829
|
return;
|
|
7721
7830
|
}
|
|
7722
|
-
const virtualTextSrcId = await
|
|
7723
|
-
const conflictSrcId = await
|
|
7724
|
-
const {nvim} =
|
|
7831
|
+
const virtualTextSrcId = await import_coc15.workspace.nvim.createNamespace("coc-git-virtual");
|
|
7832
|
+
const conflictSrcId = await import_coc15.workspace.nvim.createNamespace("coc-git-conflicts");
|
|
7833
|
+
const {nvim} = import_coc15.workspace;
|
|
7725
7834
|
const service = new service_default(gitInfo);
|
|
7726
7835
|
const manager = new manager_default(nvim, service, virtualTextSrcId, conflictSrcId);
|
|
7727
7836
|
subscriptions.push(manager);
|
|
7728
7837
|
addSource(context, service.resolver);
|
|
7729
|
-
subscriptions.push(
|
|
7838
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.refresh", () => {
|
|
7730
7839
|
manager.refresh();
|
|
7731
7840
|
}));
|
|
7732
|
-
subscriptions.push(
|
|
7841
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-nextchunk", async () => {
|
|
7733
7842
|
await manager.nextChunk();
|
|
7734
7843
|
}, {sync: false}));
|
|
7735
|
-
subscriptions.push(
|
|
7844
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-prevchunk", async () => {
|
|
7736
7845
|
await manager.prevChunk();
|
|
7737
7846
|
}, {sync: false}));
|
|
7738
|
-
subscriptions.push(
|
|
7847
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-nextconflict", async () => {
|
|
7739
7848
|
await manager.nextConflict();
|
|
7740
7849
|
}, {sync: false}));
|
|
7741
|
-
subscriptions.push(
|
|
7850
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-prevconflict", async () => {
|
|
7742
7851
|
await manager.prevConflict();
|
|
7743
7852
|
}, {sync: false}));
|
|
7744
|
-
subscriptions.push(
|
|
7853
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-keepcurrent", async () => {
|
|
7745
7854
|
await manager.keepCurrent();
|
|
7746
7855
|
}, {sync: false}));
|
|
7747
|
-
subscriptions.push(
|
|
7856
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-keepincoming", async () => {
|
|
7748
7857
|
await manager.keepIncoming();
|
|
7749
7858
|
}, {sync: false}));
|
|
7750
|
-
subscriptions.push(
|
|
7859
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-keepboth", async () => {
|
|
7751
7860
|
await manager.keepBoth();
|
|
7752
7861
|
}, {sync: false}));
|
|
7753
|
-
subscriptions.push(
|
|
7862
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-chunkinfo", async () => {
|
|
7754
7863
|
await manager.chunkInfo();
|
|
7755
7864
|
}, {sync: false}));
|
|
7756
|
-
subscriptions.push(
|
|
7865
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-commit", async () => {
|
|
7757
7866
|
await manager.showCommit();
|
|
7758
7867
|
}, {sync: false}));
|
|
7759
|
-
subscriptions.push(
|
|
7868
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-showblamedoc", async () => {
|
|
7760
7869
|
await manager.showBlameDoc();
|
|
7761
7870
|
}, {sync: false}));
|
|
7762
|
-
subscriptions.push(
|
|
7871
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.keepCurrent", async () => {
|
|
7763
7872
|
await manager.keepCurrent();
|
|
7764
7873
|
}));
|
|
7765
|
-
subscriptions.push(
|
|
7874
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.keepIncoming", async () => {
|
|
7766
7875
|
await manager.keepIncoming();
|
|
7767
7876
|
}));
|
|
7768
|
-
subscriptions.push(
|
|
7877
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.keepBoth", async () => {
|
|
7769
7878
|
await manager.keepBoth();
|
|
7770
7879
|
}));
|
|
7771
|
-
subscriptions.push(
|
|
7880
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkInfo", async () => {
|
|
7772
7881
|
await manager.chunkInfo();
|
|
7773
7882
|
}));
|
|
7774
|
-
subscriptions.push(
|
|
7883
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkStage", async () => {
|
|
7775
7884
|
await manager.chunkStage();
|
|
7776
7885
|
}));
|
|
7777
|
-
subscriptions.push(
|
|
7886
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkUnstage", async () => {
|
|
7778
7887
|
await manager.chunkUnstage();
|
|
7779
7888
|
}));
|
|
7780
|
-
subscriptions.push(
|
|
7889
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkUndo", async () => {
|
|
7781
7890
|
await manager.chunkUndo();
|
|
7782
7891
|
}));
|
|
7783
|
-
subscriptions.push(
|
|
7892
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.showCommit", async () => {
|
|
7784
7893
|
await manager.showCommit();
|
|
7785
7894
|
}));
|
|
7786
|
-
subscriptions.push(
|
|
7895
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.browserOpen", async () => {
|
|
7787
7896
|
await manager.browser();
|
|
7788
7897
|
}));
|
|
7789
|
-
subscriptions.push(
|
|
7898
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.copyUrl", async (...args) => {
|
|
7790
7899
|
await manager.browser("copy", args);
|
|
7791
7900
|
}));
|
|
7792
|
-
subscriptions.push(
|
|
7901
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.copyPermalink", async (...args) => {
|
|
7793
7902
|
await manager.browser("copy", args, true);
|
|
7794
7903
|
}));
|
|
7795
|
-
subscriptions.push(
|
|
7904
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.push", async (...args) => {
|
|
7796
7905
|
await manager.push(args);
|
|
7797
7906
|
}));
|
|
7798
|
-
subscriptions.push(
|
|
7907
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.diffCached", async () => {
|
|
7799
7908
|
await manager.diffCached();
|
|
7800
7909
|
}));
|
|
7801
|
-
subscriptions.push(
|
|
7910
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.toggleGutters", async () => {
|
|
7802
7911
|
await manager.toggleGutters();
|
|
7803
7912
|
}));
|
|
7804
|
-
subscriptions.push(
|
|
7913
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.foldUnchanged", async () => {
|
|
7805
7914
|
await manager.toggleFold();
|
|
7806
7915
|
}));
|
|
7807
|
-
subscriptions.push(
|
|
7916
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.showBlameDoc", async () => {
|
|
7808
7917
|
await manager.showBlameDoc();
|
|
7809
7918
|
}));
|
|
7810
|
-
subscriptions.push(
|
|
7811
|
-
subscriptions.push(
|
|
7812
|
-
subscriptions.push(
|
|
7813
|
-
subscriptions.push(
|
|
7814
|
-
subscriptions.push(
|
|
7815
|
-
subscriptions.push(
|
|
7919
|
+
subscriptions.push(import_coc15.listManager.registerList(new gstatus_default(nvim, manager)));
|
|
7920
|
+
subscriptions.push(import_coc15.listManager.registerList(new branches_default(nvim, manager)));
|
|
7921
|
+
subscriptions.push(import_coc15.listManager.registerList(new commits_default(nvim, manager)));
|
|
7922
|
+
subscriptions.push(import_coc15.listManager.registerList(new bcommits_default(nvim, manager)));
|
|
7923
|
+
subscriptions.push(import_coc15.listManager.registerList(new gfiles_default(nvim, manager)));
|
|
7924
|
+
subscriptions.push(import_coc15.listManager.registerList(new gchunks_default(nvim, manager)));
|
|
7925
|
+
subscriptions.push(import_coc15.languages.registerCompletionItemProvider("semantic-commit", "Commit", config.get("semanticCommit.filetypes"), {
|
|
7816
7926
|
provideCompletionItems: async (document, position) => {
|
|
7817
7927
|
if (position.line !== 0) {
|
|
7818
7928
|
return [];
|
|
7819
7929
|
}
|
|
7820
|
-
const text = document.getText(
|
|
7930
|
+
const text = document.getText(import_coc15.Range.create(import_coc15.Position.create(position.line, 0), position));
|
|
7821
7931
|
if (/^[a-z]*$/.test(text)) {
|
|
7822
7932
|
const scope = config.get("semanticCommit.scope");
|
|
7823
7933
|
const text2 = scope ? "(${1:scope}): ${2:commit}" : ": ${1:commit}";
|
|
7824
7934
|
return DEFAULT_TYPES.map((o) => {
|
|
7825
7935
|
return {
|
|
7826
7936
|
label: o.value,
|
|
7827
|
-
kind:
|
|
7937
|
+
kind: import_coc15.CompletionItemKind.Snippet,
|
|
7828
7938
|
documentation: {kind: "plaintext", value: o.name},
|
|
7829
|
-
insertTextFormat:
|
|
7939
|
+
insertTextFormat: import_coc15.InsertTextFormat.Snippet,
|
|
7830
7940
|
insertText: o.value + text2 + "\n\n"
|
|
7831
7941
|
};
|
|
7832
7942
|
});
|
|
@@ -7834,13 +7944,13 @@ async function activate(context) {
|
|
|
7834
7944
|
return [];
|
|
7835
7945
|
}
|
|
7836
7946
|
}));
|
|
7837
|
-
subscriptions.push(
|
|
7947
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["o", "x"], "git-chunk-inner", async () => {
|
|
7838
7948
|
let diff = await manager.getCurrentChunk();
|
|
7839
7949
|
if (!diff)
|
|
7840
7950
|
return;
|
|
7841
7951
|
await nvim.command(`normal! ${diff.start}GV${diff.end}G`);
|
|
7842
7952
|
}, {sync: true, silent: true}));
|
|
7843
|
-
subscriptions.push(
|
|
7953
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["o", "x"], "git-chunk-outer", async () => {
|
|
7844
7954
|
let diff = await manager.getCurrentChunk();
|
|
7845
7955
|
if (!diff)
|
|
7846
7956
|
return;
|