coc-git 2.4.10 → 2.4.11

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 (2) hide show
  1. package/lib/index.js +36 -6
  2. package/package.json +5 -1
package/lib/index.js CHANGED
@@ -5249,7 +5249,7 @@ var Commits = class extends import_coc4.BasicList {
5249
5249
  } else {
5250
5250
  arg = `${list[1].data.commit} ${list[0].data.commit}`;
5251
5251
  }
5252
- let content = await runCommand(`git --no-pager diff ${arg}`, {cwd: list[0].data.root});
5252
+ let content = await runCommand(`git --no-pager diff --no-ext-diff ${arg}`, {cwd: list[0].data.root});
5253
5253
  let lines = content.replace(/\n$/, "").split("\n");
5254
5254
  nvim.pauseNotification();
5255
5255
  nvim.command(`tabe [diff ${arg}]`, true);
@@ -5273,7 +5273,7 @@ var Commits = class extends import_coc4.BasicList {
5273
5273
  } else {
5274
5274
  arg = `${list[1].data.commit} ${list[0].data.commit}`;
5275
5275
  }
5276
- let content = await runCommand(`git --no-pager diff ${arg}`, {cwd: list[0].data.root});
5276
+ let content = await runCommand(`git --no-pager diff --no-ext-diff ${arg}`, {cwd: list[0].data.root});
5277
5277
  let lines = content.replace(/\n$/, "").split("\n");
5278
5278
  let winid = context.listWindow.id;
5279
5279
  let mod = context.options.position == "tab" ? "below" : "above";
