coc-git 2.5.4 → 2.6.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.
Files changed (3) hide show
  1. package/Readme.md +8 -8
  2. package/lib/index.js +50 -117
  3. package/package.json +5 -5
package/Readme.md CHANGED
@@ -6,13 +6,6 @@ Git integration of [coc.nvim](https://github.com/neoclide/coc.nvim).
6
6
  use plugin like [vim-fugitive](https://github.com/tpope/vim-fugitive) at the
7
7
  same time.
8
8
 
9
- ## Supporting
10
-
11
- If you like my extension, consider supporting me on Patreon or PayPal:
12
-
13
- <a href="https://www.patreon.com/chemzqm"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /> </a>
14
- <a href="https://www.paypal.com/paypalme/chezqm"><img src="https://werwolv.net/assets/paypal_banner.png" alt="PayPal donate button" /> </a>
15
-
16
9
  ## Install
17
10
 
18
11
  In your vim/neovim, run command:
@@ -265,7 +258,14 @@ Multiple repositories can be specified using comma separation, like this: `githu
265
258
 
266
259
  Q: Virtual text not working.
267
260
 
268
- A: Make sure your neovim support virtual text by command `:echo exists('*nvim_buf_set_virtual_text')`.
261
+ A: Make sure your neovim/vim support virtual text by command `:echo has('nvim-0.5.0') || has('patch-9.0.0067')`.
262
+
263
+ ## Supporting
264
+
265
+ If you like my extension, consider supporting me on Patreon or PayPal:
266
+
267
+ <a href="https://www.patreon.com/chemzqm"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /> </a>
268
+ <a href="https://www.paypal.com/paypalme/chezqm"><img src="https://werwolv.net/assets/paypal_banner.png" alt="PayPal donate button" /> </a>
269
269
 
270
270
  ## License
271
271
 
package/lib/index.js CHANGED
@@ -936,107 +936,6 @@ var require_debounce = __commonJS((exports2, module2) => {
936
936
  module2.exports = debounce3;
937
937
  });
938
938
 
939
- // node_modules/uuid/deprecate.js
940
- var require_deprecate = __commonJS((exports2, module2) => {
941
- var deprecate;
942
- try {
943
- const util2 = require("util");
944
- deprecate = util2.deprecate;
945
- } catch (err) {
946
- deprecate = function deprecate2(fn, msg) {
947
- var warned = false;
948
- function deprecated() {
949
- if (!warned) {
950
- console.warn(msg);
951
- warned = true;
952
- }
953
- return fn.apply(this, arguments);
954
- }
955
- return deprecated;
956
- };
957
- }
958
- module2.exports = deprecate;
959
- });
960
-
961
- // node_modules/uuid/dist/rng.js
962
- var require_rng = __commonJS((exports2, module2) => {
963
- "use strict";
964
- Object.defineProperty(exports2, "__esModule", {
965
- value: true
966
- });
967
- exports2.default = rng;
968
- var _crypto = _interopRequireDefault(require("crypto"));
969
- function _interopRequireDefault(obj) {
970
- return obj && obj.__esModule ? obj : {default: obj};
971
- }
972
- function rng() {
973
- return _crypto.default.randomBytes(16);
974
- }
975
- module2.exports = exports2.default;
976
- });
977
-
978
- // node_modules/uuid/dist/bytesToUuid.js
979
- var require_bytesToUuid = __commonJS((exports2, module2) => {
980
- "use strict";
981
- Object.defineProperty(exports2, "__esModule", {
982
- value: true
983
- });
984
- exports2.default = void 0;
985
- var byteToHex = [];
986
- for (var i = 0; i < 256; ++i) {
987
- byteToHex[i] = (i + 256).toString(16).substr(1);
988
- }
989
- function bytesToUuid(buf, offset) {
990
- var i2 = offset || 0;
991
- var bth = byteToHex;
992
- return [bth[buf[i2++]], bth[buf[i2++]], bth[buf[i2++]], bth[buf[i2++]], "-", bth[buf[i2++]], bth[buf[i2++]], "-", bth[buf[i2++]], bth[buf[i2++]], "-", bth[buf[i2++]], bth[buf[i2++]], "-", bth[buf[i2++]], bth[buf[i2++]], bth[buf[i2++]], bth[buf[i2++]], bth[buf[i2++]], bth[buf[i2++]]].join("");
993
- }
994
- var _default = bytesToUuid;
995
- exports2.default = _default;
996
- module2.exports = exports2.default;
997
- });
998
-
999
- // node_modules/uuid/dist/v4.js
1000
- var require_v4 = __commonJS((exports2, module2) => {
1001
- "use strict";
1002
- Object.defineProperty(exports2, "__esModule", {
1003
- value: true
1004
- });
1005
- exports2.default = void 0;
1006
- var _rng = _interopRequireDefault(require_rng());
1007
- var _bytesToUuid = _interopRequireDefault(require_bytesToUuid());
1008
- function _interopRequireDefault(obj) {
1009
- return obj && obj.__esModule ? obj : {default: obj};
1010
- }
1011
- function v4(options, buf, offset) {
1012
- var i = buf && offset || 0;
1013
- if (typeof options == "string") {
1014
- buf = options === "binary" ? new Array(16) : null;
1015
- options = null;
1016
- }
1017
- options = options || {};
1018
- var rnds = options.random || (options.rng || _rng.default)();
1019
- rnds[6] = rnds[6] & 15 | 64;
1020
- rnds[8] = rnds[8] & 63 | 128;
1021
- if (buf) {
1022
- for (var ii = 0; ii < 16; ++ii) {
1023
- buf[i + ii] = rnds[ii];
1024
- }
1025
- }
1026
- return buf || (0, _bytesToUuid.default)(rnds);
1027
- }
1028
- var _default = v4;
1029
- exports2.default = _default;
1030
- module2.exports = exports2.default;
1031
- });
1032
-
1033
- // node_modules/uuid/v4.js
1034
- var require_v42 = __commonJS((exports2, module2) => {
1035
- var deprecate = require_deprecate();
1036
- var v4 = require_v4();
1037
- module2.exports = deprecate(v4, "Deep requiring like `const uuidv4 = require('uuid/v4');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated for more information.");
1038
- });
1039
-
1040
939
  // node_modules/safer-buffer/safer.js
