coc-git 2.6.1 → 2.7.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 +399 -288
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -37,7 +37,7 @@ var require_windows = __commonJS((exports2, module2) => {
|
|
|
37
37
|
module2.exports = isexe;
|
|
38
38
|
isexe.sync = sync;
|
|
39
39
|
var fs4 = require("fs");
|
|
40
|
-
function checkPathExt(
|
|
40
|
+
function checkPathExt(path9, options) {
|
|
41
41
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
42
42
|
if (!pathext) {
|
|
43
43
|
return true;
|
|
@@ -48,25 +48,25 @@ var require_windows = __commonJS((exports2, module2) => {
|
|
|
48
48
|
}
|
|
49
49
|
for (var i = 0; i < pathext.length; i++) {
|
|
50
50
|
var p = pathext[i].toLowerCase();
|
|
51
|
-
if (p &&
|
|
51
|
+
if (p && path9.substr(-p.length).toLowerCase() === p) {
|
|
52
52
|
return true;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
|
-
function checkStat(stat,
|
|
57
|
+
function checkStat(stat, path9, options) {
|
|
58
58
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
|
-
return checkPathExt(
|
|
61
|
+
return checkPathExt(path9, options);
|
|
62
62
|
}
|
|
63
|
-
function isexe(
|
|
64
|
-
fs4.stat(
|
|
65
|
-
cb(er, er ? false : checkStat(stat,
|
|
63
|
+
function isexe(path9, options, cb) {
|
|
64
|
+
fs4.stat(path9, function(er, stat) {
|
|
65
|
+
cb(er, er ? false : checkStat(stat, path9, options));
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function sync(
|
|
69
|
-
return checkStat(fs4.statSync(
|
|
68
|
+
function sync(path9, options) {
|
|
69
|
+
return checkStat(fs4.statSync(path9), path9, options);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
|
|
@@ -75,13 +75,13 @@ var require_mode = __commonJS((exports2, module2) => {
|
|
|
75
75
|
module2.exports = isexe;
|
|
76
76
|
isexe.sync = sync;
|
|
77
77
|
var fs4 = require("fs");
|
|
78
|
-
function isexe(
|
|
79
|
-
fs4.stat(
|
|
78
|
+
function isexe(path9, options, cb) {
|
|
79
|
+
fs4.stat(path9, function(er, stat) {
|
|
80
80
|
cb(er, er ? false : checkStat(stat, options));
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
function sync(
|
|
84
|
-
return checkStat(fs4.statSync(
|
|
83
|
+
function sync(path9, options) {
|
|
84
|
+
return checkStat(fs4.statSync(path9), options);
|
|
85
85
|
}
|
|
86
86
|
function checkStat(stat, options) {
|
|
87
87
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -112,7 +112,7 @@ var require_isexe = __commonJS((exports2, module2) => {
|
|
|
112
112
|
}
|
|
113
113
|
module2.exports = isexe;
|
|
114
114
|
isexe.sync = sync;
|
|
115
|
-
function isexe(
|
|
115
|
+
function isexe(path9, options, cb) {
|
|
116
116
|
if (typeof options === "function") {
|
|
117
117
|
cb = options;
|
|
118
118
|
options = {};
|
|
@@ -122,7 +122,7 @@ var require_isexe = __commonJS((exports2, module2) => {
|
|
|
122
122
|
throw new TypeError("callback not provided");
|
|
123
123
|
}
|
|
124
124
|
return new Promise(function(resolve, reject) {
|
|
125
|
-
isexe(
|
|
125
|
+
isexe(path9, options || {}, function(er, is) {
|
|
126
126
|
if (er) {
|
|
127
127
|
reject(er);
|
|
128
128
|
} else {
|
|
@@ -131,7 +131,7 @@ var require_isexe = __commonJS((exports2, module2) => {
|
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
core(
|
|
134
|
+
core(path9, options || {}, function(er, is) {
|
|
135
135
|
if (er) {
|
|
136
136
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
137
137
|
er = null;
|
|
@@ -141,9 +141,9 @@ var require_isexe = __commonJS((exports2, module2) => {
|
|
|
141
141
|
cb(er, is);
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
function sync(
|
|
144
|
+
function sync(path9, options) {
|
|
145
145
|
try {
|
|
146
|
-
return core.sync(
|
|
146
|
+
return core.sync(path9, options || {});
|
|
147
147
|
} catch (er) {
|
|
148
148
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
149
149
|
return false;
|
|
@@ -157,7 +157,7 @@ var require_isexe = __commonJS((exports2, module2) => {
|
|
|
157
157
|
// node_modules/which/which.js
|
|
158
158
|
var require_which = __commonJS((exports2, module2) => {
|
|
159
159
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
160
|
-
var
|
|
160
|
+
var path9 = require("path");
|
|
161
161
|
var COLON = isWindows ? ";" : ":";
|
|
162
162
|
var isexe = require_isexe();
|
|
163
163
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), {code: "ENOENT"});
|
|
@@ -193,7 +193,7 @@ var require_which = __commonJS((exports2, module2) => {
|
|
|
193
193
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
194
194
|
const ppRaw = pathEnv[i];
|
|
195
195
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
196
|
-
const pCmd =
|
|
196
|
+
const pCmd = path9.join(pathPart, cmd);
|
|
197
197
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
198
198
|
resolve(subStep(p, i, 0));
|
|
199
199
|
});
|
|
@@ -220,7 +220,7 @@ var require_which = __commonJS((exports2, module2) => {
|
|
|
220
220
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
221
221
|
const ppRaw = pathEnv[i];
|
|
222
222
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
223
|
-
const pCmd =
|
|
223
|
+
const pCmd = path9.join(pathPart, cmd);
|
|
224
224
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
225
225
|
for (let j = 0; j < pathExt.length; j++) {
|
|
226
226
|
const cur = p + pathExt[j];
|
|
@@ -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(colors6) {
|
|
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 colors6.red(letter);
|
|
680
680
|
case 1:
|
|
681
|
-
return
|
|
681
|
+
return colors6.white(letter);
|
|
682
682
|
case 2:
|
|
683
|
-
return
|
|
683
|
+
return colors6.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(colors6) {
|
|
692
692
|
return function(letter, i, exploded) {
|
|
693
|
-
return i % 2 === 0 ? letter :
|
|
693
|
+
return i % 2 === 0 ? letter : colors6.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(colors6) {
|
|
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 colors6[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(colors6) {
|
|
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 : colors6[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 colors6 = {};
|
|
743
|
+
module2["exports"] = colors6;
|
|
744
|
+
colors6.themes = {};
|
|
745
745
|
var util2 = require("util");
|
|
746
|
-
var ansiStyles =
|
|
746
|
+
var ansiStyles = colors6.styles = require_styles();
|
|
747
747
|
var defineProps = Object.defineProperties;
|
|
748
748
|
var newLineRegex = new RegExp(/[\r\n]+/g);
|
|
749
|
-
|
|
750
|
-
if (typeof
|
|
751
|
-
|
|
749
|
+
colors6.supportsColor = require_supports_colors().supportsColor;
|
|
750
|
+
if (typeof colors6.enabled === "undefined") {
|
|
751
|
+
colors6.enabled = colors6.supportsColor() !== false;
|
|
752
752
|
}
|
|
753
|
-
|
|
754
|
-
|
|
753
|
+
colors6.enable = function() {
|
|
754
|
+
colors6.enabled = true;
|
|
755
755
|
};
|
|
756
|
-
|
|
757
|
-
|
|
756
|
+
colors6.disable = function() {
|
|
757
|
+
colors6.enabled = false;
|
|
758
758
|
};
|
|
759
|
-
|
|
759
|
+
colors6.stripColors = colors6.strip = function(str) {
|
|
760
760
|
return ("" + str).replace(/\x1B\[\d+m/g, "");
|
|
761
761
|
};
|
|
762
|
-
var stylize =
|
|
763
|
-
if (!
|
|
762
|
+
var stylize = colors6.stylize = function stylize2(str, style) {
|
|
763
|
+
if (!colors6.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 colors6) {
|
|
768
|
+
return colors6[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 colors7() {
|
|
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 (!colors6.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
|
+
colors6.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
|
+
colors6[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 = colors6[theme[style2][i]](out);
|
|
840
840
|
}
|
|
841
841
|
return out;
|
|
842
842
|
}
|
|
843
|
-
return
|
|
843
|
+
return colors6[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
|
+
colors6.trap = require_trap();
|
|
865
|
+
colors6.zalgo = require_zalgo();
|
|
866
|
+
colors6.maps = {};
|
|
867
|
+
colors6.maps.america = require_america()(colors6);
|
|
868
|
+
colors6.maps.zebra = require_zebra()(colors6);
|
|
869
|
+
colors6.maps.rainbow = require_rainbow()(colors6);
|
|
870
|
+
colors6.maps.random = require_random()(colors6);
|
|
871
|
+
for (var map in colors6.maps) {
|
|
872
872
|
(function(map2) {
|
|
873
|
-
|
|
874
|
-
return sequencer(
|
|
873
|
+
colors6[map2] = function(str) {
|
|
874
|
+
return sequencer(colors6.maps[map2], str);
|
|
875
875
|
};
|
|
876
876
|
})(map);
|
|
877
877
|
}
|
|
878
|
-
defineProps(
|
|
878
|
+
defineProps(colors6, 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 colors6 = require_colors();
|
|
884
|
+
module2["exports"] = colors6;
|
|
885
885
|
});
|
|
886
886
|
|
|
887
887
|
// node_modules/debounce/index.js
|
|
@@ -4407,7 +4407,7 @@ var require_lib = __commonJS((exports2, module2) => {
|
|
|
4407
4407
|
__export(exports, {
|
|
4408
4408
|
activate: () => activate
|
|
4409
4409
|
});
|
|
4410
|
-
var
|
|
4410
|
+
var import_coc16 = __toModule(require("coc.nvim"));
|
|
4411
4411
|
|
|
4412
4412
|
// src/constants.ts
|
|
4413
4413
|
var DEFAULT_TYPES = [
|
|
@@ -4659,20 +4659,20 @@ function findSystemGitWin32(base, onLookup) {
|
|
|
4659
4659
|
return findSpecificGit(import_path.default.join(base, "Git", "cmd", "git.exe"), onLookup);
|
|
4660
4660
|
}
|
|
4661
4661
|
function findGitWin32InPath(onLookup) {
|
|
4662
|
-
const whichPromise = new Promise((c, e) => import_which.default("git.exe", (err,
|
|
4663
|
-
return whichPromise.then((
|
|
4662
|
+
const whichPromise = new Promise((c, e) => import_which.default("git.exe", (err, path9) => err ? e(err) : c(path9)));
|
|
4663
|
+
return whichPromise.then((path9) => findSpecificGit(path9, onLookup));
|
|
4664
4664
|
}
|
|
4665
4665
|
function findGitWin32(onLookup) {
|
|
4666
4666
|
return findSystemGitWin32(process.env["ProgramW6432"], onLookup).then(void 0, () => findSystemGitWin32(process.env["ProgramFiles(x86)"], onLookup)).then(void 0, () => findSystemGitWin32(process.env["ProgramFiles"], onLookup)).then(void 0, () => findSystemGitWin32(import_path.default.join(process.env["LocalAppData"], "Programs"), onLookup)).then(void 0, () => findGitWin32InPath(onLookup));
|
|
4667
4667
|
}
|
|
4668
|
-
function findSpecificGit(
|
|
4668
|
+
function findSpecificGit(path9, onLookup) {
|
|
4669
4669
|
return new Promise((c, e) => {
|
|
4670
|
-
onLookup(
|
|
4670
|
+
onLookup(path9);
|
|
4671
4671
|
const buffers = [];
|
|
4672
|
-
const child = import_child_process.spawn(
|
|
4672
|
+
const child = import_child_process.spawn(path9, ["--version"]);
|
|
4673
4673
|
child.stdout.on("data", (b) => buffers.push(b));
|
|
4674
4674
|
child.on("error", cpErrorHandler(e));
|
|
4675
|
-
child.on("exit", (code) => code ? e(new Error("Not found")) : c({path:
|
|
4675
|
+
child.on("exit", (code) => code ? e(new Error("Not found")) : c({path: path9, version: parseVersion(Buffer.concat(buffers).toString("utf8").trim())}));
|
|
4676
4676
|
});
|
|
4677
4677
|
}
|
|
4678
4678
|
function cpErrorHandler(cb) {
|
|
@@ -4689,20 +4689,20 @@ function findGitDarwin(onLookup) {
|
|
|
4689
4689
|
if (err) {
|
|
4690
4690
|
return e("git not found");
|
|
4691
4691
|
}
|
|
4692
|
-
const
|
|
4693
|
-
function getVersion(
|
|
4694
|
-
onLookup(
|
|
4692
|
+
const path9 = gitPathBuffer.toString().replace(/^\s+|\s+$/g, "");
|
|
4693
|
+
function getVersion(path10) {
|
|
4694
|
+
onLookup(path10);
|
|
4695
4695
|
import_child_process.exec("git --version", (err2, stdout) => {
|
|
4696
4696
|
if (err2) {
|
|
4697
4697
|
return e("git not found");
|
|
4698
4698
|
}
|
|
4699
|
-
return c({path:
|
|
4699
|
+
return c({path: path10, version: parseVersion(stdout.trim())});
|
|
4700
4700
|
});
|
|
4701
4701
|
}
|
|
4702
|
-
if (
|
|
4703
|
-
return getVersion(
|
|
4702
|
+
if (path9 !== "/usr/bin/git") {
|
|
4703
|
+
return getVersion(path9);
|
|
4704
4704
|
}
|
|
4705
|
-
getVersion(
|
|
4705
|
+
getVersion(path9);
|
|
4706
4706
|
import_child_process.exec("xcode-select -p", (err2) => {
|
|
4707
4707
|
if (err2 && err2.code === 2) {
|
|
4708
4708
|
return e("git not found");
|
|
@@ -4977,7 +4977,7 @@ var Branches = class {
|
|
|
4977
4977
|
return;
|
|
4978
4978
|
}
|
|
4979
4979
|
let result = await this.manager.git.exec(root, ["branch", "--no-color", ...context.args]);
|
|
4980
|
-
let output = result.stdout
|
|
4980
|
+
let output = result.stdout;
|
|
4981
4981
|
if (output == null)
|
|
4982
4982
|
return;
|
|
4983
4983
|
output = output.replace(/\s+$/, "");
|
|
@@ -5530,19 +5530,95 @@ var GChunks = class extends import_coc7.BasicList {
|
|
|
5530
5530
|
};
|
|
5531
5531
|
var gchunks_default = GChunks;
|
|
5532
5532
|
|
|
5533
|
+
// src/lists/gchanges.ts
|
|
5534
|
+
var import_coc8 = __toModule(require("coc.nvim"));
|
|
5535
|
+
var import_path4 = __toModule(require("path"));
|
|
5536
|
+
var import_safe4 = __toModule(require_safe());
|
|
5537
|
+
|
|
5538
|
+
// src/types.ts
|
|
5539
|
+
var ChangeType;
|
|
5540
|
+
(function(ChangeType2) {
|
|
5541
|
+
ChangeType2["Add"] = "add";
|
|
5542
|
+
ChangeType2["Change"] = "changed";
|
|
5543
|
+
ChangeType2["Delete"] = "delete";
|
|
5544
|
+
})(ChangeType || (ChangeType = {}));
|
|
5545
|
+
var DiffCategory;
|
|
5546
|
+
(function(DiffCategory3) {
|
|
5547
|
+
DiffCategory3[DiffCategory3["All"] = 0] = "All";
|
|
5548
|
+
DiffCategory3[DiffCategory3["Staged"] = 1] = "Staged";
|
|
5549
|
+
DiffCategory3[DiffCategory3["Unstaged"] = 2] = "Unstaged";
|
|
5550
|
+
})(DiffCategory || (DiffCategory = {}));
|
|
5551
|
+
var ConflictParseState;
|
|
5552
|
+
(function(ConflictParseState2) {
|
|
5553
|
+
ConflictParseState2[ConflictParseState2["Initial"] = 0] = "Initial";
|
|
5554
|
+
ConflictParseState2[ConflictParseState2["MatchedStart"] = 1] = "MatchedStart";
|
|
5555
|
+
ConflictParseState2[ConflictParseState2["MatchedSep"] = 2] = "MatchedSep";
|
|
5556
|
+
})(ConflictParseState || (ConflictParseState = {}));
|
|
5557
|
+
var ConflictPart;
|
|
5558
|
+
(function(ConflictPart2) {
|
|
5559
|
+
ConflictPart2[ConflictPart2["Current"] = 0] = "Current";
|
|
5560
|
+
ConflictPart2[ConflictPart2["Incoming"] = 1] = "Incoming";
|
|
5561
|
+
ConflictPart2[ConflictPart2["Both"] = 2] = "Both";
|
|
5562
|
+
})(ConflictPart || (ConflictPart = {}));
|
|
5563
|
+
|
|
5564
|
+
// src/lists/gchanges.ts
|
|
5565
|
+
var GChanges = class extends import_coc8.BasicList {
|
|
5566
|
+
constructor(nvim, manager) {
|
|
5567
|
+
super();
|
|
5568
|
+
this.manager = manager;
|
|
5569
|
+
this.name = "gchanges";
|
|
5570
|
+
this.description = "Git changes of repository";
|
|
5571
|
+
this.defaultAction = "open";
|
|
5572
|
+
this.addLocationActions();
|
|
5573
|
+
}
|
|
5574
|
+
async loadItems(context) {
|
|
5575
|
+
let buf = await context.window.buffer;
|
|
5576
|
+
let root = await this.manager.resolveGitRootFromBufferOrCwd(buf.id);
|
|
5577
|
+
if (!root) {
|
|
5578
|
+
throw new Error(`Can't resolve git root.`);
|
|
5579
|
+
return;
|
|
5580
|
+
}
|
|
5581
|
+
let args = context.args;
|
|
5582
|
+
let category = DiffCategory.All;
|
|
5583
|
+
if (args.indexOf("--cached") !== -1) {
|
|
5584
|
+
category = DiffCategory.Staged;
|
|
5585
|
+
} else if (args.indexOf("--unstaged") !== -1) {
|
|
5586
|
+
category = DiffCategory.Unstaged;
|
|
5587
|
+
} else {
|
|
5588
|
+
category = DiffCategory.All;
|
|
5589
|
+
}
|
|
5590
|
+
let res = [];
|
|
5591
|
+
let diffGroups = await this.manager.getDiffAll(category);
|
|
5592
|
+
for (let [file, diffs] of diffGroups) {
|
|
5593
|
+
for (let diff of diffs) {
|
|
5594
|
+
let uri = import_coc8.Uri.file(import_path4.default.join(root, file)).toString();
|
|
5595
|
+
let location = import_coc8.Location.create(uri, import_coc8.Range.create(diff.start - 1, 0, diff.end - 1, 0));
|
|
5596
|
+
res.push({
|
|
5597
|
+
label: `${import_safe4.default.cyan(file)}:${import_safe4.default.green(diff.start.toString())} ${diff.lines[0]}`,
|
|
5598
|
+
sortText: `${file}:${diff.start}`,
|
|
5599
|
+
data: {uri},
|
|
5600
|
+
location
|
|
5601
|
+
});
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
return res;
|
|
5605
|
+
}
|
|
5606
|
+
};
|
|
5607
|
+
var gchanges_default = GChanges;
|
|
5608
|
+
|
|
5533
5609
|
// src/manager.ts
|
|
5534
|
-
var
|
|
5610
|
+
var import_coc10 = __toModule(require("coc.nvim"));
|
|
5535
5611
|
var import_debounce = __toModule(require_debounce());
|
|
5536
5612
|
|
|
5537
5613
|
// src/model/status.ts
|
|
5538
|
-
var
|
|
5614
|
+
var import_coc9 = __toModule(require("coc.nvim"));
|
|
5539
5615
|
var GitStatus = class {
|
|
5540
5616
|
constructor(service) {
|
|
5541
5617
|
this.service = service;
|
|
5542
5618
|
this.disposables = [];
|
|
5543
5619
|
this._enabled = false;
|
|
5544
|
-
this.mutex = new
|
|
5545
|
-
let config =
|
|
5620
|
+
this.mutex = new import_coc9.Mutex();
|
|
5621
|
+
let config = import_coc9.workspace.getConfiguration("git");
|
|
5546
5622
|
this._enabled = config.get("enableGlobalStatus", true);
|
|
5547
5623
|
this.branchCharacter = config.get("branchCharacter", "");
|
|
5548
5624
|
this.characters = {
|
|
@@ -5551,10 +5627,10 @@ var GitStatus = class {
|
|
|
5551
5627
|
stagedDecorator: config.get("stagedDecorator"),
|
|
5552
5628
|
untrackedDecorator: config.get("untrackedDecorator")
|
|
5553
5629
|
};
|
|
5554
|
-
|
|
5555
|
-
|
|
5630
|
+
import_coc9.events.on("BufEnter", this.refresh, this, this.disposables);
|
|
5631
|
+
import_coc9.events.on("FocusGained", this.refresh, this, this.disposables);
|
|
5556
5632
|
let timer;
|
|
5557
|
-
|
|
5633
|
+
import_coc9.events.on("BufWritePost", () => {
|
|
5558
5634
|
timer = setTimeout(() => {
|
|
5559
5635
|
this.refresh();
|
|
5560
5636
|
}, 300);
|
|
@@ -5589,38 +5665,18 @@ var GitStatus = class {
|
|
|
5589
5665
|
if (this.gitStatus == status)
|
|
5590
5666
|
return;
|
|
5591
5667
|
this.gitStatus = status;
|
|
5592
|
-
let {nvim} =
|
|
5668
|
+
let {nvim} = import_coc9.workspace;
|
|
5593
5669
|
nvim.pauseNotification();
|
|
5594
5670
|
nvim.setVar("coc_git_status", status, true);
|
|
5595
5671
|
nvim.call("coc#util#do_autocmd", ["CocGitStatusChange"], true);
|
|
5596
5672
|
nvim.resumeNotification(false, true);
|
|
5597
5673
|
}
|
|
5598
5674
|
dispose() {
|
|
5599
|
-
|
|
5675
|
+
import_coc9.disposeAll(this.disposables);
|
|
5600
5676
|
}
|
|
5601
5677
|
};
|
|
5602
5678
|
var status_default = GitStatus;
|
|
5603
5679
|
|
|
5604
|
-
// src/types.ts
|
|
5605
|
-
var ChangeType;
|
|
5606
|
-
(function(ChangeType2) {
|
|
5607
|
-
ChangeType2["Add"] = "add";
|
|
5608
|
-
ChangeType2["Change"] = "changed";
|
|
5609
|
-
ChangeType2["Delete"] = "delete";
|
|
5610
|
-
})(ChangeType || (ChangeType = {}));
|
|
5611
|
-
var ConflictParseState;
|
|
5612
|
-
(function(ConflictParseState2) {
|
|
5613
|
-
ConflictParseState2[ConflictParseState2["Initial"] = 0] = "Initial";
|
|
5614
|
-
ConflictParseState2[ConflictParseState2["MatchedStart"] = 1] = "MatchedStart";
|
|
5615
|
-
ConflictParseState2[ConflictParseState2["MatchedSep"] = 2] = "MatchedSep";
|
|
5616
|
-
})(ConflictParseState || (ConflictParseState = {}));
|
|
5617
|
-
var ConflictPart;
|
|
5618
|
-
(function(ConflictPart2) {
|
|
5619
|
-
ConflictPart2[ConflictPart2["Current"] = 0] = "Current";
|
|
5620
|
-
ConflictPart2[ConflictPart2["Incoming"] = 1] = "Incoming";
|
|
5621
|
-
ConflictPart2[ConflictPart2["Both"] = 2] = "Both";
|
|
5622
|
-
})(ConflictPart || (ConflictPart = {}));
|
|
5623
|
-
|
|
5624
5680
|
// src/manager.ts
|
|
5625
5681
|
var DocumentManager = class {
|
|
5626
5682
|
constructor(nvim, service, virtualTextSrcId, conflictSrcId = 0) {
|
|
@@ -5632,12 +5688,12 @@ var DocumentManager = class {
|
|
|
5632
5688
|
this.disposables = [];
|
|
5633
5689
|
this.defined = false;
|
|
5634
5690
|
this.loadConfiguration();
|
|
5635
|
-
|
|
5691
|
+
import_coc10.workspace.onDidChangeConfiguration(this.loadConfiguration, this, this.disposables);
|
|
5636
5692
|
this.gitStatus = new status_default(service);
|
|
5637
5693
|
const createBuffer = (doc) => {
|
|
5638
5694
|
let {uri} = doc;
|
|
5639
5695
|
service.createBuffer(doc, this.config).then((buf) => {
|
|
5640
|
-
if (!buf ||
|
|
5696
|
+
if (!buf || import_coc10.workspace.getDocument(uri) == null)
|
|
5641
5697
|
return;
|
|
5642
5698
|
this.defineSigns().catch((e) => {
|
|
5643
5699
|
console.error(e.message);
|
|
@@ -5645,43 +5701,43 @@ var DocumentManager = class {
|
|
|
5645
5701
|
this.buffers.set(doc.bufnr, buf);
|
|
5646
5702
|
});
|
|
5647
5703
|
};
|
|
5648
|
-
for (let doc of
|
|
5704
|
+
for (let doc of import_coc10.workspace.documents) {
|
|
5649
5705
|
createBuffer(doc);
|
|
5650
5706
|
}
|
|
5651
|
-
|
|
5652
|
-
createBuffer(
|
|
5707
|
+
import_coc10.workspace.onDidOpenTextDocument(async (e) => {
|
|
5708
|
+
createBuffer(import_coc10.workspace.getDocument(e.bufnr));
|
|
5653
5709
|
}, null, this.disposables);
|
|
5654
|
-
|
|
5710
|
+
import_coc10.workspace.onDidChangeTextDocument(async (e) => {
|
|
5655
5711
|
let buf = this.buffers.get(e.bufnr);
|
|
5656
5712
|
if (buf)
|
|
5657
5713
|
buf.refresh();
|
|
5658
5714
|
}, null, this.disposables);
|
|
5659
|
-
|
|
5715
|
+
import_coc10.workspace.onDidCloseTextDocument((e) => {
|
|
5660
5716
|
let buf = this.buffers.get(e.bufnr);
|
|
5661
5717
|
if (buf)
|
|
5662
5718
|
buf.dispose();
|
|
5663
5719
|
this.buffers.delete(e.bufnr);
|
|
5664
5720
|
this.service.resolver.delete(e.uri);
|
|
5665
5721
|
}, null, this.disposables);
|
|
5666
|
-
|
|
5722
|
+
import_coc10.events.on("CursorMoved", import_debounce.default(async (bufnr, cursor) => {
|
|
5667
5723
|
let buf = this.buffers.get(bufnr);
|
|
5668
5724
|
if (buf)
|
|
5669
5725
|
await buf.showBlameInfo(cursor[0]);
|
|
5670
5726
|
}, 100), null, this.disposables);
|
|
5671
|
-
|
|
5727
|
+
import_coc10.events.on("BufWritePre", (bufnr) => {
|
|
5672
5728
|
if (!this.enableGutters || this.config.realtimeGutters)
|
|
5673
5729
|
return;
|
|
5674
5730
|
let buf = this.buffers.get(bufnr);
|
|
5675
5731
|
if (buf)
|
|
5676
5732
|
buf.updateGutters();
|
|
5677
5733
|
}, null, this.disposables);
|
|
5678
|
-
|
|
5734
|
+
import_coc10.events.on("FocusGained", async () => {
|
|
5679
5735
|
let bufnr = await nvim.call("bufnr", ["%"]);
|
|
5680
5736
|
let buf = this.buffers.get(bufnr);
|
|
5681
5737
|
if (buf)
|
|
5682
5738
|
buf.refresh();
|
|
5683
5739
|
}, null, this.disposables);
|
|
5684
|
-
|
|
5740
|
+
import_coc10.events.on("BufEnter", (bufnr) => {
|
|
5685
5741
|
let buf = this.buffers.get(bufnr);
|
|
5686
5742
|
if (buf)
|
|
5687
5743
|
buf.refresh();
|
|
@@ -5692,7 +5748,7 @@ var DocumentManager = class {
|
|
|
5692
5748
|
return;
|
|
5693
5749
|
this.defined = true;
|
|
5694
5750
|
let {nvim} = this;
|
|
5695
|
-
const config =
|
|
5751
|
+
const config = import_coc10.workspace.getConfiguration("git");
|
|
5696
5752
|
let items = ["Changed", "Added", "Removed", "TopRemoved", "ChangeRemoved"];
|
|
5697
5753
|
nvim.pauseNotification();
|
|
5698
5754
|
for (let item of items) {
|
|
@@ -5707,7 +5763,7 @@ var DocumentManager = class {
|
|
|
5707
5763
|
loadConfiguration(e) {
|
|
5708
5764
|
if (e && !e.affectsConfiguration("git"))
|
|
5709
5765
|
return;
|
|
5710
|
-
let config =
|
|
5766
|
+
let config = import_coc10.workspace.getConfiguration("git");
|
|
5711
5767
|
let obj = {
|
|
5712
5768
|
remoteName: config.get("remoteName", "origin"),
|
|
5713
5769
|
diffRevision: config.get("diffRevision", ""),
|
|
@@ -5767,7 +5823,7 @@ var DocumentManager = class {
|
|
|
5767
5823
|
}
|
|
5768
5824
|
async toggleGutters() {
|
|
5769
5825
|
let enabled = this.enableGutters;
|
|
5770
|
-
let config =
|
|
5826
|
+
let config = import_coc10.workspace.getConfiguration("git");
|
|
5771
5827
|
config.update("enableGutters", !enabled, true);
|
|
5772
5828
|
for (let buf of this.buffers.values()) {
|
|
5773
5829
|
await buf.toggleGutters(!enabled);
|
|
@@ -5779,7 +5835,7 @@ var DocumentManager = class {
|
|
|
5779
5835
|
await buf.toggleFold();
|
|
5780
5836
|
}
|
|
5781
5837
|
async resolveGitRootFromBufferOrCwd(bufnr) {
|
|
5782
|
-
let doc =
|
|
5838
|
+
let doc = import_coc10.workspace.getDocument(bufnr);
|
|
5783
5839
|
let root;
|
|
5784
5840
|
let {resolver} = this.service;
|
|
5785
5841
|
if (doc) {
|
|
@@ -5881,42 +5937,52 @@ var DocumentManager = class {
|
|
|
5881
5937
|
}
|
|
5882
5938
|
}
|
|
5883
5939
|
async push(args) {
|
|
5884
|
-
let bufnr = await
|
|
5940
|
+
let bufnr = await import_coc10.workspace.nvim.call("bufnr", "%");
|
|
5885
5941
|
let root = await this.resolveGitRootFromBufferOrCwd(bufnr);
|
|
5886
5942
|
let extra = this.config.pushArguments;
|
|
5887
5943
|
if (!root) {
|
|
5888
|
-
|
|
5944
|
+
import_coc10.window.showMessage(`not belongs to git repository.`, "warning");
|
|
5889
5945
|
return;
|
|
5890
5946
|
}
|
|
5891
5947
|
if (args && args.length) {
|
|
5892
|
-
await
|
|
5948
|
+
await import_coc10.window.runTerminalCommand(`git push ${[...args, ...extra].join(" ")}`, root, true);
|
|
5893
5949
|
return;
|
|
5894
5950
|
}
|
|
5895
5951
|
let repo = this.service.getRepoFromRoot(root);
|
|
5896
5952
|
let output = await repo.safeRun(["remote"]);
|
|
5897
5953
|
let remote = output.trim().split(/\r?\n/)[0];
|
|
5898
5954
|
if (!remote) {
|
|
5899
|
-
|
|
5955
|
+
import_coc10.window.showMessage(`remote not found`, "warning");
|
|
5900
5956
|
return;
|
|
5901
5957
|
}
|
|
5902
5958
|
output = await repo.safeRun(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
5903
5959
|
if (!output) {
|
|
5904
|
-
|
|
5960
|
+
import_coc10.window.showMessage(`current branch not found`, "warning");
|
|
5905
5961
|
return;
|
|
5906
5962
|
}
|
|
5907
|
-
await
|
|
5963
|
+
await import_coc10.window.runTerminalCommand(`git push ${remote} ${output}${extra.length ? " " + extra.join(" ") : ""}`, root, true);
|
|
5908
5964
|
}
|
|
5909
5965
|
get buffer() {
|
|
5910
|
-
return
|
|
5966
|
+
return import_coc10.workspace.nvim.call("bufnr", "%").then((bufnr) => {
|
|
5911
5967
|
let buf = this.buffers.get(bufnr);
|
|
5912
5968
|
if (!buf)
|
|
5913
|
-
|
|
5969
|
+
import_coc10.window.showMessage(`Cant't resolve git repository for current buffer.`, "warning");
|
|
5914
5970
|
return buf;
|
|
5915
5971
|
});
|
|
5916
5972
|
}
|
|
5917
5973
|
getBuffer(bufnr) {
|
|
5918
5974
|
return this.buffers.get(bufnr);
|
|
5919
5975
|
}
|
|
5976
|
+
async getDiffAll(category) {
|
|
5977
|
+
let bufnr = await import_coc10.workspace.nvim.call("bufnr", "%");
|
|
5978
|
+
let root = await this.resolveGitRootFromBufferOrCwd(bufnr);
|
|
5979
|
+
if (!root) {
|
|
5980
|
+
import_coc10.window.showMessage(`not belongs to git repository.`, "warning");
|
|
5981
|
+
return null;
|
|
5982
|
+
}
|
|
5983
|
+
let repo = this.service.getRepoFromRoot(root);
|
|
5984
|
+
return repo.getDiffAll(category);
|
|
5985
|
+
}
|
|
5920
5986
|
dispose() {
|
|
5921
5987
|
this.gitStatus.dispose();
|
|
5922
5988
|
this.service.dispose();
|
|
@@ -5924,18 +5990,18 @@ var DocumentManager = class {
|
|
|
5924
5990
|
buf.dispose();
|
|
5925
5991
|
}
|
|
5926
5992
|
this.buffers.clear();
|
|
5927
|
-
|
|
5993
|
+
import_coc10.disposeAll(this.disposables);
|
|
5928
5994
|
}
|
|
5929
5995
|
};
|
|
5930
5996
|
var manager_default = DocumentManager;
|
|
5931
5997
|
|
|
5932
5998
|
// src/model/service.ts
|
|
5933
|
-
var
|
|
5999
|
+
var import_coc14 = __toModule(require("coc.nvim"));
|
|
5934
6000
|
|
|
5935
6001
|
// src/model/repo.ts
|
|
5936
6002
|
var import_fs2 = __toModule(require("fs"));
|
|
5937
6003
|
var import_os = __toModule(require("os"));
|
|
5938
|
-
var
|
|
6004
|
+
var import_path5 = __toModule(require("path"));
|
|
5939
6005
|
var import_util6 = __toModule(require("util"));
|
|
5940
6006
|
|
|
5941
6007
|
// node_modules/uuid/dist/esm-node/rng.js
|
|
@@ -6111,9 +6177,9 @@ var Repo = class {
|
|
|
6111
6177
|
}
|
|
6112
6178
|
}
|
|
6113
6179
|
async getDiff(relFilepath, content, revision = "", encoding = "utf8") {
|
|
6114
|
-
if (relFilepath.startsWith(`.git${
|
|
6180
|
+
if (relFilepath.startsWith(`.git${import_path5.default.sep}`))
|
|
6115
6181
|
return;
|
|
6116
|
-
let fullpath =
|
|
6182
|
+
let fullpath = import_path5.default.join(this.root, relFilepath);
|
|
6117
6183
|
if (!import_fs2.default.existsSync(fullpath))
|
|
6118
6184
|
return;
|
|
6119
6185
|
let staged;
|
|
@@ -6129,8 +6195,8 @@ var Repo = class {
|
|
|
6129
6195
|
this.channel.append(e.stack);
|
|
6130
6196
|
return;
|
|
6131
6197
|
}
|
|
6132
|
-
const stagedFile =
|
|
6133
|
-
const currentFile =
|
|
6198
|
+
const stagedFile = import_path5.default.join(import_os.default.tmpdir(), `coc-${v4_default()}`);
|
|
6199
|
+
const currentFile = import_path5.default.join(import_os.default.tmpdir(), `coc-${v4_default()}`);
|
|
6134
6200
|
await import_util6.default.promisify(import_fs2.default.writeFile)(stagedFile, staged + "\n", "utf8");
|
|
6135
6201
|
await import_util6.default.promisify(import_fs2.default.writeFile)(currentFile, content, "utf8");
|
|
6136
6202
|
let output = await getStdout(`git --no-pager diff --no-ext-diff -p -U0 --no-color ${shellescape(stagedFile)} ${shellescape(currentFile)}`);
|
|
@@ -6139,7 +6205,48 @@ var Repo = class {
|
|
|
6139
6205
|
if (!output)
|
|
6140
6206
|
return [];
|
|
6141
6207
|
this.channel.appendLine(`> git diff ${relFilepath}`);
|
|
6142
|
-
|
|
6208
|
+
const lines = output.trim().split("\n");
|
|
6209
|
+
return parseDiff(lines);
|
|
6210
|
+
}
|
|
6211
|
+
async getDiffAll(category) {
|
|
6212
|
+
let diffGroups = new Map();
|
|
6213
|
+
let args = "";
|
|
6214
|
+
if (category === DiffCategory.All) {
|
|
6215
|
+
args = "HEAD";
|
|
6216
|
+
} else if (category === DiffCategory.Staged) {
|
|
6217
|
+
args = "--cached";
|
|
6218
|
+
} else {
|
|
6219
|
+
args = "";
|
|
6220
|
+
}
|
|
6221
|
+
let output = await getStdout(`git --no-pager diff --no-ext-diff -p -U0 --no-color ${args}`);
|
|
6222
|
+
if (!output)
|
|
6223
|
+
return diffGroups;
|
|
6224
|
+
const lines = output.trim().split("\n");
|
|
6225
|
+
let lineGroups = new Map();
|
|
6226
|
+
let file = null;
|
|
6227
|
+
for (const line of lines) {
|
|
6228
|
+
if (line.startsWith("diff --git")) {
|
|
6229
|
+
let ms = line.match(/diff\s--git\sa\/(.*)\sb\//);
|
|
6230
|
+
if (ms) {
|
|
6231
|
+
file = ms[1];
|
|
6232
|
+
} else {
|
|
6233
|
+
file = null;
|
|
6234
|
+
}
|
|
6235
|
+
}
|
|
6236
|
+
if (file) {
|
|
6237
|
+
if (!lineGroups.has(file)) {
|
|
6238
|
+
lineGroups.set(file, []);
|
|
6239
|
+
}
|
|
6240
|
+
lineGroups.get(file).push(line);
|
|
6241
|
+
}
|
|
6242
|
+
}
|
|
6243
|
+
for (const [file2, lines2] of lineGroups) {
|
|
6244
|
+
let diffs = parseDiff(lines2);
|
|
6245
|
+
if (diffs) {
|
|
6246
|
+
diffGroups.set(file2, diffs);
|
|
6247
|
+
}
|
|
6248
|
+
}
|
|
6249
|
+
return diffGroups;
|
|
6143
6250
|
}
|
|
6144
6251
|
async isIgnored(relativePath) {
|
|
6145
6252
|
let res = await this.safeRun(["check-ignore", "--", relativePath]);
|
|
@@ -6181,8 +6288,8 @@ var Repo = class {
|
|
|
6181
6288
|
}
|
|
6182
6289
|
};
|
|
6183
6290
|
var repo_default = Repo;
|
|
6184
|
-
function parseDiff(
|
|
6185
|
-
const allLines =
|
|
6291
|
+
function parseDiff(diffLines) {
|
|
6292
|
+
const allLines = diffLines.slice(4);
|
|
6186
6293
|
const diffs = [];
|
|
6187
6294
|
let diff = null;
|
|
6188
6295
|
for (const line of allLines) {
|
|
@@ -6242,9 +6349,9 @@ function parseDiff(diffStr) {
|
|
|
6242
6349
|
|
|
6243
6350
|
// src/model/git.ts
|
|
6244
6351
|
var cp = __toModule(require("child_process"));
|
|
6245
|
-
var
|
|
6352
|
+
var import_coc11 = __toModule(require("coc.nvim"));
|
|
6246
6353
|
var import_iconv_lite = __toModule(require_lib());
|
|
6247
|
-
var
|
|
6354
|
+
var import_path6 = __toModule(require("path"));
|
|
6248
6355
|
var Git = class {
|
|
6249
6356
|
constructor(gitInfo, channel) {
|
|
6250
6357
|
this.gitInfo = gitInfo;
|
|
@@ -6252,7 +6359,7 @@ var Git = class {
|
|
|
6252
6359
|
}
|
|
6253
6360
|
async getRepositoryRoot(repositoryPath) {
|
|
6254
6361
|
const result = await this.exec(repositoryPath, ["rev-parse", "--show-toplevel"]);
|
|
6255
|
-
return
|
|
6362
|
+
return import_path6.default.normalize(result.stdout.trim());
|
|
6256
6363
|
}
|
|
6257
6364
|
async exec(cwd, args, options = {}) {
|
|
6258
6365
|
options = Object.assign({cwd}, options || {});
|
|
@@ -6319,11 +6426,11 @@ async function exec2(child, cancellationToken) {
|
|
|
6319
6426
|
const disposables = [];
|
|
6320
6427
|
const once = (ee, name, fn) => {
|
|
6321
6428
|
ee.once(name, fn);
|
|
6322
|
-
disposables.push(
|
|
6429
|
+
disposables.push(import_coc11.Disposable.create(() => ee.removeListener(name, fn)));
|
|
6323
6430
|
};
|
|
6324
6431
|
const on = (ee, name, fn) => {
|
|
6325
6432
|
ee.on(name, fn);
|
|
6326
|
-
disposables.push(
|
|
6433
|
+
disposables.push(import_coc11.Disposable.create(() => ee.removeListener(name, fn)));
|
|
6327
6434
|
};
|
|
6328
6435
|
let result = Promise.all([
|
|
6329
6436
|
new Promise((c, e) => {
|
|
@@ -6357,14 +6464,14 @@ async function exec2(child, cancellationToken) {
|
|
|
6357
6464
|
const [exitCode, stdout, stderr] = await result;
|
|
6358
6465
|
return {exitCode, stdout, stderr};
|
|
6359
6466
|
} finally {
|
|
6360
|
-
|
|
6467
|
+
import_coc11.disposeAll(disposables);
|
|
6361
6468
|
}
|
|
6362
6469
|
}
|
|
6363
6470
|
|
|
6364
6471
|
// src/model/resolver.ts
|
|
6365
|
-
var
|
|
6472
|
+
var import_coc12 = __toModule(require("coc.nvim"));
|
|
6366
6473
|
var import_fs3 = __toModule(require("fs"));
|
|
6367
|
-
var
|
|
6474
|
+
var import_path7 = __toModule(require("path"));
|
|
6368
6475
|
var import_util9 = __toModule(require("util"));
|
|
6369
6476
|
async function getRealPath(fullpath) {
|
|
6370
6477
|
let resolved;
|
|
@@ -6373,7 +6480,7 @@ async function getRealPath(fullpath) {
|
|
|
6373
6480
|
} catch (e) {
|
|
6374
6481
|
if (e.message.includes("ENOENT")) {
|
|
6375
6482
|
try {
|
|
6376
|
-
resolved = await
|
|
6483
|
+
resolved = await import_coc12.workspace.nvim.call("expand", [fullpath]);
|
|
6377
6484
|
} catch (e2) {
|
|
6378
6485
|
}
|
|
6379
6486
|
}
|
|
@@ -6414,20 +6521,20 @@ var Resolver = class {
|
|
|
6414
6521
|
if (doc.buftype != "" || doc.schema != "file") {
|
|
6415
6522
|
return null;
|
|
6416
6523
|
}
|
|
6417
|
-
let fullpath = await getRealPath(
|
|
6524
|
+
let fullpath = await getRealPath(import_coc12.Uri.parse(uri).fsPath);
|
|
6418
6525
|
if (process.platform == "win32") {
|
|
6419
|
-
fullpath =
|
|
6526
|
+
fullpath = import_path7.default.win32.normalize(fullpath);
|
|
6420
6527
|
}
|
|
6421
6528
|
if (!root) {
|
|
6422
|
-
let parts = fullpath.split(
|
|
6529
|
+
let parts = fullpath.split(import_path7.default.sep);
|
|
6423
6530
|
let idx = parts.indexOf(".git");
|
|
6424
6531
|
if (idx !== -1) {
|
|
6425
|
-
root = parts.slice(0, idx).join(
|
|
6532
|
+
root = parts.slice(0, idx).join(import_path7.default.sep);
|
|
6426
6533
|
this.resolvedRoots.set(uri, root);
|
|
6427
6534
|
} else {
|
|
6428
6535
|
try {
|
|
6429
|
-
root = await this.git.getRepositoryRoot(
|
|
6430
|
-
if (
|
|
6536
|
+
root = await this.git.getRepositoryRoot(import_path7.default.dirname(fullpath));
|
|
6537
|
+
if (import_path7.default.isAbsolute(root)) {
|
|
6431
6538
|
this.resolvedRoots.set(uri, root);
|
|
6432
6539
|
} else {
|
|
6433
6540
|
root = void 0;
|
|
@@ -6437,18 +6544,18 @@ var Resolver = class {
|
|
|
6437
6544
|
}
|
|
6438
6545
|
}
|
|
6439
6546
|
if (root) {
|
|
6440
|
-
this.relativePaths.set(uri,
|
|
6547
|
+
this.relativePaths.set(uri, import_path7.default.relative(root, fullpath));
|
|
6441
6548
|
}
|
|
6442
6549
|
this.channel.appendLine(`resolved root of ${fullpath}: ${root}`);
|
|
6443
6550
|
return root;
|
|
6444
6551
|
}
|
|
6445
6552
|
async resolveRootFromCwd() {
|
|
6446
|
-
let parts =
|
|
6553
|
+
let parts = import_coc12.workspace.cwd.split(import_path7.default.sep);
|
|
6447
6554
|
let idx = parts.indexOf(".git");
|
|
6448
6555
|
if (idx !== -1)
|
|
6449
|
-
return parts.slice(0, idx).join(
|
|
6556
|
+
return parts.slice(0, idx).join(import_path7.default.sep);
|
|
6450
6557
|
try {
|
|
6451
|
-
return await this.git.getRepositoryRoot(
|
|
6558
|
+
return await this.git.getRepositoryRoot(import_coc12.workspace.cwd);
|
|
6452
6559
|
} catch (e) {
|
|
6453
6560
|
}
|
|
6454
6561
|
return null;
|
|
@@ -6461,7 +6568,7 @@ var Resolver = class {
|
|
|
6461
6568
|
var resolver_default = Resolver;
|
|
6462
6569
|
|
|
6463
6570
|
// src/model/buffer.ts
|
|
6464
|
-
var
|
|
6571
|
+
var import_coc13 = __toModule(require("coc.nvim"));
|
|
6465
6572
|
var import_debounce2 = __toModule(require_debounce());
|
|
6466
6573
|
|
|
6467
6574
|
// node_modules/timeago.js/esm/lang/en_US.js
|
|
@@ -6559,7 +6666,7 @@ var GitBuffer = class {
|
|
|
6559
6666
|
this.hasConflicts = false;
|
|
6560
6667
|
this.foldEnabled = false;
|
|
6561
6668
|
this._disposed = false;
|
|
6562
|
-
this.mutex = new
|
|
6669
|
+
this.mutex = new import_coc13.Mutex();
|
|
6563
6670
|
this.refresh = import_debounce2.default(() => {
|
|
6564
6671
|
this._refresh().catch((e) => {
|
|
6565
6672
|
channel.append(`[Error] ${e.message}`);
|
|
@@ -6607,7 +6714,7 @@ var GitBuffer = class {
|
|
|
6607
6714
|
});
|
|
6608
6715
|
}
|
|
6609
6716
|
async chunkUndo() {
|
|
6610
|
-
let line = await
|
|
6717
|
+
let line = await import_coc13.workspace.nvim.call("line", ".");
|
|
6611
6718
|
let diff = this.getChunk(line);
|
|
6612
6719
|
if (!diff)
|
|
6613
6720
|
return;
|
|
@@ -6627,10 +6734,10 @@ var GitBuffer = class {
|
|
|
6627
6734
|
}
|
|
6628
6735
|
async chunkStage() {
|
|
6629
6736
|
let relpath = toUnixSlash(this.relpath);
|
|
6630
|
-
let line = await
|
|
6737
|
+
let line = await import_coc13.workspace.nvim.call("line", ".");
|
|
6631
6738
|
let diff = this.getChunk(line);
|
|
6632
6739
|
if (!diff) {
|
|
6633
|
-
|
|
6740
|
+
import_coc13.window.showMessage("Not positioned in git chunk", "error");
|
|
6634
6741
|
return;
|
|
6635
6742
|
}
|
|
6636
6743
|
let head;
|
|
@@ -6658,7 +6765,7 @@ var GitBuffer = class {
|
|
|
6658
6765
|
}
|
|
6659
6766
|
}
|
|
6660
6767
|
async chunkUnstage() {
|
|
6661
|
-
let {nvim} =
|
|
6768
|
+
let {nvim} = import_coc13.workspace;
|
|
6662
6769
|
const {diffs} = this;
|
|
6663
6770
|
let line = await nvim.call("line", ".");
|
|
6664
6771
|
let adjust = 0;
|
|
@@ -6666,7 +6773,7 @@ var GitBuffer = class {
|
|
|
6666
6773
|
for (let diff of diffs) {
|
|
6667
6774
|
if (diff.end >= line) {
|
|
6668
6775
|
if (diff.start <= line && diff.changeType != ChangeType.Delete) {
|
|
6669
|
-
|
|
6776
|
+
import_coc13.window.showErrorMessage(`Current line contains unstaged change.`);
|
|
6670
6777
|
invalid = true;
|
|
6671
6778
|
}
|
|
6672
6779
|
break;
|
|
@@ -6680,12 +6787,12 @@ var GitBuffer = class {
|
|
|
6680
6787
|
let stagedDiff = await this.repo.getStagedChunks(this.relpath);
|
|
6681
6788
|
let chunks = Object.values(stagedDiff)[0];
|
|
6682
6789
|
if (!chunks.length) {
|
|
6683
|
-
|
|
6790
|
+
import_coc13.window.showErrorMessage(`Staged chunk not found`);
|
|
6684
6791
|
return;
|
|
6685
6792
|
}
|
|
6686
6793
|
let chunk = chunks.find((o) => o.add.lnum <= line && o.add.lnum + o.add.count >= line);
|
|
6687
6794
|
if (!chunk) {
|
|
6688
|
-
|
|
6795
|
+
import_coc13.window.showErrorMessage(`Unable to find staged chunk on current line`);
|
|
6689
6796
|
return;
|
|
6690
6797
|
}
|
|
6691
6798
|
this.channel.appendLine(`[Info] resolved chunk ${JSON.stringify(chunk, null, 2)}`);
|
|
@@ -6696,44 +6803,44 @@ var GitBuffer = class {
|
|
|
6696
6803
|
await this.git.exec(this.repo.root, ["apply", "--cached", "--unidiff-zero", "-"], {input: patch});
|
|
6697
6804
|
this.refresh();
|
|
6698
6805
|
} catch (e) {
|
|
6699
|
-
|
|
6806
|
+
import_coc13.window.showErrorMessage(`Unable to apply patch: ${e.message}`);
|
|
6700
6807
|
this.channel.appendLine(`[Error] ${e.message}`);
|
|
6701
6808
|
}
|
|
6702
6809
|
}
|
|
6703
6810
|
async nextChunk() {
|
|
6704
6811
|
const {diffs} = this;
|
|
6705
|
-
let {nvim} =
|
|
6812
|
+
let {nvim} = import_coc13.workspace;
|
|
6706
6813
|
if (!diffs || diffs.length == 0)
|
|
6707
6814
|
return;
|
|
6708
6815
|
let line = await nvim.call("line", ".");
|
|
6709
6816
|
for (let diff of diffs) {
|
|
6710
6817
|
if (diff.start > line) {
|
|
6711
|
-
await
|
|
6818
|
+
await import_coc13.window.moveTo({line: Math.max(diff.start - 1, 0), character: 0});
|
|
6712
6819
|
return;
|
|
6713
6820
|
}
|
|
6714
6821
|
}
|
|
6715
6822
|
if (await nvim.getOption("wrapscan")) {
|
|
6716
|
-
await
|
|
6823
|
+
await import_coc13.window.moveTo({line: Math.max(diffs[0].start - 1, 0), character: 0});
|
|
6717
6824
|
}
|
|
6718
6825
|
}
|
|
6719
6826
|
async prevChunk() {
|
|
6720
|
-
const {nvim} =
|
|
6827
|
+
const {nvim} = import_coc13.workspace;
|
|
6721
6828
|
let {diffs} = this;
|
|
6722
6829
|
let line = await nvim.call("line", ".");
|
|
6723
6830
|
if (!diffs || diffs.length == 0)
|
|
6724
6831
|
return;
|
|
6725
6832
|
for (let diff of diffs.slice().reverse()) {
|
|
6726
6833
|
if (diff.end < line) {
|
|
6727
|
-
await
|
|
6834
|
+
await import_coc13.window.moveTo({line: Math.max(diff.start - 1, 0), character: 0});
|
|
6728
6835
|
return;
|
|
6729
6836
|
}
|
|
6730
6837
|
}
|
|
6731
6838
|
if (await nvim.getOption("wrapscan")) {
|
|
6732
|
-
await
|
|
6839
|
+
await import_coc13.window.moveTo({line: Math.max(diffs[diffs.length - 1].start - 1, 0), character: 0});
|
|
6733
6840
|
}
|
|
6734
6841
|
}
|
|
6735
6842
|
async chunkInfo() {
|
|
6736
|
-
let line = await
|
|
6843
|
+
let line = await import_coc13.workspace.nvim.call("line", ".");
|
|
6737
6844
|
let diff = this.getChunk(line);
|
|
6738
6845
|
if (diff) {
|
|
6739
6846
|
let content = diff.head + "\n" + diff.lines.join("\n");
|
|
@@ -6766,7 +6873,7 @@ var GitBuffer = class {
|
|
|
6766
6873
|
}
|
|
6767
6874
|
}
|
|
6768
6875
|
async showBlameInfo(lnum) {
|
|
6769
|
-
let {nvim} =
|
|
6876
|
+
let {nvim} = import_coc13.workspace;
|
|
6770
6877
|
let {virtualTextSrcId, addGBlameToBufferVar, addGBlameToVirtualText} = this.config;
|
|
6771
6878
|
if (!this.showBlame)
|
|
6772
6879
|
return;
|
|
@@ -6807,7 +6914,7 @@ var GitBuffer = class {
|
|
|
6807
6914
|
async showBlameDoc(lnum) {
|
|
6808
6915
|
let indexed = await this.repo.isIndexed(this.relpath);
|
|
6809
6916
|
if (!indexed) {
|
|
6810
|
-
|
|
6917
|
+
import_coc13.window.showMessage("File not indexed");
|
|
6811
6918
|
} else {
|
|
6812
6919
|
let infos = await this.getBlameInfo();
|
|
6813
6920
|
let info = infos.find((o) => lnum >= o.startLnum && lnum <= o.endLnum);
|
|
@@ -6818,13 +6925,13 @@ var GitBuffer = class {
|
|
|
6818
6925
|
blameText.push(`${info.sha.substring(0, 7)}`);
|
|
6819
6926
|
await this.showDoc(blameText.join("\n\n"), "text");
|
|
6820
6927
|
} else {
|
|
6821
|
-
|
|
6928
|
+
import_coc13.window.showMessage("Not committed yet");
|
|
6822
6929
|
}
|
|
6823
6930
|
}
|
|
6824
6931
|
}
|
|
6825
6932
|
async diffDocument(force = false) {
|
|
6826
6933
|
var _a;
|
|
6827
|
-
let {nvim} =
|
|
6934
|
+
let {nvim} = import_coc13.workspace;
|
|
6828
6935
|
let revision = this.config.diffRevision;
|
|
6829
6936
|
const {bufnr} = this.doc;
|
|
6830
6937
|
let content = this.doc.content;
|
|
@@ -6905,7 +7012,7 @@ var GitBuffer = class {
|
|
|
6905
7012
|
return;
|
|
6906
7013
|
if (!this.config.enableGutters)
|
|
6907
7014
|
return;
|
|
6908
|
-
let {nvim} =
|
|
7015
|
+
let {nvim} = import_coc13.workspace;
|
|
6909
7016
|
let {bufnr} = this.doc;
|
|
6910
7017
|
let {signPriority} = this.config;
|
|
6911
7018
|
let signs = this.currentSigns;
|
|
@@ -6942,6 +7049,9 @@ var GitBuffer = class {
|
|
|
6942
7049
|
let info;
|
|
6943
7050
|
for (let line of r.stdout.trim().split(/\r?\n/)) {
|
|
6944
7051
|
line = line.trim();
|
|
7052
|
+
if (line.startsWith("External file (--contents)")) {
|
|
7053
|
+
line = "Not committed yet.";
|
|
7054
|
+
}
|
|
6945
7055
|
let ms = line.match(/^([A-Za-z0-9]+)\s(\d+)\s(\d+)\s(\d+)/);
|
|
6946
7056
|
if (ms) {
|
|
6947
7057
|
let startLnum = parseInt(ms[3], 10);
|
|
@@ -6978,10 +7088,10 @@ var GitBuffer = class {
|
|
|
6978
7088
|
async diffCached() {
|
|
6979
7089
|
let res = await this.repo.safeRun(["diff", "--cached"]);
|
|
6980
7090
|
if (!res.trim()) {
|
|
6981
|
-
|
|
7091
|
+
import_coc13.window.showMessage("Empty diff");
|
|
6982
7092
|
return;
|
|
6983
7093
|
}
|
|
6984
|
-
let {nvim} =
|
|
7094
|
+
let {nvim} = import_coc13.workspace;
|
|
6985
7095
|
nvim.pauseNotification();
|
|
6986
7096
|
nvim.command(`keepalt above new +setl\\ previewwindow`, true);
|
|
6987
7097
|
nvim.call("append", [0, res.split(/\r?\n/)], true);
|
|
@@ -6992,44 +7102,44 @@ var GitBuffer = class {
|
|
|
6992
7102
|
await nvim.resumeNotification();
|
|
6993
7103
|
}
|
|
6994
7104
|
async nextConflict() {
|
|
6995
|
-
let {nvim} =
|
|
7105
|
+
let {nvim} = import_coc13.workspace;
|
|
6996
7106
|
if (!this.conflicts.length) {
|
|
6997
|
-
|
|
7107
|
+
import_coc13.window.showMessage("No conflicts detected", "warning");
|
|
6998
7108
|
return;
|
|
6999
7109
|
}
|
|
7000
7110
|
let line = await nvim.call("line", ".");
|
|
7001
7111
|
for (let conflict of this.conflicts) {
|
|
7002
7112
|
if (conflict.start > line) {
|
|
7003
|
-
await
|
|
7113
|
+
await import_coc13.window.moveTo({line: Math.max(conflict.start - 1, 0), character: 0});
|
|
7004
7114
|
return;
|
|
7005
7115
|
}
|
|
7006
7116
|
}
|
|
7007
7117
|
if (await nvim.getOption("wrapscan")) {
|
|
7008
|
-
await
|
|
7118
|
+
await import_coc13.window.moveTo({line: Math.max(this.conflicts[0].start - 1, 0), character: 0});
|
|
7009
7119
|
}
|
|
7010
7120
|
}
|
|
7011
7121
|
async prevConflict() {
|
|
7012
|
-
let {nvim} =
|
|
7122
|
+
let {nvim} = import_coc13.workspace;
|
|
7013
7123
|
if (!this.conflicts.length) {
|
|
7014
|
-
|
|
7124
|
+
import_coc13.window.showMessage("No conflicts detected", "warning");
|
|
7015
7125
|
return;
|
|
7016
7126
|
}
|
|
7017
7127
|
let line = await nvim.call("line", ".");
|
|
7018
7128
|
for (let conflict of this.conflicts) {
|
|
7019
7129
|
if (conflict.start > line) {
|
|
7020
|
-
await
|
|
7130
|
+
await import_coc13.window.moveTo({line: Math.max(conflict.start - 1, 0), character: 0});
|
|
7021
7131
|
return;
|
|
7022
7132
|
}
|
|
7023
7133
|
}
|
|
7024
7134
|
if (await nvim.getOption("wrapscan")) {
|
|
7025
|
-
await
|
|
7135
|
+
await import_coc13.window.moveTo({line: Math.max(this.conflicts[0].start - 1, 0), character: 0});
|
|
7026
7136
|
}
|
|
7027
7137
|
}
|
|
7028
7138
|
async conflictKeepPart(part) {
|
|
7029
|
-
const {nvim} =
|
|
7139
|
+
const {nvim} = import_coc13.workspace;
|
|
7030
7140
|
let conflicts = this.conflicts;
|
|
7031
7141
|
if (!conflicts || conflicts.length == 0) {
|
|
7032
|
-
|
|
7142
|
+
import_coc13.window.showMessage("No conflicts detected");
|
|
7033
7143
|
return;
|
|
7034
7144
|
}
|
|
7035
7145
|
let line = await nvim.call("line", ".");
|
|
@@ -7049,11 +7159,11 @@ var GitBuffer = class {
|
|
|
7049
7159
|
}
|
|
7050
7160
|
}
|
|
7051
7161
|
}
|
|
7052
|
-
|
|
7162
|
+
import_coc13.window.showMessage("Not positioned on a conflict");
|
|
7053
7163
|
}
|
|
7054
7164
|
async browser(action = "open", range, permalink = false) {
|
|
7055
|
-
let {nvim} =
|
|
7056
|
-
let config =
|
|
7165
|
+
let {nvim} = import_coc13.workspace;
|
|
7166
|
+
let config = import_coc13.workspace.getConfiguration("git");
|
|
7057
7167
|
let head = (await this.repo.safeRun(["rev-parse", "HEAD"])).trim();
|
|
7058
7168
|
let branch = config.get("browserBranchName", "").trim();
|
|
7059
7169
|
if (!branch.length) {
|
|
@@ -7072,7 +7182,7 @@ var GitBuffer = class {
|
|
|
7072
7182
|
}
|
|
7073
7183
|
let output = await this.repo.safeRun(["remote"]);
|
|
7074
7184
|
if (!output.trim()) {
|
|
7075
|
-
|
|
7185
|
+
import_coc13.window.showMessage(`No remote found`, "warning");
|
|
7076
7186
|
return;
|
|
7077
7187
|
}
|
|
7078
7188
|
let names = output.trim().split(/\r?\n/);
|
|
@@ -7081,13 +7191,13 @@ var GitBuffer = class {
|
|
|
7081
7191
|
if (names.includes(browserRemoteName)) {
|
|
7082
7192
|
names = [browserRemoteName];
|
|
7083
7193
|
} else {
|
|
7084
|
-
|
|
7194
|
+
import_coc13.window.showMessage("Configured git.browserRemoteName missing from remote list", "warning");
|
|
7085
7195
|
return;
|
|
7086
7196
|
}
|
|
7087
7197
|
}
|
|
7088
7198
|
let urls = [];
|
|
7089
7199
|
for (let name of names) {
|
|
7090
|
-
let uri = await this.repo.safeRun(["
|
|
7200
|
+
let uri = await this.repo.safeRun(["config", "--get", `remote.${name}.url`]);
|
|
7091
7201
|
if (!uri.length)
|
|
7092
7202
|
continue;
|
|
7093
7203
|
let repoURL = getRepoUrl(uri);
|
|
@@ -7104,19 +7214,19 @@ var GitBuffer = class {
|
|
|
7104
7214
|
}
|
|
7105
7215
|
if (urls.length == 1) {
|
|
7106
7216
|
if (action == "open") {
|
|
7107
|
-
await
|
|
7217
|
+
await import_coc13.workspace.openResource(urls[0]);
|
|
7108
7218
|
} else {
|
|
7109
7219
|
nvim.command(`let @+ = '${urls[0]}'`, true);
|
|
7110
|
-
|
|
7220
|
+
import_coc13.window.showMessage("Copied url to clipboard");
|
|
7111
7221
|
}
|
|
7112
7222
|
} else if (urls.length > 1) {
|
|
7113
|
-
let idx = await
|
|
7223
|
+
let idx = await import_coc13.window.showQuickpick(urls, "Select url:");
|
|
7114
7224
|
if (idx >= 0) {
|
|
7115
7225
|
if (action == "open") {
|
|
7116
|
-
await
|
|
7226
|
+
await import_coc13.workspace.openResource(urls[idx]);
|
|
7117
7227
|
} else {
|
|
7118
7228
|
nvim.command(`let @+ = '${urls[idx]}'`, true);
|
|
7119
|
-
|
|
7229
|
+
import_coc13.window.showMessage("Copied url to clipboard");
|
|
7120
7230
|
}
|
|
7121
7231
|
}
|
|
7122
7232
|
}
|
|
@@ -7124,10 +7234,10 @@ var GitBuffer = class {
|
|
|
7124
7234
|
async showCommit() {
|
|
7125
7235
|
let indexed = await this.repo.isIndexed(this.relpath);
|
|
7126
7236
|
if (!indexed) {
|
|
7127
|
-
|
|
7237
|
+
import_coc13.window.showMessage(`"${this.relpath}" not indexed.`, "warning");
|
|
7128
7238
|
return;
|
|
7129
7239
|
}
|
|
7130
|
-
let nvim =
|
|
7240
|
+
let nvim = import_coc13.workspace.nvim;
|
|
7131
7241
|
let line = await nvim.eval('line(".")');
|
|
7132
7242
|
let args = ["--no-pager", "blame", "-l", "--root", "-t", `-L${line},${line}`, this.relpath];
|
|
7133
7243
|
let res = await this.repo.exec(args);
|
|
@@ -7136,7 +7246,7 @@ var GitBuffer = class {
|
|
|
7136
7246
|
return;
|
|
7137
7247
|
let commit = output.match(/^\S+/)[0];
|
|
7138
7248
|
if (/^0+$/.test(commit)) {
|
|
7139
|
-
|
|
7249
|
+
import_coc13.window.showMessage("not committed yet!", "warning");
|
|
7140
7250
|
return;
|
|
7141
7251
|
}
|
|
7142
7252
|
let useFloating = this.config.showCommitInFloating;
|
|
@@ -7167,16 +7277,16 @@ var GitBuffer = class {
|
|
|
7167
7277
|
}
|
|
7168
7278
|
}
|
|
7169
7279
|
async toggleFold() {
|
|
7170
|
-
let {nvim} =
|
|
7280
|
+
let {nvim} = import_coc13.workspace;
|
|
7171
7281
|
let buf = this.doc.buffer;
|
|
7172
7282
|
let win = await nvim.window;
|
|
7173
7283
|
let bufnr = buf.id;
|
|
7174
|
-
let doc =
|
|
7284
|
+
let doc = import_coc13.workspace.getDocument(bufnr);
|
|
7175
7285
|
if (!doc)
|
|
7176
7286
|
return;
|
|
7177
7287
|
let infos = this.currentSigns;
|
|
7178
7288
|
if (!infos || infos.length == 0) {
|
|
7179
|
-
|
|
7289
|
+
import_coc13.window.showMessage("No changes", "warning");
|
|
7180
7290
|
return;
|
|
7181
7291
|
}
|
|
7182
7292
|
let lnums = infos.map((o) => o.lnum);
|
|
@@ -7234,7 +7344,7 @@ var GitBuffer = class {
|
|
|
7234
7344
|
}
|
|
7235
7345
|
async toggleGutters(enabled) {
|
|
7236
7346
|
this.config.enableGutters = enabled;
|
|
7237
|
-
let {nvim} =
|
|
7347
|
+
let {nvim} = import_coc13.workspace;
|
|
7238
7348
|
if (!enabled) {
|
|
7239
7349
|
nvim.call("sign_unplace", [signGroup, {buffer: this.doc.bufnr}], true);
|
|
7240
7350
|
} else {
|
|
@@ -7319,7 +7429,7 @@ var GitBuffer = class {
|
|
|
7319
7429
|
let buffer = this.doc.buffer;
|
|
7320
7430
|
let currentHlGroup = this.config.conflict.currentHlGroup;
|
|
7321
7431
|
let incomingHlGroup = this.config.conflict.incomingHlGroup;
|
|
7322
|
-
let {nvim} =
|
|
7432
|
+
let {nvim} = import_coc13.workspace;
|
|
7323
7433
|
nvim.pauseNotification();
|
|
7324
7434
|
buffer.clearNamespace(this.config.conflictSrcId, 0, -1);
|
|
7325
7435
|
conflicts.map((conflict) => {
|
|
@@ -7345,7 +7455,7 @@ var GitBuffer = class {
|
|
|
7345
7455
|
await this.floatFactory.show(docs, this.config.floatConfig);
|
|
7346
7456
|
} else {
|
|
7347
7457
|
const lines = content.split("\n");
|
|
7348
|
-
|
|
7458
|
+
import_coc13.workspace.nvim.call("coc#ui#preview_info", [lines, "diff"], true);
|
|
7349
7459
|
}
|
|
7350
7460
|
}
|
|
7351
7461
|
setBufferStatus(status) {
|
|
@@ -7353,7 +7463,7 @@ var GitBuffer = class {
|
|
|
7353
7463
|
if (exists == status)
|
|
7354
7464
|
return;
|
|
7355
7465
|
this.gitStatus = status;
|
|
7356
|
-
let {nvim} =
|
|
7466
|
+
let {nvim} = import_coc13.workspace;
|
|
7357
7467
|
let buffer = nvim.createBuffer(this.doc.bufnr);
|
|
7358
7468
|
nvim.pauseNotification();
|
|
7359
7469
|
buffer.setVar("coc_git_status", status, true);
|
|
@@ -7379,7 +7489,7 @@ var GitBuffer = class {
|
|
|
7379
7489
|
return this.config.addGBlameToVirtualText || this.config.addGBlameToBufferVar;
|
|
7380
7490
|
}
|
|
7381
7491
|
dispose() {
|
|
7382
|
-
let {nvim} =
|
|
7492
|
+
let {nvim} = import_coc13.workspace;
|
|
7383
7493
|
let {bufnr} = this.doc;
|
|
7384
7494
|
let buffer = nvim.createBuffer(bufnr);
|
|
7385
7495
|
buffer.setVar("coc_git_status", "", true);
|
|
@@ -7403,15 +7513,15 @@ var GitBuffer = class {
|
|
|
7403
7513
|
var buffer_default = GitBuffer;
|
|
7404
7514
|
|
|
7405
7515
|
// src/model/service.ts
|
|
7406
|
-
var
|
|
7516
|
+
var import_path8 = __toModule(require("path"));
|
|
7407
7517
|
var GitService = class {
|
|
7408
7518
|
constructor(gitInfo) {
|
|
7409
7519
|
this.repos = new Map();
|
|
7410
|
-
const outputChannel = this.outputChannel =
|
|
7520
|
+
const outputChannel = this.outputChannel = import_coc14.window.createOutputChannel("git");
|
|
7411
7521
|
this._git = new git_default(gitInfo, outputChannel);
|
|
7412
7522
|
this._resolver = new resolver_default(this._git, outputChannel);
|
|
7413
|
-
if (typeof
|
|
7414
|
-
this.floatFactory =
|
|
7523
|
+
if (typeof import_coc14.window.createFloatFactory === "function") {
|
|
7524
|
+
this.floatFactory = import_coc14.window.createFloatFactory({modes: ["n"]});
|
|
7415
7525
|
}
|
|
7416
7526
|
}
|
|
7417
7527
|
getRepoFromRoot(root) {
|
|
@@ -7438,11 +7548,11 @@ var GitService = class {
|
|
|
7438
7548
|
return new buffer_default(doc, config, relpath, repo, this.git, this.outputChannel, this.floatFactory);
|
|
7439
7549
|
}
|
|
7440
7550
|
async getCurrentRepo() {
|
|
7441
|
-
let {nvim} =
|
|
7551
|
+
let {nvim} = import_coc14.workspace;
|
|
7442
7552
|
let [fullpath, buftype] = await nvim.eval('[expand("%:p"),&buftype]');
|
|
7443
|
-
if (!
|
|
7553
|
+
if (!import_path8.default.isAbsolute(fullpath) || buftype != "")
|
|
7444
7554
|
return void 0;
|
|
7445
|
-
let root = await this.resolver.resolveGitRoot({uri:
|
|
7555
|
+
let root = await this.resolver.resolveGitRoot({uri: import_coc14.Uri.file(fullpath).toString(), schema: "file", buftype: ""});
|
|
7446
7556
|
if (root == null)
|
|
7447
7557
|
return void 0;
|
|
7448
7558
|
return this.getRepoFromRoot(root);
|
|
@@ -7467,15 +7577,15 @@ var GitService = class {
|
|
|
7467
7577
|
var service_default = GitService;
|
|
7468
7578
|
|
|
7469
7579
|
// src/source.ts
|
|
7470
|
-
var
|
|
7471
|
-
var
|
|
7580
|
+
var import_coc15 = __toModule(require("coc.nvim"));
|
|
7581
|
+
var import_safe5 = __toModule(require_safe());
|
|
7472
7582
|
function byteSlice(content, start, end) {
|
|
7473
7583
|
let buf = Buffer.from(content, "utf8");
|
|
7474
7584
|
return buf.slice(start, end).toString("utf8");
|
|
7475
7585
|
}
|
|
7476
7586
|
var issuesMap = new Map();
|
|
7477
7587
|
function issuesFiletypes() {
|
|
7478
|
-
return
|
|
7588
|
+
return import_coc15.workspace.getConfiguration().get("coc.source.issues.filetypes");
|
|
7479
7589
|
}
|
|
7480
7590
|
function getOrganizationNameAndRepoNameFromGitHubRemoteUrl(remoteUrl) {
|
|
7481
7591
|
try {
|
|
@@ -7514,7 +7624,7 @@ function renderWord(issue, issueFormat) {
|
|
|
7514
7624
|
}
|
|
7515
7625
|
function addSource(context, resolver) {
|
|
7516
7626
|
let {subscriptions, logger} = context;
|
|
7517
|
-
let statusItem =
|
|
7627
|
+
let statusItem = import_coc15.window.createStatusBarItem(0, {progress: true});
|
|
7518
7628
|
statusItem.text = "loading issues";
|
|
7519
7629
|
let statusItemCounter = 0;
|
|
7520
7630
|
function onStartLoading() {
|
|
@@ -7557,7 +7667,7 @@ function addSource(context, resolver) {
|
|
|
7557
7667
|
const pageUri = `${uri}&page=${pageIndex}`;
|
|
7558
7668
|
pageIndex++;
|
|
7559
7669
|
try {
|
|
7560
|
-
let info = await
|
|
7670
|
+
let info = await import_coc15.fetch(pageUri, {headers: {"Private-Token": token}});
|
|
7561
7671
|
if (!info.length) {
|
|
7562
7672
|
break;
|
|
7563
7673
|
}
|
|
@@ -7593,7 +7703,7 @@ function addSource(context, resolver) {
|
|
|
7593
7703
|
let page_uri = `${uri}&page=${page_idx}`;
|
|
7594
7704
|
page_idx++;
|
|
7595
7705
|
try {
|
|
7596
|
-
let info = await
|
|
7706
|
+
let info = await import_coc15.fetch(page_uri, {headers});
|
|
7597
7707
|
if (info.length == 0) {
|
|
7598
7708
|
break;
|
|
7599
7709
|
}
|
|
@@ -7618,7 +7728,7 @@ function addSource(context, resolver) {
|
|
|
7618
7728
|
return issues;
|
|
7619
7729
|
}
|
|
7620
7730
|
async function loadIssues(root) {
|
|
7621
|
-
let config =
|
|
7731
|
+
let config = import_coc15.workspace.getConfiguration("git", root);
|
|
7622
7732
|
const issueSources = (await safeRun(`git config --get coc-git.issuesources`, {cwd: root}) || "").trim();
|
|
7623
7733
|
if (issueSources) {
|
|
7624
7734
|
return Array.prototype.concat.apply([], await Promise.all(issueSources.split(",").map((issueSource) => {
|
|
@@ -7632,7 +7742,7 @@ function addSource(context, resolver) {
|
|
|
7632
7742
|
})));
|
|
7633
7743
|
}
|
|
7634
7744
|
let remoteName = config.get("remoteName", "origin");
|
|
7635
|
-
let res = await safeRun(`git
|
|
7745
|
+
let res = await safeRun(`git config --get remote.${remoteName}.url`, {cwd: root});
|
|
7636
7746
|
res = res.trim();
|
|
7637
7747
|
if (res.indexOf("github.com") > 0) {
|
|
7638
7748
|
const organizationNameAndRepoName = getOrganizationNameAndRepoNameFromGitHubRemoteUrl(res);
|
|
@@ -7661,14 +7771,14 @@ function addSource(context, resolver) {
|
|
|
7661
7771
|
}
|
|
7662
7772
|
}).catch(onError);
|
|
7663
7773
|
};
|
|
7664
|
-
for (let doc of
|
|
7774
|
+
for (let doc of import_coc15.workspace.documents) {
|
|
7665
7775
|
if (issuesFiletypes().includes(doc.filetype)) {
|
|
7666
7776
|
loadIssuesFromDocument(doc);
|
|
7667
7777
|
}
|
|
7668
7778
|
}
|
|
7669
|
-
|
|
7779
|
+
import_coc15.workspace.onDidOpenTextDocument(async (e) => {
|
|
7670
7780
|
if (issuesFiletypes().includes(e.languageId)) {
|
|
7671
|
-
let doc =
|
|
7781
|
+
let doc = import_coc15.workspace.getDocument(e.uri);
|
|
7672
7782
|
loadIssuesFromDocument(doc);
|
|
7673
7783
|
}
|
|
7674
7784
|
}, null, subscriptions);
|
|
@@ -7677,7 +7787,7 @@ function addSource(context, resolver) {
|
|
|
7677
7787
|
async doComplete(opt) {
|
|
7678
7788
|
let pre = byteSlice(opt.line, 0, opt.colnr - 1);
|
|
7679
7789
|
if (pre && pre.endsWith("#")) {
|
|
7680
|
-
const config =
|
|
7790
|
+
const config = import_coc15.workspace.getConfiguration("git");
|
|
7681
7791
|
const issueFormat = config.get("issueFormat", "#%i");
|
|
7682
7792
|
let issues = issuesMap.get(opt.bufnr);
|
|
7683
7793
|
if (!issues || issues.length == 0)
|
|
@@ -7703,14 +7813,14 @@ function addSource(context, resolver) {
|
|
|
7703
7813
|
};
|
|
7704
7814
|
}
|
|
7705
7815
|
};
|
|
7706
|
-
subscriptions.push(
|
|
7816
|
+
subscriptions.push(import_coc15.sources.createSource(source));
|
|
7707
7817
|
let list = {
|
|
7708
7818
|
name: "issues",
|
|
7709
7819
|
actions: [{
|
|
7710
7820
|
name: "open",
|
|
7711
7821
|
execute: async (item) => {
|
|
7712
7822
|
let {url} = item.data;
|
|
7713
|
-
await
|
|
7823
|
+
await import_coc15.workspace.openResource(url);
|
|
7714
7824
|
},
|
|
7715
7825
|
multiple: false
|
|
7716
7826
|
}, {
|
|
@@ -7720,7 +7830,7 @@ function addSource(context, resolver) {
|
|
|
7720
7830
|
let {body, id} = item.data;
|
|
7721
7831
|
let lines = body.split(/\r?\n/);
|
|
7722
7832
|
let mod = context2.options.position == "top" ? "below" : "above";
|
|
7723
|
-
let {nvim} =
|
|
7833
|
+
let {nvim} = import_coc15.workspace;
|
|
7724
7834
|
nvim.pauseNotification();
|
|
7725
7835
|
nvim.command("pclose", true);
|
|
7726
7836
|
nvim.command(`${mod} ${lines.length}sp +setl\\ previewwindow [issue ${id}]`, true);
|
|
@@ -7739,142 +7849,143 @@ function addSource(context, resolver) {
|
|
|
7739
7849
|
description: "issues on github/gitlab",
|
|
7740
7850
|
loadItems: async (context2) => {
|
|
7741
7851
|
let buf = await context2.window.buffer;
|
|
7742
|
-
let root = await resolver.resolveGitRoot(
|
|
7852
|
+
let root = await resolver.resolveGitRoot(import_coc15.workspace.getDocument(buf.id));
|
|
7743
7853
|
if (!root)
|
|
7744
7854
|
return [];
|
|
7745
7855
|
let issues = await loadIssues(root);
|
|
7746
7856
|
return issues.map((o) => {
|
|
7747
7857
|
return {
|
|
7748
|
-
label: `${
|
|
7858
|
+
label: `${import_safe5.default.red("#" + o.id.toFixed(0))} ${o.title} (${import_safe5.default.green(o.createAt.toUTCString())}) <${import_safe5.default.blue(o.creator)}>`,
|
|
7749
7859
|
data: {id: o.id, url: o.url, body: o.body}
|
|
7750
7860
|
};
|
|
7751
7861
|
});
|
|
7752
7862
|
}
|
|
7753
7863
|
};
|
|
7754
|
-
subscriptions.push(
|
|
7864
|
+
subscriptions.push(import_coc15.listManager.registerList(list));
|
|
7755
7865
|
}
|
|
7756
7866
|
|
|
7757
7867
|
// src/index.ts
|
|
7758
7868
|
async function activate(context) {
|
|
7759
|
-
const config =
|
|
7869
|
+
const config = import_coc16.workspace.getConfiguration("git");
|
|
7760
7870
|
const {subscriptions} = context;
|
|
7761
7871
|
let gitInfo;
|
|
7762
7872
|
try {
|
|
7763
7873
|
let pathHint = config.get("command");
|
|
7764
|
-
gitInfo = await findGit(pathHint, (
|
|
7874
|
+
gitInfo = await findGit(pathHint, (path9) => context.logger.info(`Looking for git in: ${path9}`));
|
|
7765
7875
|
} catch (e) {
|
|
7766
|
-
|
|
7876
|
+
import_coc16.window.showMessage("git command required for coc-git", "error");
|
|
7767
7877
|
return;
|
|
7768
7878
|
}
|
|
7769
|
-
const virtualTextSrcId = await
|
|
7770
|
-
const conflictSrcId = await
|
|
7771
|
-
const {nvim} =
|
|
7879
|
+
const virtualTextSrcId = await import_coc16.workspace.nvim.createNamespace("coc-git-virtual");
|
|
7880
|
+
const conflictSrcId = await import_coc16.workspace.nvim.createNamespace("coc-git-conflicts");
|
|
7881
|
+
const {nvim} = import_coc16.workspace;
|
|
7772
7882
|
const service = new service_default(gitInfo);
|
|
7773
7883
|
const manager = new manager_default(nvim, service, virtualTextSrcId, conflictSrcId);
|
|
7774
7884
|
subscriptions.push(manager);
|
|
7775
7885
|
addSource(context, service.resolver);
|
|
7776
|
-
subscriptions.push(
|
|
7886
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.refresh", () => {
|
|
7777
7887
|
manager.refresh();
|
|
7778
7888
|
}));
|
|
7779
|
-
subscriptions.push(
|
|
7889
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-nextchunk", async () => {
|
|
7780
7890
|
await manager.nextChunk();
|
|
7781
7891
|
}, {sync: false}));
|
|
7782
|
-
subscriptions.push(
|
|
7892
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-prevchunk", async () => {
|
|
7783
7893
|
await manager.prevChunk();
|
|
7784
7894
|
}, {sync: false}));
|
|
7785
|
-
subscriptions.push(
|
|
7895
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-nextconflict", async () => {
|
|
7786
7896
|
await manager.nextConflict();
|
|
7787
7897
|
}, {sync: false}));
|
|
7788
|
-
subscriptions.push(
|
|
7898
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-prevconflict", async () => {
|
|
7789
7899
|
await manager.prevConflict();
|
|
7790
7900
|
}, {sync: false}));
|
|
7791
|
-
subscriptions.push(
|
|
7901
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-keepcurrent", async () => {
|
|
7792
7902
|
await manager.keepCurrent();
|
|
7793
7903
|
}, {sync: false}));
|
|
7794
|
-
subscriptions.push(
|
|
7904
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-keepincoming", async () => {
|
|
7795
7905
|
await manager.keepIncoming();
|
|
7796
7906
|
}, {sync: false}));
|
|
7797
|
-
subscriptions.push(
|
|
7907
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-keepboth", async () => {
|
|
7798
7908
|
await manager.keepBoth();
|
|
7799
7909
|
}, {sync: false}));
|
|
7800
|
-
subscriptions.push(
|
|
7910
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-chunkinfo", async () => {
|
|
7801
7911
|
await manager.chunkInfo();
|
|
7802
7912
|
}, {sync: false}));
|
|
7803
|
-
subscriptions.push(
|
|
7913
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-commit", async () => {
|
|
7804
7914
|
await manager.showCommit();
|
|
7805
7915
|
}, {sync: false}));
|
|
7806
|
-
subscriptions.push(
|
|
7916
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["n"], "git-showblamedoc", async () => {
|
|
7807
7917
|
await manager.showBlameDoc();
|
|
7808
7918
|
}, {sync: false}));
|
|
7809
|
-
subscriptions.push(
|
|
7919
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.keepCurrent", async () => {
|
|
7810
7920
|
await manager.keepCurrent();
|
|
7811
7921
|
}));
|
|
7812
|
-
subscriptions.push(
|
|
7922
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.keepIncoming", async () => {
|
|
7813
7923
|
await manager.keepIncoming();
|
|
7814
7924
|
}));
|
|
7815
|
-
subscriptions.push(
|
|
7925
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.keepBoth", async () => {
|
|
7816
7926
|
await manager.keepBoth();
|
|
7817
7927
|
}));
|
|
7818
|
-
subscriptions.push(
|
|
7928
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.chunkInfo", async () => {
|
|
7819
7929
|
await manager.chunkInfo();
|
|
7820
7930
|
}));
|
|
7821
|
-
subscriptions.push(
|
|
7931
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.chunkStage", async () => {
|
|
7822
7932
|
await manager.chunkStage();
|
|
7823
7933
|
}));
|
|
7824
|
-
subscriptions.push(
|
|
7934
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.chunkUnstage", async () => {
|
|
7825
7935
|
await manager.chunkUnstage();
|
|
7826
7936
|
}));
|
|
7827
|
-
subscriptions.push(
|
|
7937
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.chunkUndo", async () => {
|
|
7828
7938
|
await manager.chunkUndo();
|
|
7829
7939
|
}));
|
|
7830
|
-
subscriptions.push(
|
|
7940
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.showCommit", async () => {
|
|
7831
7941
|
await manager.showCommit();
|
|
7832
7942
|
}));
|
|
7833
|
-
subscriptions.push(
|
|
7943
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.browserOpen", async () => {
|
|
7834
7944
|
await manager.browser();
|
|
7835
7945
|
}));
|
|
7836
|
-
subscriptions.push(
|
|
7946
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.copyUrl", async (...args) => {
|
|
7837
7947
|
await manager.browser("copy", args);
|
|
7838
7948
|
}));
|
|
7839
|
-
subscriptions.push(
|
|
7949
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.copyPermalink", async (...args) => {
|
|
7840
7950
|
await manager.browser("copy", args, true);
|
|
7841
7951
|
}));
|
|
7842
|
-
subscriptions.push(
|
|
7952
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.push", async (...args) => {
|
|
7843
7953
|
await manager.push(args);
|
|
7844
7954
|
}));
|
|
7845
|
-
subscriptions.push(
|
|
7955
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.diffCached", async () => {
|
|
7846
7956
|
await manager.diffCached();
|
|
7847
7957
|
}));
|
|
7848
|
-
subscriptions.push(
|
|
7958
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.toggleGutters", async () => {
|
|
7849
7959
|
await manager.toggleGutters();
|
|
7850
7960
|
}));
|
|
7851
|
-
subscriptions.push(
|
|
7961
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.foldUnchanged", async () => {
|
|
7852
7962
|
await manager.toggleFold();
|
|
7853
7963
|
}));
|
|
7854
|
-
subscriptions.push(
|
|
7964
|
+
subscriptions.push(import_coc16.commands.registerCommand("git.showBlameDoc", async () => {
|
|
7855
7965
|
await manager.showBlameDoc();
|
|
7856
7966
|
}));
|
|
7857
|
-
subscriptions.push(
|
|
7858
|
-
subscriptions.push(
|
|
7859
|
-
subscriptions.push(
|
|
7860
|
-
subscriptions.push(
|
|
7861
|
-
subscriptions.push(
|
|
7862
|
-
subscriptions.push(
|
|
7863
|
-
subscriptions.push(
|
|
7967
|
+
subscriptions.push(import_coc16.listManager.registerList(new gstatus_default(nvim, manager)));
|
|
7968
|
+
subscriptions.push(import_coc16.listManager.registerList(new branches_default(nvim, manager)));
|
|
7969
|
+
subscriptions.push(import_coc16.listManager.registerList(new commits_default(nvim, manager)));
|
|
7970
|
+
subscriptions.push(import_coc16.listManager.registerList(new bcommits_default(nvim, manager)));
|
|
7971
|
+
subscriptions.push(import_coc16.listManager.registerList(new gfiles_default(nvim, manager)));
|
|
7972
|
+
subscriptions.push(import_coc16.listManager.registerList(new gchunks_default(nvim, manager)));
|
|
7973
|
+
subscriptions.push(import_coc16.listManager.registerList(new gchanges_default(nvim, manager)));
|
|
7974
|
+
subscriptions.push(import_coc16.languages.registerCompletionItemProvider("semantic-commit", "Commit", config.get("semanticCommit.filetypes"), {
|
|
7864
7975
|
provideCompletionItems: async (document, position) => {
|
|
7865
7976
|
if (position.line !== 0) {
|
|
7866
7977
|
return [];
|
|
7867
7978
|
}
|
|
7868
|
-
const text = document.getText(
|
|
7979
|
+
const text = document.getText(import_coc16.Range.create(import_coc16.Position.create(position.line, 0), position));
|
|
7869
7980
|
if (/^[a-z]*$/.test(text)) {
|
|
7870
7981
|
const scope = config.get("semanticCommit.scope");
|
|
7871
7982
|
const text2 = scope ? "(${1:scope}): ${2:commit}" : ": ${1:commit}";
|
|
7872
7983
|
return DEFAULT_TYPES.map((o) => {
|
|
7873
7984
|
return {
|
|
7874
7985
|
label: o.value,
|
|
7875
|
-
kind:
|
|
7986
|
+
kind: import_coc16.CompletionItemKind.Snippet,
|
|
7876
7987
|
documentation: {kind: "plaintext", value: o.name},
|
|
7877
|
-
insertTextFormat:
|
|
7988
|
+
insertTextFormat: import_coc16.InsertTextFormat.Snippet,
|
|
7878
7989
|
insertText: o.value + text2 + "\n\n"
|
|
7879
7990
|
};
|
|
7880
7991
|
});
|
|
@@ -7882,13 +7993,13 @@ async function activate(context) {
|
|
|
7882
7993
|
return [];
|
|
7883
7994
|
}
|
|
7884
7995
|
}));
|
|
7885
|
-
subscriptions.push(
|
|
7996
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["o", "x"], "git-chunk-inner", async () => {
|
|
7886
7997
|
let diff = await manager.getCurrentChunk();
|
|
7887
7998
|
if (!diff)
|
|
7888
7999
|
return;
|
|
7889
8000
|
await nvim.command(`normal! ${diff.start}GV${diff.end}G`);
|
|
7890
8001
|
}, {sync: true, silent: true}));
|
|
7891
|
-
subscriptions.push(
|
|
8002
|
+
subscriptions.push(import_coc16.workspace.registerKeymap(["o", "x"], "git-chunk-outer", async () => {
|
|
7892
8003
|
let diff = await manager.getCurrentChunk();
|
|
7893
8004
|
if (!diff)
|
|
7894
8005
|
return;
|