coc-git 2.4.11 → 2.5.0
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 +319 -213
- package/package.json +6 -1
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,9 @@ var DocumentManager = class {
|
|
|
5774
5848
|
currentHlGroup: config.get("conflict.current.hlGroup", "DiffChange"),
|
|
5775
5849
|
incomingHlGroup: config.get("conflict.incoming.hlGroup", "DiffAdd")
|
|
5776
5850
|
},
|
|
5851
|
+
gstatus: {
|
|
5852
|
+
saveBeforeOpen: config.get("gstatus.saveBeforeOpen", false)
|
|
5853
|
+
},
|
|
5777
5854
|
virtualTextSrcId: this.virtualTextSrcId,
|
|
5778
5855
|
conflictSrcId: this.conflictSrcId
|
|
5779
5856
|
};
|
|
@@ -5782,12 +5859,15 @@ var DocumentManager = class {
|
|
|
5782
5859
|
get enableGutters() {
|
|
5783
5860
|
return this.config.enableGutters;
|
|
5784
5861
|
}
|
|
5862
|
+
get gstatusSaveBeforeOpen() {
|
|
5863
|
+
return this.config.gstatus.saveBeforeOpen;
|
|
5864
|
+
}
|
|
5785
5865
|
get git() {
|
|
5786
5866
|
return this.service.git;
|
|
5787
5867
|
}
|
|
5788
5868
|
async toggleGutters() {
|
|
5789
5869
|
let enabled = this.enableGutters;
|
|
5790
|
-
let config =
|
|
5870
|
+
let config = import_coc9.workspace.getConfiguration("git");
|
|
5791
5871
|
config.update("enableGutters", !enabled, true);
|
|
5792
5872
|
for (let buf of this.buffers.values()) {
|
|
5793
5873
|
await buf.toggleGutters(!enabled);
|
|
@@ -5799,7 +5879,7 @@ var DocumentManager = class {
|
|
|
5799
5879
|
await buf.toggleFold();
|
|
5800
5880
|
}
|
|
5801
5881
|
async resolveGitRootFromBufferOrCwd(bufnr) {
|
|
5802
|
-
let doc =
|
|
5882
|
+
let doc = import_coc9.workspace.getDocument(bufnr);
|
|
5803
5883
|
let root;
|
|
5804
5884
|
let {resolver} = this.service;
|
|
5805
5885
|
if (doc) {
|
|
@@ -5901,36 +5981,36 @@ var DocumentManager = class {
|
|
|
5901
5981
|
}
|
|
5902
5982
|
}
|
|
5903
5983
|
async push(args) {
|
|
5904
|
-
let bufnr = await
|
|
5984
|
+
let bufnr = await import_coc9.workspace.nvim.call("bufnr", "%");
|
|
5905
5985
|
let root = await this.resolveGitRootFromBufferOrCwd(bufnr);
|
|
5906
5986
|
let extra = this.config.pushArguments;
|
|
5907
5987
|
if (!root) {
|
|
5908
|
-
|
|
5988
|
+
import_coc9.window.showMessage(`not belongs to git repository.`, "warning");
|
|
5909
5989
|
return;
|
|
5910
5990
|
}
|
|
5911
5991
|
if (args && args.length) {
|
|
5912
|
-
await
|
|
5992
|
+
await import_coc9.window.runTerminalCommand(`git push ${[...args, ...extra].join(" ")}`, root, true);
|
|
5913
5993
|
return;
|
|
5914
5994
|
}
|
|
5915
5995
|
let repo = this.service.getRepoFromRoot(root);
|
|
5916
5996
|
let output = await repo.safeRun(["remote"]);
|
|
5917
5997
|
let remote = output.trim().split(/\r?\n/)[0];
|
|
5918
5998
|
if (!remote) {
|
|
5919
|
-
|
|
5999
|
+
import_coc9.window.showMessage(`remote not found`, "warning");
|
|
5920
6000
|
return;
|
|
5921
6001
|
}
|
|
5922
6002
|
output = await repo.safeRun(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
5923
6003
|
if (!output) {
|
|
5924
|
-
|
|
6004
|
+
import_coc9.window.showMessage(`current branch not found`, "warning");
|
|
5925
6005
|
return;
|
|
5926
6006
|
}
|
|
5927
|
-
await
|
|
6007
|
+
await import_coc9.window.runTerminalCommand(`git push ${remote} ${output}${extra.length ? " " + extra.join(" ") : ""}`, root, true);
|
|
5928
6008
|
}
|
|
5929
6009
|
get buffer() {
|
|
5930
|
-
return
|
|
6010
|
+
return import_coc9.workspace.nvim.call("bufnr", "%").then((bufnr) => {
|
|
5931
6011
|
let buf = this.buffers.get(bufnr);
|
|
5932
6012
|
if (!buf)
|
|
5933
|
-
|
|
6013
|
+
import_coc9.window.showMessage(`Cant't resolve git repository for current buffer.`, "warning");
|
|
5934
6014
|
return buf;
|
|
5935
6015
|
});
|
|
5936
6016
|
}
|
|
@@ -5944,13 +6024,13 @@ var DocumentManager = class {
|
|
|
5944
6024
|
buf.dispose();
|
|
5945
6025
|
}
|
|
5946
6026
|
this.buffers.clear();
|
|
5947
|
-
|
|
6027
|
+
import_coc9.disposeAll(this.disposables);
|
|
5948
6028
|
}
|
|
5949
6029
|
};
|
|
5950
6030
|
var manager_default = DocumentManager;
|
|
5951
6031
|
|
|
5952
6032
|
// src/model/service.ts
|
|
5953
|
-
var
|
|
6033
|
+
var import_coc13 = __toModule(require("coc.nvim"));
|
|
5954
6034
|
|
|
5955
6035
|
// src/model/repo.ts
|
|
5956
6036
|
var import_fs2 = __toModule(require("fs"));
|
|
@@ -6223,7 +6303,7 @@ function parseDiff(diffStr) {
|
|
|
6223
6303
|
|
|
6224
6304
|
// src/model/git.ts
|
|
6225
6305
|
var cp = __toModule(require("child_process"));
|
|
6226
|
-
var
|
|
6306
|
+
var import_coc10 = __toModule(require("coc.nvim"));
|
|
6227
6307
|
var import_iconv_lite = __toModule(require_lib());
|
|
6228
6308
|
var import_path5 = __toModule(require("path"));
|
|
6229
6309
|
var Git = class {
|
|
@@ -6300,11 +6380,11 @@ async function exec2(child, cancellationToken) {
|
|
|
6300
6380
|
const disposables = [];
|
|
6301
6381
|
const once = (ee, name, fn) => {
|
|
6302
6382
|
ee.once(name, fn);
|
|
6303
|
-
disposables.push(
|
|
6383
|
+
disposables.push(import_coc10.Disposable.create(() => ee.removeListener(name, fn)));
|
|
6304
6384
|
};
|
|
6305
6385
|
const on = (ee, name, fn) => {
|
|
6306
6386
|
ee.on(name, fn);
|
|
6307
|
-
disposables.push(
|
|
6387
|
+
disposables.push(import_coc10.Disposable.create(() => ee.removeListener(name, fn)));
|
|
6308
6388
|
};
|
|
6309
6389
|
let result = Promise.all([
|
|
6310
6390
|
new Promise((c, e) => {
|
|
@@ -6338,12 +6418,12 @@ async function exec2(child, cancellationToken) {
|
|
|
6338
6418
|
const [exitCode, stdout, stderr] = await result;
|
|
6339
6419
|
return {exitCode, stdout, stderr};
|
|
6340
6420
|
} finally {
|
|
6341
|
-
|
|
6421
|
+
import_coc10.disposeAll(disposables);
|
|
6342
6422
|
}
|
|
6343
6423
|
}
|
|
6344
6424
|
|
|
6345
6425
|
// src/model/resolver.ts
|
|
6346
|
-
var
|
|
6426
|
+
var import_coc11 = __toModule(require("coc.nvim"));
|
|
6347
6427
|
var import_fs3 = __toModule(require("fs"));
|
|
6348
6428
|
var import_path6 = __toModule(require("path"));
|
|
6349
6429
|
var import_util9 = __toModule(require("util"));
|
|
@@ -6354,7 +6434,7 @@ async function getRealPath(fullpath) {
|
|
|
6354
6434
|
} catch (e) {
|
|
6355
6435
|
if (e.message.includes("ENOENT")) {
|
|
6356
6436
|
try {
|
|
6357
|
-
resolved = await
|
|
6437
|
+
resolved = await import_coc11.workspace.nvim.call("expand", [fullpath]);
|
|
6358
6438
|
} catch (e2) {
|
|
6359
6439
|
}
|
|
6360
6440
|
}
|
|
@@ -6395,7 +6475,7 @@ var Resolver = class {
|
|
|
6395
6475
|
if (doc.buftype != "" || doc.schema != "file") {
|
|
6396
6476
|
return null;
|
|
6397
6477
|
}
|
|
6398
|
-
let fullpath = await getRealPath(
|
|
6478
|
+
let fullpath = await getRealPath(import_coc11.Uri.parse(uri).fsPath);
|
|
6399
6479
|
if (process.platform == "win32") {
|
|
6400
6480
|
fullpath = import_path6.default.win32.normalize(fullpath);
|
|
6401
6481
|
}
|
|
@@ -6424,12 +6504,12 @@ var Resolver = class {
|
|
|
6424
6504
|
return root;
|
|
6425
6505
|
}
|
|
6426
6506
|
async resolveRootFromCwd() {
|
|
6427
|
-
let parts =
|
|
6507
|
+
let parts = import_coc11.workspace.cwd.split(import_path6.default.sep);
|
|
6428
6508
|
let idx = parts.indexOf(".git");
|
|
6429
6509
|
if (idx !== -1)
|
|
6430
6510
|
return parts.slice(0, idx).join(import_path6.default.sep);
|
|
6431
6511
|
try {
|
|
6432
|
-
return await this.git.getRepositoryRoot(
|
|
6512
|
+
return await this.git.getRepositoryRoot(import_coc11.workspace.cwd);
|
|
6433
6513
|
} catch (e) {
|
|
6434
6514
|
}
|
|
6435
6515
|
return null;
|
|
@@ -6442,7 +6522,7 @@ var Resolver = class {
|
|
|
6442
6522
|
var resolver_default = Resolver;
|
|
6443
6523
|
|
|
6444
6524
|
// src/model/buffer.ts
|
|
6445
|
-
var
|
|
6525
|
+
var import_coc12 = __toModule(require("coc.nvim"));
|
|
6446
6526
|
|
|
6447
6527
|
// node_modules/timeago.js/esm/lang/en_US.js
|
|
6448
6528
|
var EN_US = ["second", "minute", "hour", "day", "week", "month", "year"];
|
|
@@ -6540,7 +6620,7 @@ var GitBuffer = class {
|
|
|
6540
6620
|
this.hasConflicts = false;
|
|
6541
6621
|
this.foldEnabled = false;
|
|
6542
6622
|
this._disposed = false;
|
|
6543
|
-
this.mutex = new
|
|
6623
|
+
this.mutex = new import_coc12.Mutex();
|
|
6544
6624
|
this.refresh = import_debounce2.default(() => {
|
|
6545
6625
|
this._refresh().catch((e) => {
|
|
6546
6626
|
channel.append(`[Error] ${e.message}`);
|
|
@@ -6585,7 +6665,7 @@ var GitBuffer = class {
|
|
|
6585
6665
|
});
|
|
6586
6666
|
}
|
|
6587
6667
|
async chunkUndo() {
|
|
6588
|
-
let line = await
|
|
6668
|
+
let line = await import_coc12.workspace.nvim.call("line", ".");
|
|
6589
6669
|
let diff = this.getChunk(line);
|
|
6590
6670
|
if (!diff)
|
|
6591
6671
|
return;
|
|
@@ -6605,10 +6685,10 @@ var GitBuffer = class {
|
|
|
6605
6685
|
}
|
|
6606
6686
|
async chunkStage() {
|
|
6607
6687
|
let relpath = toUnixSlash(this.relpath);
|
|
6608
|
-
let line = await
|
|
6688
|
+
let line = await import_coc12.workspace.nvim.call("line", ".");
|
|
6609
6689
|
let diff = this.getChunk(line);
|
|
6610
6690
|
if (!diff) {
|
|
6611
|
-
|
|
6691
|
+
import_coc12.window.showMessage("Not positioned in git chunk", "error");
|
|
6612
6692
|
return;
|
|
6613
6693
|
}
|
|
6614
6694
|
let head;
|
|
@@ -6636,7 +6716,7 @@ var GitBuffer = class {
|
|
|
6636
6716
|
}
|
|
6637
6717
|
}
|
|
6638
6718
|
async chunkUnstage() {
|
|
6639
|
-
let {nvim} =
|
|
6719
|
+
let {nvim} = import_coc12.workspace;
|
|
6640
6720
|
const {diffs} = this;
|
|
6641
6721
|
let line = await nvim.call("line", ".");
|
|
6642
6722
|
let adjust = 0;
|
|
@@ -6644,7 +6724,7 @@ var GitBuffer = class {
|
|
|
6644
6724
|
for (let diff of diffs) {
|
|
6645
6725
|
if (diff.end >= line) {
|
|
6646
6726
|
if (diff.start <= line && diff.changeType != ChangeType.Delete) {
|
|
6647
|
-
|
|
6727
|
+
import_coc12.window.showErrorMessage(`Current line contains unstaged change.`);
|
|
6648
6728
|
invalid = true;
|
|
6649
6729
|
}
|
|
6650
6730
|
break;
|
|
@@ -6658,12 +6738,12 @@ var GitBuffer = class {
|
|
|
6658
6738
|
let stagedDiff = await this.repo.getStagedChunks(this.relpath);
|
|
6659
6739
|
let chunks = Object.values(stagedDiff)[0];
|
|
6660
6740
|
if (!chunks.length) {
|
|
6661
|
-
|
|
6741
|
+
import_coc12.window.showErrorMessage(`Staged chunk not found`);
|
|
6662
6742
|
return;
|
|
6663
6743
|
}
|
|
6664
6744
|
let chunk = chunks.find((o) => o.add.lnum <= line && o.add.lnum + o.add.count >= line);
|
|
6665
6745
|
if (!chunk) {
|
|
6666
|
-
|
|
6746
|
+
import_coc12.window.showErrorMessage(`Unable to find staged chunk on current line`);
|
|
6667
6747
|
return;
|
|
6668
6748
|
}
|
|
6669
6749
|
this.channel.appendLine(`[Info] resolved chunk ${JSON.stringify(chunk, null, 2)}`);
|
|
@@ -6674,52 +6754,77 @@ var GitBuffer = class {
|
|
|
6674
6754
|
await this.git.exec(this.repo.root, ["apply", "--cached", "--unidiff-zero", "-"], {input: patch});
|
|
6675
6755
|
this.refresh();
|
|
6676
6756
|
} catch (e) {
|
|
6677
|
-
|
|
6757
|
+
import_coc12.window.showErrorMessage(`Unable to apply patch: ${e.message}`);
|
|
6678
6758
|
this.channel.appendLine(`[Error] ${e.message}`);
|
|
6679
6759
|
}
|
|
6680
6760
|
}
|
|
6681
6761
|
async nextChunk() {
|
|
6682
6762
|
const {diffs} = this;
|
|
6683
|
-
let {nvim} =
|
|
6763
|
+
let {nvim} = import_coc12.workspace;
|
|
6684
6764
|
if (!diffs || diffs.length == 0)
|
|
6685
6765
|
return;
|
|
6686
6766
|
let line = await nvim.call("line", ".");
|
|
6687
6767
|
for (let diff of diffs) {
|
|
6688
6768
|
if (diff.start > line) {
|
|
6689
|
-
await
|
|
6769
|
+
await import_coc12.window.moveTo({line: Math.max(diff.start - 1, 0), character: 0});
|
|
6690
6770
|
return;
|
|
6691
6771
|
}
|
|
6692
6772
|
}
|
|
6693
6773
|
if (await nvim.getOption("wrapscan")) {
|
|
6694
|
-
await
|
|
6774
|
+
await import_coc12.window.moveTo({line: Math.max(diffs[0].start - 1, 0), character: 0});
|
|
6695
6775
|
}
|
|
6696
6776
|
}
|
|
6697
6777
|
async prevChunk() {
|
|
6698
|
-
const {nvim} =
|
|
6778
|
+
const {nvim} = import_coc12.workspace;
|
|
6699
6779
|
let {diffs} = this;
|
|
6700
6780
|
let line = await nvim.call("line", ".");
|
|
6701
6781
|
if (!diffs || diffs.length == 0)
|
|
6702
6782
|
return;
|
|
6703
6783
|
for (let diff of diffs.slice().reverse()) {
|
|
6704
6784
|
if (diff.end < line) {
|
|
6705
|
-
await
|
|
6785
|
+
await import_coc12.window.moveTo({line: Math.max(diff.start - 1, 0), character: 0});
|
|
6706
6786
|
return;
|
|
6707
6787
|
}
|
|
6708
6788
|
}
|
|
6709
6789
|
if (await nvim.getOption("wrapscan")) {
|
|
6710
|
-
await
|
|
6790
|
+
await import_coc12.window.moveTo({line: Math.max(diffs[diffs.length - 1].start - 1, 0), character: 0});
|
|
6711
6791
|
}
|
|
6712
6792
|
}
|
|
6713
6793
|
async chunkInfo() {
|
|
6714
|
-
let line = await
|
|
6794
|
+
let line = await import_coc12.workspace.nvim.call("line", ".");
|
|
6715
6795
|
let diff = this.getChunk(line);
|
|
6716
6796
|
if (diff) {
|
|
6717
6797
|
let content = diff.head + "\n" + diff.lines.join("\n");
|
|
6718
6798
|
await this.showDoc(content, "diff");
|
|
6799
|
+
} else {
|
|
6800
|
+
let chunks;
|
|
6801
|
+
try {
|
|
6802
|
+
let stagedDiff = await this.repo.getStagedChunks(this.relpath);
|
|
6803
|
+
chunks = Object.values(stagedDiff)[0];
|
|
6804
|
+
} catch (e) {
|
|
6805
|
+
return;
|
|
6806
|
+
}
|
|
6807
|
+
if (!chunks.length) {
|
|
6808
|
+
return;
|
|
6809
|
+
}
|
|
6810
|
+
let adjust = 0;
|
|
6811
|
+
for (let diff2 of this.diffs) {
|
|
6812
|
+
if (diff2.end >= line) {
|
|
6813
|
+
break;
|
|
6814
|
+
}
|
|
6815
|
+
adjust -= diff2.added.count;
|
|
6816
|
+
adjust += diff2.removed.count;
|
|
6817
|
+
}
|
|
6818
|
+
line = line + adjust;
|
|
6819
|
+
let chunk = chunks.find((o) => o.add.lnum <= line && o.add.lnum + o.add.count >= line);
|
|
6820
|
+
if (chunk) {
|
|
6821
|
+
let content = "Staged chagnes\n" + chunk.lines.join("\n");
|
|
6822
|
+
await this.showDoc(content, "diff");
|
|
6823
|
+
}
|
|
6719
6824
|
}
|
|
6720
6825
|
}
|
|
6721
6826
|
async showBlameInfo(lnum) {
|
|
6722
|
-
let {nvim} =
|
|
6827
|
+
let {nvim} = import_coc12.workspace;
|
|
6723
6828
|
let {virtualTextSrcId, addGBlameToBufferVar, addGBlameToVirtualText} = this.config;
|
|
6724
6829
|
if (!this.showBlame)
|
|
6725
6830
|
return;
|
|
@@ -6751,7 +6856,7 @@ var GitBuffer = class {
|
|
|
6751
6856
|
if (addGBlameToVirtualText) {
|
|
6752
6857
|
const prefix = this.config.virtualTextPrefix;
|
|
6753
6858
|
await buffer.clearNamespace(virtualTextSrcId);
|
|
6754
|
-
if (
|
|
6859
|
+
if (import_coc12.workspace.has("nvim-0.6.0")) {
|
|
6755
6860
|
await buffer.setExtMark(virtualTextSrcId, lnum - 1, 0, {
|
|
6756
6861
|
hl_mode: "combine",
|
|
6757
6862
|
virt_text: [[prefix + blameText, "CocCodeLens"]]
|
|
@@ -6765,7 +6870,7 @@ var GitBuffer = class {
|
|
|
6765
6870
|
async showBlameDoc(lnum) {
|
|
6766
6871
|
let indexed = await this.repo.isIndexed(this.relpath);
|
|
6767
6872
|
if (!indexed) {
|
|
6768
|
-
|
|
6873
|
+
import_coc12.window.showMessage("File not indexed");
|
|
6769
6874
|
} else {
|
|
6770
6875
|
let infos = await this.getBlameInfo();
|
|
6771
6876
|
let info = infos.find((o) => lnum >= o.startLnum && lnum <= o.endLnum);
|
|
@@ -6776,13 +6881,13 @@ var GitBuffer = class {
|
|
|
6776
6881
|
blameText.push(`${info.sha.substring(0, 7)}`);
|
|
6777
6882
|
await this.showDoc(blameText.join("\n\n"), "text");
|
|
6778
6883
|
} else {
|
|
6779
|
-
|
|
6884
|
+
import_coc12.window.showMessage("Not committed yet");
|
|
6780
6885
|
}
|
|
6781
6886
|
}
|
|
6782
6887
|
}
|
|
6783
6888
|
async diffDocument(force = false) {
|
|
6784
6889
|
var _a;
|
|
6785
|
-
let {nvim} =
|
|
6890
|
+
let {nvim} = import_coc12.workspace;
|
|
6786
6891
|
let revision = this.config.diffRevision;
|
|
6787
6892
|
const {bufnr} = this.doc;
|
|
6788
6893
|
const diffs = await this.repo.getDiff(this.relpath, this.doc.content, revision);
|
|
@@ -6861,7 +6966,7 @@ var GitBuffer = class {
|
|
|
6861
6966
|
return;
|
|
6862
6967
|
if (!this.config.enableGutters)
|
|
6863
6968
|
return;
|
|
6864
|
-
let {nvim} =
|
|
6969
|
+
let {nvim} = import_coc12.workspace;
|
|
6865
6970
|
let {bufnr} = this.doc;
|
|
6866
6971
|
let {signPriority} = this.config;
|
|
6867
6972
|
let signs = this.currentSigns;
|
|
@@ -6934,10 +7039,10 @@ var GitBuffer = class {
|
|
|
6934
7039
|
async diffCached() {
|
|
6935
7040
|
let res = await this.repo.safeRun(["diff", "--cached"]);
|
|
6936
7041
|
if (!res.trim()) {
|
|
6937
|
-
|
|
7042
|
+
import_coc12.window.showMessage("Empty diff");
|
|
6938
7043
|
return;
|
|
6939
7044
|
}
|
|
6940
|
-
let {nvim} =
|
|
7045
|
+
let {nvim} = import_coc12.workspace;
|
|
6941
7046
|
nvim.pauseNotification();
|
|
6942
7047
|
nvim.command(`keepalt above new +setl\\ previewwindow`, true);
|
|
6943
7048
|
nvim.call("append", [0, res.split(/\r?\n/)], true);
|
|
@@ -6948,44 +7053,44 @@ var GitBuffer = class {
|
|
|
6948
7053
|
await nvim.resumeNotification();
|
|
6949
7054
|
}
|
|
6950
7055
|
async nextConflict() {
|
|
6951
|
-
let {nvim} =
|
|
7056
|
+
let {nvim} = import_coc12.workspace;
|
|
6952
7057
|
if (!this.conflicts.length) {
|
|
6953
|
-
|
|
7058
|
+
import_coc12.window.showMessage("No conflicts detected", "warning");
|
|
6954
7059
|
return;
|
|
6955
7060
|
}
|
|
6956
7061
|
let line = await nvim.call("line", ".");
|
|
6957
7062
|
for (let conflict of this.conflicts) {
|
|
6958
7063
|
if (conflict.start > line) {
|
|
6959
|
-
await
|
|
7064
|
+
await import_coc12.window.moveTo({line: Math.max(conflict.start - 1, 0), character: 0});
|
|
6960
7065
|
return;
|
|
6961
7066
|
}
|
|
6962
7067
|
}
|
|
6963
7068
|
if (await nvim.getOption("wrapscan")) {
|
|
6964
|
-
await
|
|
7069
|
+
await import_coc12.window.moveTo({line: Math.max(this.conflicts[0].start - 1, 0), character: 0});
|
|
6965
7070
|
}
|
|
6966
7071
|
}
|
|
6967
7072
|
async prevConflict() {
|
|
6968
|
-
let {nvim} =
|
|
7073
|
+
let {nvim} = import_coc12.workspace;
|
|
6969
7074
|
if (!this.conflicts.length) {
|
|
6970
|
-
|
|
7075
|
+
import_coc12.window.showMessage("No conflicts detected", "warning");
|
|
6971
7076
|
return;
|
|
6972
7077
|
}
|
|
6973
7078
|
let line = await nvim.call("line", ".");
|
|
6974
7079
|
for (let conflict of this.conflicts) {
|
|
6975
7080
|
if (conflict.start > line) {
|
|
6976
|
-
await
|
|
7081
|
+
await import_coc12.window.moveTo({line: Math.max(conflict.start - 1, 0), character: 0});
|
|
6977
7082
|
return;
|
|
6978
7083
|
}
|
|
6979
7084
|
}
|
|
6980
7085
|
if (await nvim.getOption("wrapscan")) {
|
|
6981
|
-
await
|
|
7086
|
+
await import_coc12.window.moveTo({line: Math.max(this.conflicts[0].start - 1, 0), character: 0});
|
|
6982
7087
|
}
|
|
6983
7088
|
}
|
|
6984
7089
|
async conflictKeepPart(part) {
|
|
6985
|
-
const {nvim} =
|
|
7090
|
+
const {nvim} = import_coc12.workspace;
|
|
6986
7091
|
let conflicts = this.conflicts;
|
|
6987
7092
|
if (!conflicts || conflicts.length == 0) {
|
|
6988
|
-
|
|
7093
|
+
import_coc12.window.showMessage("No conflicts detected");
|
|
6989
7094
|
return;
|
|
6990
7095
|
}
|
|
6991
7096
|
let line = await nvim.call("line", ".");
|
|
@@ -7005,11 +7110,11 @@ var GitBuffer = class {
|
|
|
7005
7110
|
}
|
|
7006
7111
|
}
|
|
7007
7112
|
}
|
|
7008
|
-
|
|
7113
|
+
import_coc12.window.showMessage("Not positioned on a conflict");
|
|
7009
7114
|
}
|
|
7010
7115
|
async browser(action = "open", range, permalink = false) {
|
|
7011
|
-
let {nvim} =
|
|
7012
|
-
let config =
|
|
7116
|
+
let {nvim} = import_coc12.workspace;
|
|
7117
|
+
let config = import_coc12.workspace.getConfiguration("git");
|
|
7013
7118
|
let head = (await this.repo.safeRun(["rev-parse", "HEAD"])).trim();
|
|
7014
7119
|
let branch = config.get("browserBranchName", "").trim();
|
|
7015
7120
|
if (!branch.length) {
|
|
@@ -7028,7 +7133,7 @@ var GitBuffer = class {
|
|
|
7028
7133
|
}
|
|
7029
7134
|
let output = await this.repo.safeRun(["remote"]);
|
|
7030
7135
|
if (!output.trim()) {
|
|
7031
|
-
|
|
7136
|
+
import_coc12.window.showMessage(`No remote found`, "warning");
|
|
7032
7137
|
return;
|
|
7033
7138
|
}
|
|
7034
7139
|
let names = output.trim().split(/\r?\n/);
|
|
@@ -7037,7 +7142,7 @@ var GitBuffer = class {
|
|
|
7037
7142
|
if (names.includes(browserRemoteName)) {
|
|
7038
7143
|
names = [browserRemoteName];
|
|
7039
7144
|
} else {
|
|
7040
|
-
|
|
7145
|
+
import_coc12.window.showMessage("Configured git.browserRemoteName missing from remote list", "warning");
|
|
7041
7146
|
return;
|
|
7042
7147
|
}
|
|
7043
7148
|
}
|
|
@@ -7060,19 +7165,19 @@ var GitBuffer = class {
|
|
|
7060
7165
|
}
|
|
7061
7166
|
if (urls.length == 1) {
|
|
7062
7167
|
if (action == "open") {
|
|
7063
|
-
await
|
|
7168
|
+
await import_coc12.workspace.openResource(urls[0]);
|
|
7064
7169
|
} else {
|
|
7065
7170
|
nvim.command(`let @+ = '${urls[0]}'`, true);
|
|
7066
|
-
|
|
7171
|
+
import_coc12.window.showMessage("Copied url to clipboard");
|
|
7067
7172
|
}
|
|
7068
7173
|
} else if (urls.length > 1) {
|
|
7069
|
-
let idx = await
|
|
7174
|
+
let idx = await import_coc12.window.showQuickpick(urls, "Select url:");
|
|
7070
7175
|
if (idx >= 0) {
|
|
7071
7176
|
if (action == "open") {
|
|
7072
|
-
await
|
|
7177
|
+
await import_coc12.workspace.openResource(urls[idx]);
|
|
7073
7178
|
} else {
|
|
7074
7179
|
nvim.command(`let @+ = '${urls[idx]}'`, true);
|
|
7075
|
-
|
|
7180
|
+
import_coc12.window.showMessage("Copied url to clipboard");
|
|
7076
7181
|
}
|
|
7077
7182
|
}
|
|
7078
7183
|
}
|
|
@@ -7080,10 +7185,10 @@ var GitBuffer = class {
|
|
|
7080
7185
|
async showCommit() {
|
|
7081
7186
|
let indexed = await this.repo.isIndexed(this.relpath);
|
|
7082
7187
|
if (!indexed) {
|
|
7083
|
-
|
|
7188
|
+
import_coc12.window.showMessage(`"${this.relpath}" not indexed.`, "warning");
|
|
7084
7189
|
return;
|
|
7085
7190
|
}
|
|
7086
|
-
let nvim =
|
|
7191
|
+
let nvim = import_coc12.workspace.nvim;
|
|
7087
7192
|
let line = await nvim.eval('line(".")');
|
|
7088
7193
|
let args = ["--no-pager", "blame", "-l", "--root", "-t", `-L${line},${line}`, this.relpath];
|
|
7089
7194
|
let res = await this.repo.exec(args);
|
|
@@ -7092,7 +7197,7 @@ var GitBuffer = class {
|
|
|
7092
7197
|
return;
|
|
7093
7198
|
let commit = output.match(/^\S+/)[0];
|
|
7094
7199
|
if (/^0+$/.test(commit)) {
|
|
7095
|
-
|
|
7200
|
+
import_coc12.window.showMessage("not committed yet!", "warning");
|
|
7096
7201
|
return;
|
|
7097
7202
|
}
|
|
7098
7203
|
let useFloating = this.config.showCommitInFloating;
|
|
@@ -7123,16 +7228,16 @@ var GitBuffer = class {
|
|
|
7123
7228
|
}
|
|
7124
7229
|
}
|
|
7125
7230
|
async toggleFold() {
|
|
7126
|
-
let {nvim} =
|
|
7231
|
+
let {nvim} = import_coc12.workspace;
|
|
7127
7232
|
let buf = this.doc.buffer;
|
|
7128
7233
|
let win = await nvim.window;
|
|
7129
7234
|
let bufnr = buf.id;
|
|
7130
|
-
let doc =
|
|
7235
|
+
let doc = import_coc12.workspace.getDocument(bufnr);
|
|
7131
7236
|
if (!doc)
|
|
7132
7237
|
return;
|
|
7133
7238
|
let infos = this.currentSigns;
|
|
7134
7239
|
if (!infos || infos.length == 0) {
|
|
7135
|
-
|
|
7240
|
+
import_coc12.window.showMessage("No changes", "warning");
|
|
7136
7241
|
return;
|
|
7137
7242
|
}
|
|
7138
7243
|
let lnums = infos.map((o) => o.lnum);
|
|
@@ -7190,7 +7295,7 @@ var GitBuffer = class {
|
|
|
7190
7295
|
}
|
|
7191
7296
|
async toggleGutters(enabled) {
|
|
7192
7297
|
this.config.enableGutters = enabled;
|
|
7193
|
-
let {nvim} =
|
|
7298
|
+
let {nvim} = import_coc12.workspace;
|
|
7194
7299
|
if (!enabled) {
|
|
7195
7300
|
nvim.call("sign_unplace", [signGroup, {buffer: this.doc.bufnr}], true);
|
|
7196
7301
|
} else {
|
|
@@ -7275,7 +7380,7 @@ var GitBuffer = class {
|
|
|
7275
7380
|
let buffer = this.doc.buffer;
|
|
7276
7381
|
let currentHlGroup = this.config.conflict.currentHlGroup;
|
|
7277
7382
|
let incomingHlGroup = this.config.conflict.incomingHlGroup;
|
|
7278
|
-
let {nvim} =
|
|
7383
|
+
let {nvim} = import_coc12.workspace;
|
|
7279
7384
|
nvim.pauseNotification();
|
|
7280
7385
|
buffer.clearNamespace(this.config.conflictSrcId, 0, -1);
|
|
7281
7386
|
conflicts.map((conflict) => {
|
|
@@ -7296,12 +7401,12 @@ var GitBuffer = class {
|
|
|
7296
7401
|
nvim.resumeNotification(false, true);
|
|
7297
7402
|
}
|
|
7298
7403
|
async showDoc(content, filetype = "diff") {
|
|
7299
|
-
if (
|
|
7404
|
+
if (import_coc12.workspace.floatSupported) {
|
|
7300
7405
|
let docs = [{content, filetype}];
|
|
7301
7406
|
await this.floatFactory.show(docs);
|
|
7302
7407
|
} else {
|
|
7303
7408
|
const lines = content.split("\n");
|
|
7304
|
-
|
|
7409
|
+
import_coc12.workspace.nvim.call("coc#util#preview_info", [lines, "diff"], true);
|
|
7305
7410
|
}
|
|
7306
7411
|
}
|
|
7307
7412
|
setBufferStatus(status) {
|
|
@@ -7309,7 +7414,7 @@ var GitBuffer = class {
|
|
|
7309
7414
|
if (exists == status)
|
|
7310
7415
|
return;
|
|
7311
7416
|
this.gitStatus = status;
|
|
7312
|
-
let {nvim} =
|
|
7417
|
+
let {nvim} = import_coc12.workspace;
|
|
7313
7418
|
let buffer = nvim.createBuffer(this.doc.bufnr);
|
|
7314
7419
|
nvim.pauseNotification();
|
|
7315
7420
|
buffer.setVar("coc_git_status", status, true);
|
|
@@ -7335,7 +7440,7 @@ var GitBuffer = class {
|
|
|
7335
7440
|
return this.config.addGBlameToVirtualText || this.config.addGBlameToBufferVar;
|
|
7336
7441
|
}
|
|
7337
7442
|
dispose() {
|
|
7338
|
-
let {nvim} =
|
|
7443
|
+
let {nvim} = import_coc12.workspace;
|
|
7339
7444
|
let {bufnr} = this.doc;
|
|
7340
7445
|
let buffer = nvim.createBuffer(bufnr);
|
|
7341
7446
|
buffer.setVar("coc_git_status", "", true);
|
|
@@ -7363,10 +7468,10 @@ var import_path7 = __toModule(require("path"));
|
|
|
7363
7468
|
var GitService = class {
|
|
7364
7469
|
constructor(gitInfo) {
|
|
7365
7470
|
this.repos = new Map();
|
|
7366
|
-
const outputChannel = this.outputChannel =
|
|
7471
|
+
const outputChannel = this.outputChannel = import_coc13.window.createOutputChannel("git");
|
|
7367
7472
|
this._git = new git_default(gitInfo, outputChannel);
|
|
7368
7473
|
this._resolver = new resolver_default(this._git, outputChannel);
|
|
7369
|
-
this.floatFactory = new
|
|
7474
|
+
this.floatFactory = new import_coc13.FloatFactory(import_coc13.workspace.nvim);
|
|
7370
7475
|
}
|
|
7371
7476
|
getRepoFromRoot(root) {
|
|
7372
7477
|
if (this.repos.has(root)) {
|
|
@@ -7392,11 +7497,11 @@ var GitService = class {
|
|
|
7392
7497
|
return new buffer_default(doc, config, relpath, repo, this.git, this.outputChannel, this.floatFactory);
|
|
7393
7498
|
}
|
|
7394
7499
|
async getCurrentRepo() {
|
|
7395
|
-
let {nvim} =
|
|
7500
|
+
let {nvim} = import_coc13.workspace;
|
|
7396
7501
|
let [fullpath, buftype] = await nvim.eval('[expand("%:p"),&buftype]');
|
|
7397
7502
|
if (!import_path7.default.isAbsolute(fullpath) || buftype != "")
|
|
7398
7503
|
return void 0;
|
|
7399
|
-
let root = await this.resolver.resolveGitRoot({uri:
|
|
7504
|
+
let root = await this.resolver.resolveGitRoot({uri: import_coc13.Uri.file(fullpath).toString(), schema: "file", buftype: ""});
|
|
7400
7505
|
if (root == null)
|
|
7401
7506
|
return void 0;
|
|
7402
7507
|
return this.getRepoFromRoot(root);
|
|
@@ -7420,15 +7525,15 @@ var GitService = class {
|
|
|
7420
7525
|
var service_default = GitService;
|
|
7421
7526
|
|
|
7422
7527
|
// src/source.ts
|
|
7423
|
-
var
|
|
7424
|
-
var
|
|
7528
|
+
var import_coc14 = __toModule(require("coc.nvim"));
|
|
7529
|
+
var import_safe4 = __toModule(require_safe());
|
|
7425
7530
|
function byteSlice(content, start, end) {
|
|
7426
7531
|
let buf = Buffer.from(content, "utf8");
|
|
7427
7532
|
return buf.slice(start, end).toString("utf8");
|
|
7428
7533
|
}
|
|
7429
7534
|
var issuesMap = new Map();
|
|
7430
7535
|
function issuesFiletypes() {
|
|
7431
|
-
return
|
|
7536
|
+
return import_coc14.workspace.getConfiguration().get("coc.source.issues.filetypes");
|
|
7432
7537
|
}
|
|
7433
7538
|
function getOrganizationNameAndRepoNameFromGitHubRemoteUrl(remoteUrl) {
|
|
7434
7539
|
try {
|
|
@@ -7467,7 +7572,7 @@ function renderWord(issue, issueFormat) {
|
|
|
7467
7572
|
}
|
|
7468
7573
|
function addSource(context, resolver) {
|
|
7469
7574
|
let {subscriptions, logger} = context;
|
|
7470
|
-
let statusItem =
|
|
7575
|
+
let statusItem = import_coc14.window.createStatusBarItem(0, {progress: true});
|
|
7471
7576
|
statusItem.text = "loading issues";
|
|
7472
7577
|
let statusItemCounter = 0;
|
|
7473
7578
|
function onStartLoading() {
|
|
@@ -7510,7 +7615,7 @@ function addSource(context, resolver) {
|
|
|
7510
7615
|
const pageUri = `${uri}&page=${pageIndex}`;
|
|
7511
7616
|
pageIndex++;
|
|
7512
7617
|
try {
|
|
7513
|
-
let info = await
|
|
7618
|
+
let info = await import_coc14.fetch(pageUri, {headers: {"Private-Token": token}});
|
|
7514
7619
|
if (!info.length) {
|
|
7515
7620
|
break;
|
|
7516
7621
|
}
|
|
@@ -7546,7 +7651,7 @@ function addSource(context, resolver) {
|
|
|
7546
7651
|
let page_uri = `${uri}&page=${page_idx}`;
|
|
7547
7652
|
page_idx++;
|
|
7548
7653
|
try {
|
|
7549
|
-
let info = await
|
|
7654
|
+
let info = await import_coc14.fetch(page_uri, {headers});
|
|
7550
7655
|
if (info.length == 0) {
|
|
7551
7656
|
break;
|
|
7552
7657
|
}
|
|
@@ -7571,7 +7676,7 @@ function addSource(context, resolver) {
|
|
|
7571
7676
|
return issues;
|
|
7572
7677
|
}
|
|
7573
7678
|
async function loadIssues(root) {
|
|
7574
|
-
let config =
|
|
7679
|
+
let config = import_coc14.workspace.getConfiguration("git");
|
|
7575
7680
|
const issueSources = (await safeRun(`git config --get coc-git.issuesources`, {cwd: root}) || "").trim();
|
|
7576
7681
|
if (issueSources) {
|
|
7577
7682
|
return Array.prototype.concat.apply([], await Promise.all(issueSources.split(",").map((issueSource) => {
|
|
@@ -7614,14 +7719,14 @@ function addSource(context, resolver) {
|
|
|
7614
7719
|
}
|
|
7615
7720
|
}).catch(onError);
|
|
7616
7721
|
};
|
|
7617
|
-
for (let doc of
|
|
7722
|
+
for (let doc of import_coc14.workspace.documents) {
|
|
7618
7723
|
if (issuesFiletypes().includes(doc.filetype)) {
|
|
7619
7724
|
loadIssuesFromDocument(doc);
|
|
7620
7725
|
}
|
|
7621
7726
|
}
|
|
7622
|
-
|
|
7727
|
+
import_coc14.workspace.onDidOpenTextDocument(async (e) => {
|
|
7623
7728
|
if (issuesFiletypes().includes(e.languageId)) {
|
|
7624
|
-
let doc =
|
|
7729
|
+
let doc = import_coc14.workspace.getDocument(e.uri);
|
|
7625
7730
|
loadIssuesFromDocument(doc);
|
|
7626
7731
|
}
|
|
7627
7732
|
}, null, subscriptions);
|
|
@@ -7630,7 +7735,7 @@ function addSource(context, resolver) {
|
|
|
7630
7735
|
async doComplete(opt) {
|
|
7631
7736
|
let pre = byteSlice(opt.line, 0, opt.colnr - 1);
|
|
7632
7737
|
if (pre && pre.endsWith("#")) {
|
|
7633
|
-
const config =
|
|
7738
|
+
const config = import_coc14.workspace.getConfiguration("git");
|
|
7634
7739
|
const issueFormat = config.get("issueFormat", "#%i");
|
|
7635
7740
|
let issues = issuesMap.get(opt.bufnr);
|
|
7636
7741
|
if (!issues || issues.length == 0)
|
|
@@ -7656,14 +7761,14 @@ function addSource(context, resolver) {
|
|
|
7656
7761
|
};
|
|
7657
7762
|
}
|
|
7658
7763
|
};
|
|
7659
|
-
subscriptions.push(
|
|
7764
|
+
subscriptions.push(import_coc14.sources.createSource(source));
|
|
7660
7765
|
let list = {
|
|
7661
7766
|
name: "issues",
|
|
7662
7767
|
actions: [{
|
|
7663
7768
|
name: "open",
|
|
7664
7769
|
execute: async (item) => {
|
|
7665
7770
|
let {url} = item.data;
|
|
7666
|
-
await
|
|
7771
|
+
await import_coc14.workspace.openResource(url);
|
|
7667
7772
|
},
|
|
7668
7773
|
multiple: false
|
|
7669
7774
|
}, {
|
|
@@ -7673,7 +7778,7 @@ function addSource(context, resolver) {
|
|
|
7673
7778
|
let {body, id} = item.data;
|
|
7674
7779
|
let lines = body.split(/\r?\n/);
|
|
7675
7780
|
let mod = context2.options.position == "top" ? "below" : "above";
|
|
7676
|
-
let {nvim} =
|
|
7781
|
+
let {nvim} = import_coc14.workspace;
|
|
7677
7782
|
nvim.pauseNotification();
|
|
7678
7783
|
nvim.command("pclose", true);
|
|
7679
7784
|
nvim.command(`${mod} ${lines.length}sp +setl\\ previewwindow [issue ${id}]`, true);
|
|
@@ -7692,141 +7797,142 @@ function addSource(context, resolver) {
|
|
|
7692
7797
|
description: "issues on github/gitlab",
|
|
7693
7798
|
loadItems: async (context2) => {
|
|
7694
7799
|
let buf = await context2.window.buffer;
|
|
7695
|
-
let root = await resolver.resolveGitRoot(
|
|
7800
|
+
let root = await resolver.resolveGitRoot(import_coc14.workspace.getDocument(buf.id));
|
|
7696
7801
|
if (!root)
|
|
7697
7802
|
return [];
|
|
7698
7803
|
let issues = await loadIssues(root);
|
|
7699
7804
|
return issues.map((o) => {
|
|
7700
7805
|
return {
|
|
7701
|
-
label: `${
|
|
7806
|
+
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
7807
|
data: {id: o.id, url: o.url, body: o.body}
|
|
7703
7808
|
};
|
|
7704
7809
|
});
|
|
7705
7810
|
}
|
|
7706
7811
|
};
|
|
7707
|
-
subscriptions.push(
|
|
7812
|
+
subscriptions.push(import_coc14.listManager.registerList(list));
|
|
7708
7813
|
}
|
|
7709
7814
|
|
|
7710
7815
|
// src/index.ts
|
|
7711
7816
|
async function activate(context) {
|
|
7712
|
-
const config =
|
|
7817
|
+
const config = import_coc15.workspace.getConfiguration("git");
|
|
7713
7818
|
const {subscriptions} = context;
|
|
7714
7819
|
let gitInfo;
|
|
7715
7820
|
try {
|
|
7716
7821
|
let pathHint = config.get("command");
|
|
7717
7822
|
gitInfo = await findGit(pathHint, (path8) => context.logger.info(`Looking for git in: ${path8}`));
|
|
7718
7823
|
} catch (e) {
|
|
7719
|
-
|
|
7824
|
+
import_coc15.window.showMessage("git command required for coc-git", "error");
|
|
7720
7825
|
return;
|
|
7721
7826
|
}
|
|
7722
|
-
const virtualTextSrcId = await
|
|
7723
|
-
const conflictSrcId = await
|
|
7724
|
-
const {nvim} =
|
|
7827
|
+
const virtualTextSrcId = await import_coc15.workspace.nvim.createNamespace("coc-git-virtual");
|
|
7828
|
+
const conflictSrcId = await import_coc15.workspace.nvim.createNamespace("coc-git-conflicts");
|
|
7829
|
+
const {nvim} = import_coc15.workspace;
|
|
7725
7830
|
const service = new service_default(gitInfo);
|
|
7726
7831
|
const manager = new manager_default(nvim, service, virtualTextSrcId, conflictSrcId);
|
|
7727
7832
|
subscriptions.push(manager);
|
|
7728
7833
|
addSource(context, service.resolver);
|
|
7729
|
-
subscriptions.push(
|
|
7834
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.refresh", () => {
|
|
7730
7835
|
manager.refresh();
|
|
7731
7836
|
}));
|
|
7732
|
-
subscriptions.push(
|
|
7837
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-nextchunk", async () => {
|
|
7733
7838
|
await manager.nextChunk();
|
|
7734
7839
|
}, {sync: false}));
|
|
7735
|
-
subscriptions.push(
|
|
7840
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-prevchunk", async () => {
|
|
7736
7841
|
await manager.prevChunk();
|
|
7737
7842
|
}, {sync: false}));
|
|
7738
|
-
subscriptions.push(
|
|
7843
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-nextconflict", async () => {
|
|
7739
7844
|
await manager.nextConflict();
|
|
7740
7845
|
}, {sync: false}));
|
|
7741
|
-
subscriptions.push(
|
|
7846
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-prevconflict", async () => {
|
|
7742
7847
|
await manager.prevConflict();
|
|
7743
7848
|
}, {sync: false}));
|
|
7744
|
-
subscriptions.push(
|
|
7849
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-keepcurrent", async () => {
|
|
7745
7850
|
await manager.keepCurrent();
|
|
7746
7851
|
}, {sync: false}));
|
|
7747
|
-
subscriptions.push(
|
|
7852
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-keepincoming", async () => {
|
|
7748
7853
|
await manager.keepIncoming();
|
|
7749
7854
|
}, {sync: false}));
|
|
7750
|
-
subscriptions.push(
|
|
7855
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-keepboth", async () => {
|
|
7751
7856
|
await manager.keepBoth();
|
|
7752
7857
|
}, {sync: false}));
|
|
7753
|
-
subscriptions.push(
|
|
7858
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-chunkinfo", async () => {
|
|
7754
7859
|
await manager.chunkInfo();
|
|
7755
7860
|
}, {sync: false}));
|
|
7756
|
-
subscriptions.push(
|
|
7861
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-commit", async () => {
|
|
7757
7862
|
await manager.showCommit();
|
|
7758
7863
|
}, {sync: false}));
|
|
7759
|
-
subscriptions.push(
|
|
7864
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["n"], "git-showblamedoc", async () => {
|
|
7760
7865
|
await manager.showBlameDoc();
|
|
7761
7866
|
}, {sync: false}));
|
|
7762
|
-
subscriptions.push(
|
|
7867
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.keepCurrent", async () => {
|
|
7763
7868
|
await manager.keepCurrent();
|
|
7764
7869
|
}));
|
|
7765
|
-
subscriptions.push(
|
|
7870
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.keepIncoming", async () => {
|
|
7766
7871
|
await manager.keepIncoming();
|
|
7767
7872
|
}));
|
|
7768
|
-
subscriptions.push(
|
|
7873
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.keepBoth", async () => {
|
|
7769
7874
|
await manager.keepBoth();
|
|
7770
7875
|
}));
|
|
7771
|
-
subscriptions.push(
|
|
7876
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkInfo", async () => {
|
|
7772
7877
|
await manager.chunkInfo();
|
|
7773
7878
|
}));
|
|
7774
|
-
subscriptions.push(
|
|
7879
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkStage", async () => {
|
|
7775
7880
|
await manager.chunkStage();
|
|
7776
7881
|
}));
|
|
7777
|
-
subscriptions.push(
|
|
7882
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkUnstage", async () => {
|
|
7778
7883
|
await manager.chunkUnstage();
|
|
7779
7884
|
}));
|
|
7780
|
-
subscriptions.push(
|
|
7885
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.chunkUndo", async () => {
|
|
7781
7886
|
await manager.chunkUndo();
|
|
7782
7887
|
}));
|
|
7783
|
-
subscriptions.push(
|
|
7888
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.showCommit", async () => {
|
|
7784
7889
|
await manager.showCommit();
|
|
7785
7890
|
}));
|
|
7786
|
-
subscriptions.push(
|
|
7891
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.browserOpen", async () => {
|
|
7787
7892
|
await manager.browser();
|
|
7788
7893
|
}));
|
|
7789
|
-
subscriptions.push(
|
|
7894
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.copyUrl", async (...args) => {
|
|
7790
7895
|
await manager.browser("copy", args);
|
|
7791
7896
|
}));
|
|
7792
|
-
subscriptions.push(
|
|
7897
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.copyPermalink", async (...args) => {
|
|
7793
7898
|
await manager.browser("copy", args, true);
|
|
7794
7899
|
}));
|
|
7795
|
-
subscriptions.push(
|
|
7900
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.push", async (...args) => {
|
|
7796
7901
|
await manager.push(args);
|
|
7797
7902
|
}));
|
|
7798
|
-
subscriptions.push(
|
|
7903
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.diffCached", async () => {
|
|
7799
7904
|
await manager.diffCached();
|
|
7800
7905
|
}));
|
|
7801
|
-
subscriptions.push(
|
|
7906
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.toggleGutters", async () => {
|
|
7802
7907
|
await manager.toggleGutters();
|
|
7803
7908
|
}));
|
|
7804
|
-
subscriptions.push(
|
|
7909
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.foldUnchanged", async () => {
|
|
7805
7910
|
await manager.toggleFold();
|
|
7806
7911
|
}));
|
|
7807
|
-
subscriptions.push(
|
|
7912
|
+
subscriptions.push(import_coc15.commands.registerCommand("git.showBlameDoc", async () => {
|
|
7808
7913
|
await manager.showBlameDoc();
|
|
7809
7914
|
}));
|
|
7810
|
-
subscriptions.push(
|
|
7811
|
-
subscriptions.push(
|
|
7812
|
-
subscriptions.push(
|
|
7813
|
-
subscriptions.push(
|
|
7814
|
-
subscriptions.push(
|
|
7815
|
-
subscriptions.push(
|
|
7915
|
+
subscriptions.push(import_coc15.listManager.registerList(new gstatus_default(nvim, manager)));
|
|
7916
|
+
subscriptions.push(import_coc15.listManager.registerList(new branches_default(nvim, manager)));
|
|
7917
|
+
subscriptions.push(import_coc15.listManager.registerList(new commits_default(nvim, manager)));
|
|
7918
|
+
subscriptions.push(import_coc15.listManager.registerList(new bcommits_default(nvim, manager)));
|
|
7919
|
+
subscriptions.push(import_coc15.listManager.registerList(new gfiles_default(nvim, manager)));
|
|
7920
|
+
subscriptions.push(import_coc15.listManager.registerList(new gchunks_default(nvim, manager)));
|
|
7921
|
+
subscriptions.push(import_coc15.languages.registerCompletionItemProvider("semantic-commit", "Commit", config.get("semanticCommit.filetypes"), {
|
|
7816
7922
|
provideCompletionItems: async (document, position) => {
|
|
7817
7923
|
if (position.line !== 0) {
|
|
7818
7924
|
return [];
|
|
7819
7925
|
}
|
|
7820
|
-
const text = document.getText(
|
|
7926
|
+
const text = document.getText(import_coc15.Range.create(import_coc15.Position.create(position.line, 0), position));
|
|
7821
7927
|
if (/^[a-z]*$/.test(text)) {
|
|
7822
7928
|
const scope = config.get("semanticCommit.scope");
|
|
7823
7929
|
const text2 = scope ? "(${1:scope}): ${2:commit}" : ": ${1:commit}";
|
|
7824
7930
|
return DEFAULT_TYPES.map((o) => {
|
|
7825
7931
|
return {
|
|
7826
7932
|
label: o.value,
|
|
7827
|
-
kind:
|
|
7933
|
+
kind: import_coc15.CompletionItemKind.Snippet,
|
|
7828
7934
|
documentation: {kind: "plaintext", value: o.name},
|
|
7829
|
-
insertTextFormat:
|
|
7935
|
+
insertTextFormat: import_coc15.InsertTextFormat.Snippet,
|
|
7830
7936
|
insertText: o.value + text2 + "\n\n"
|
|
7831
7937
|
};
|
|
7832
7938
|
});
|
|
@@ -7834,13 +7940,13 @@ async function activate(context) {
|
|
|
7834
7940
|
return [];
|
|
7835
7941
|
}
|
|
7836
7942
|
}));
|
|
7837
|
-
subscriptions.push(
|
|
7943
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["o", "x"], "git-chunk-inner", async () => {
|
|
7838
7944
|
let diff = await manager.getCurrentChunk();
|
|
7839
7945
|
if (!diff)
|
|
7840
7946
|
return;
|
|
7841
7947
|
await nvim.command(`normal! ${diff.start}GV${diff.end}G`);
|
|
7842
7948
|
}, {sync: true, silent: true}));
|
|
7843
|
-
subscriptions.push(
|
|
7949
|
+
subscriptions.push(import_coc15.workspace.registerKeymap(["o", "x"], "git-chunk-outer", async () => {
|
|
7844
7950
|
let diff = await manager.getCurrentChunk();
|
|
7845
7951
|
if (!diff)
|
|
7846
7952
|
return;
|