@@ -5369,7 +5369,7 @@ var Gfiles = class extends import_coc5.BasicList {
5369
5369
  let {root, sha, filepath, branch} = item.data;
5370
5370
  if (!sha)
5371
5371
  return;
5372
- let content = await runCommand(`git --no-pager diff ${branch} -- ${shellescape(filepath)}`, {cwd: root});
5372
+ let content = await runCommand(`git --no-pager diff --no-ext-diff ${branch} -- ${shellescape(filepath)}`, {cwd: root});
5373
5373
  let lines = content.replace(/\n$/, "").split("\n");
5374
5374
  await this.preview({
5375
5375
  lines,
@@ -5501,7 +5501,7 @@ var GStatus = class extends import_coc6.BasicList {
5501
5501
  }, context);
5502
5502
  return;
5503
5503
  }
5504
- let args = ["--no-pager", "diff"];
5504
+ let args = ["--no-pager", "diff", "--no-ext-diff"];
5505
5505
  if (index_symbol == "M" && tree_symbol != "M") {
5506
5506
  args.push("--cached");
5507
5507
  }
@@ -5879,6 +5879,12 @@ var DocumentManager = class {
5879
5879
  if (buf)
5880
5880
  await buf.showCommit();
5881
5881
  }
5882
+ async showBlameDoc() {
5883
+ let buf = await this.buffer;
5884
+ let line = await this.nvim.call("line", ".");
5885
+ if (buf)
5886
+ await buf.showBlameDoc(line);
5887
+ }
5882
5888
  async browser(action = "open", range, permalink = false) {
5883
5889
  let buf = await this.buffer;
5884
5890
  if (buf)
@@ -5959,7 +5965,7 @@ var Repo = class {
5959
5965
  this.root = root;
5960
5966
  }
5961
5967
  async getStagedChunks(relpath) {
5962
- let args = ["--no-pager", "diff", "-p", "-U0", "--no-color", "--staged"];
5968
+ let args = ["--no-pager", "diff", "--no-ext-diff", "-p", "-U0", "--no-color", "--staged"];
5963
5969
  if (relpath)
5964
5970
  args.push(toUnixSlash(relpath));
5965
5971
  const result = await this.exec(args);
@@ -6108,7 +6114,7 @@ var Repo = class {
6108
6114
  const currentFile = import_path4.default.join(import_os.default.tmpdir(), `coc-${uuid()}`);
6109
6115
  await import_util6.default.promisify(import_fs2.default.writeFile)(stagedFile, staged + "\n", "utf8");
6110
6116
  await import_util6.default.promisify(import_fs2.default.writeFile)(currentFile, content, "utf8");
6111
- let output = await getStdout(`git --no-pager diff -p -U0 --no-color ${shellescape(stagedFile)} ${shellescape(currentFile)}`);
6117
+ let output = await getStdout(`git --no-pager diff --no-ext-diff -p -U0 --no-color ${shellescape(stagedFile)} ${shellescape(currentFile)}`);
6112
6118
  await import_util6.default.promisify(import_fs2.default.unlink)(stagedFile);
6113
6119
  await import_util6.default.promisify(import_fs2.default.unlink)(currentFile);
6114
6120
  if (!output)
@@ -6756,6 +6762,24 @@ var GitBuffer = class {
6756
6762
  }
6757
6763
  }
6758
6764
  }
6765
+ async showBlameDoc(lnum) {
6766
+ let indexed = await this.repo.isIndexed(this.relpath);
6767
+ if (!indexed) {
6768
+ import_coc11.window.showMessage("File not indexed");
6769
+ } else {
6770
+ let infos = await this.getBlameInfo();
6771
+ let info = infos.find((o) => lnum >= o.startLnum && lnum <= o.endLnum);
6772
+ if (info && info.author && info.author != "Not Committed Yet") {
6773
+ let blameText = [];
6774
+ blameText.push(`${info.author}, ${info.time}`);
6775
+ blameText.push(`${info.summary}`);
6776
+ blameText.push(`${info.sha.substring(0, 7)}`);
6777
+ await this.showDoc(blameText.join("\n\n"), "text");
6778
+ } else {
6779
+ import_coc11.window.showMessage("Not committed yet");
6780
+ }
6781
+ }
6782
+ }
6759
6783
  async diffDocument(force = false) {
6760
6784
  var _a;
6761
6785
  let {nvim} = import_coc11.workspace;
@@ -7732,6 +7756,9 @@ async function activate(context) {
7732
7756
  subscriptions.push(import_coc14.workspace.registerKeymap(["n"], "git-commit", async () => {
7733
7757
  await manager.showCommit();
7734
7758
  }, {sync: false}));
7759
+ subscriptions.push(import_coc14.workspace.registerKeymap(["n"], "git-showblamedoc", async () => {
7760
+ await manager.showBlameDoc();
7761
+ }, {sync: false}));
7735
7762
  subscriptions.push(import_coc14.commands.registerCommand("git.keepCurrent", async () => {
7736
7763
  await manager.keepCurrent();
7737
7764
  }));
@@ -7777,6 +7804,9 @@ async function activate(context) {
7777
7804
  subscriptions.push(import_coc14.commands.registerCommand("git.foldUnchanged", async () => {
7778
7805
  await manager.toggleFold();
7779
7806
  }));
7807
+ subscriptions.push(import_coc14.commands.registerCommand("git.showBlameDoc", async () => {
7808
+ await manager.showBlameDoc();
7809
+ }));
7780
7810
  subscriptions.push(import_coc14.listManager.registerList(new gstatus_default(nvim, manager)));
7781
7811
  subscriptions.push(import_coc14.listManager.registerList(new branches_default(nvim, manager)));
7782
7812
  subscriptions.push(import_coc14.listManager.registerList(new commits_default(nvim, manager)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-git",
3
- "version": "2.4.10",
3
+ "version": "2.4.11",
4
4
  "description": "Git extension for coc.nvim",
5
5
  "main": "lib/index.js",
6
6
  "publisher": "chemzqm",
@@ -74,6 +74,10 @@
74
74
  {
75
75
  "title": "Push code of current branch to remote",
76
76
  "command": "git.push"
77
+ },
78
+ {
79
+ "title": "Show git blame info in float or popup window",
80
+ "command": "git.showBlameDoc"
77
81
  }
78
82
  ],
79
83
  "configuration": {