1041
940
  var require_safer = __commonJS((exports2, module2) => {
1042
941
  "use strict";
@@ -5814,7 +5713,7 @@ var DocumentManager = class {
5814
5713
  diffRevision: config.get("diffRevision", ""),
5815
5714
  issueFormat: config.get("issueFormat", "#%i"),
5816
5715
  virtualTextPrefix: config.get("virtualTextPrefix", " "),
5817
- addGBlameToVirtualText: import_coc9.workspace.nvim.hasFunction("nvim_buf_set_virtual_text") && config.get("addGBlameToVirtualText", false),
5716
+ addGBlameToVirtualText: config.get("addGBlameToVirtualText", false),
5818
5717
  addGBlameToBufferVar: config.get("addGBlameToBufferVar", false),
5819
5718
  blameUseRealTime: config.get("blameUseRealTime", false),
5820
5719
  enableGutters: config.get("enableGutters", true),
@@ -6038,7 +5937,46 @@ var import_fs2 = __toModule(require("fs"));
6038
5937
  var import_os = __toModule(require("os"));
6039
5938
  var import_path4 = __toModule(require("path"));
6040
5939
  var import_util6 = __toModule(require("util"));
6041
- var uuid = require_v42();
5940
+
5941
+ // node_modules/uuid/dist/esm-node/rng.js
5942
+ var import_crypto = __toModule(require("crypto"));
5943
+ function rng() {
5944
+ return import_crypto.default.randomBytes(16);
5945
+ }
5946
+
5947
+ // node_modules/uuid/dist/esm-node/bytesToUuid.js
5948
+ var byteToHex = [];
5949
+ for (var i = 0; i < 256; ++i) {
5950
+ byteToHex[i] = (i + 256).toString(16).substr(1);
5951
+ }
5952
+ function bytesToUuid(buf, offset) {
5953
+ var i = offset || 0;
5954
+ var bth = byteToHex;
5955
+ return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join("");
5956
+ }
5957
+ var bytesToUuid_default = bytesToUuid;
5958
+
5959
+ // node_modules/uuid/dist/esm-node/v4.js
5960
+ function v4(options, buf, offset) {
5961
+ var i = buf && offset || 0;
5962
+ if (typeof options == "string") {
5963
+ buf = options === "binary" ? new Array(16) : null;
5964
+ options = null;
5965
+ }
5966
+ options = options || {};
5967
+ var rnds = options.random || (options.rng || rng)();
5968
+ rnds[6] = rnds[6] & 15 | 64;
5969
+ rnds[8] = rnds[8] & 63 | 128;
5970
+ if (buf) {
5971
+ for (var ii = 0; ii < 16; ++ii) {
5972
+ buf[i + ii] = rnds[ii];
5973
+ }
5974
+ }
5975
+ return buf || bytesToUuid_default(rnds);
5976
+ }
5977
+ var v4_default = v4;
5978
+
5979
+ // src/model/repo.ts
6042
5980
  var Repo = class {
6043
5981
  constructor(git, channel, root) {
6044
5982
  this.git = git;
@@ -6191,8 +6129,8 @@ var Repo = class {
6191
6129
  this.channel.append(e.stack);
6192
6130
  return;
6193
6131
  }
6194
- const stagedFile = import_path4.default.join(import_os.default.tmpdir(), `coc-${uuid()}`);
6195
- const currentFile = import_path4.default.join(import_os.default.tmpdir(), `coc-${uuid()}`);
6132
+ const stagedFile = import_path4.default.join(import_os.default.tmpdir(), `coc-${v4_default()}`);
6133
+ const currentFile = import_path4.default.join(import_os.default.tmpdir(), `coc-${v4_default()}`);
6196
6134
  await import_util6.default.promisify(import_fs2.default.writeFile)(stagedFile, staged + "\n", "utf8");
6197
6135
  await import_util6.default.promisify(import_fs2.default.writeFile)(currentFile, content, "utf8");
6198
6136
  let output = await getStdout(`git --no-pager diff --no-ext-diff -p -U0 --no-color ${shellescape(stagedFile)} ${shellescape(currentFile)}`);
@@ -6822,7 +6760,7 @@ var GitBuffer = class {
6822
6760
  line = line + adjust;
6823
6761
  let chunk = chunks.find((o) => o.add.lnum <= line && o.add.lnum + o.add.count >= line);
6824
6762
  if (chunk) {
6825
- let content = "Staged chagnes\n" + chunk.lines.join("\n");
6763
+ let content = "Staged changes\n" + chunk.lines.join("\n");
6826
6764
  await this.showDoc(content, "diff");
6827
6765
  }
6828
6766
  }
@@ -6849,7 +6787,7 @@ var GitBuffer = class {
6849
6787
  let buffer = nvim.createBuffer(this.doc.bufnr);
6850
6788
  let hide_blame = await nvim.getVar("coc_git_hide_blame_virtual_text");
6851
6789
  if (hide_blame) {
6852
- await buffer.request("nvim_buf_clear_namespace", [virtualTextSrcId, 0, -1]);
6790
+ await buffer.clearNamespace(virtualTextSrcId);
6853
6791
  } else {
6854
6792
  if (addGBlameToBufferVar) {
6855
6793
  nvim.pauseNotification();
@@ -6859,15 +6797,10 @@ var GitBuffer = class {
6859
6797
  }
6860
6798
  if (addGBlameToVirtualText) {
6861
6799
  const prefix = this.config.virtualTextPrefix;
6862
- await buffer.clearNamespace(virtualTextSrcId);
6863
- if (import_coc12.workspace.has("nvim-0.6.0")) {
6864
- await buffer.setExtMark(virtualTextSrcId, lnum - 1, 0, {
6865
- hl_mode: "combine",
6866
- virt_text: [[prefix + blameText, "CocCodeLens"]]
6867
- });
6868
- } else {
6869
- await buffer.setVirtualText(virtualTextSrcId, lnum - 1, [[prefix + blameText, "CocCodeLens"]]);
6870
- }
6800
+ nvim.pauseNotification();
6801
+ buffer.clearNamespace(virtualTextSrcId);
6802
+ buffer.setVirtualText(virtualTextSrcId, lnum - 1, [[prefix + blameText, "CocCodeLens"]]);
6803
+ nvim.resumeNotification(true, true);
6871
6804
  }
6872
6805
  }
6873
6806
  }
@@ -7456,7 +7389,7 @@ var GitBuffer = class {
7456
7389
  buffer.setVar("coc_git_blame", "", true);
7457
7390
  }
7458
7391
  if (this.config.addGBlameToVirtualText) {
7459
- buffer.notify("nvim_buf_clear_namespace", [this.config.virtualTextSrcId, 0, -1]);
7392
+ buffer.clearNamespace(this.config.virtualTextSrcId);
7460
7393
  }
7461
7394
  nvim.resumeNotification(false, true);
7462
7395
  this._disposed = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-git",
3
- "version": "2.5.4",
3
+ "version": "2.6.0",
4
4
  "description": "Git extension for coc.nvim",
5
5
  "main": "lib/index.js",
6
6
  "publisher": "chemzqm",
@@ -9,7 +9,7 @@
9
9
  "git"
10
10
  ],
11
11
  "engines": {
12
- "coc": "^0.0.80"
12
+ "coc": "^0.0.82"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -138,12 +138,12 @@
138
138
  "git.virtualTextPrefix": {
139
139
  "type": "string",
140
140
  "default": " ",
141
- "description": "Prefix of git blame infomation to virtual text, require virtual text feature of neovim."
141
+ "description": "Prefix of git blame information to virtual text, require virtual text feature of vim/neovim."
142
142
  },
143
143
  "git.addGBlameToVirtualText": {
144
144
  "type": "boolean",
145
145
  "default": false,
146
- "description": "Add git blame information to virtual text, require virtual text feature of neovim."
146
+ "description": "Add git blame information to virtual text, require virtual text feature of vim/neovim."
147
147
  },
148
148
  "git.addGBlameToBufferVar": {
149
149
  "type": "boolean",
@@ -427,7 +427,7 @@
427
427
  "@types/node": "^12.12.0",
428
428
  "@types/uuid": "^7.0.1",
429
429
  "@types/which": "^1.3.2",
430
- "coc.nvim": "^0.0.83-next.2",
430
+ "coc.nvim": "^0.0.83-next.14",
431
431
  "colors": "^1.4.0",
432
432
  "debounce": "^1.2.0",
433
433
  "esbuild": "^0.8.29",