coc-git 2.4.9 → 2.4.10

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 +0 -2
  2. package/lib/index.js +13 -12
  3. package/package.json +5 -9
package/Readme.md CHANGED
@@ -61,8 +61,6 @@ In your vim/neovim, run command:
61
61
 
62
62
  - `git.browserBranchName`: Branch name for browserOpen and copyUrl., default: `""`
63
63
 
64
- - `git.urlMode`: URL mode for browserOpen and copyUrl, you can set it to `"permalink"`. default: `"normal"`
65
-
66
64
  - `git.urlFix`: a object to configure the url style of copyUrl and browserOpen, make this two command support other git services like gitlab and gitea. default: `{}`
67
65
 
68
66
  - `git.issueFormat`: Formatting string for issue completion. Supported interpolation variables: %i - issue id. %r - repository name. %o - organization/owner name. %t - issue title. %b - issue body. %c - issue created at. %a - issue author. %u - issue url., default: `"#%i"`
package/lib/index.js CHANGED
@@ -4924,20 +4924,19 @@ var Bcommits = class extends import_coc2.BasicList {
4924
4924
  }, {tabPersist: true});
4925
4925
  this.addAction("view", async (item, context) => {
4926
4926
  let {commit, root, file} = item.data;
4927
- let {window: window9, listWindow} = context;
4927
+ let {window: window9} = context;
4928
4928
  let content = await import_coc2.runCommand(`git show ${commit}:${shellescape(file)}`, {cwd: root});
4929
4929
  let lines = content.replace(/\n$/, "").split("\n");
4930
4930
  nvim.pauseNotification();
4931
4931
  nvim.call("win_gotoid", [window9.id], true);
4932
- nvim.command(`exe "edit ".fnameescape('(${commit}) ${file}')`, true);
4932
+ nvim.command(`exe "tabe ".fnameescape('(${commit}) ${file}')`, true);
4933
4933
  nvim.call("append", [0, lines], true);
4934
4934
  nvim.command("normal! Gdd", true);
4935
4935
  nvim.command(`exe 1`, true);
4936
4936
  nvim.command("setl buftype=nofile nomodifiable bufhidden=wipe nobuflisted", true);
4937
4937
  nvim.command("filetype detect", true);
4938
- nvim.call("win_gotoid", [listWindow.id], true);
4939
4938
  await nvim.resumeNotification();
4940
- }, {persist: true});
4939
+ }, {persist: false});
4941
4940
  this.addAction("diff", async (item, context) => {
4942
4941
  let buffer = await context.window.buffer;
4943
4942
  let filetype = await buffer.getOption("filetype");
@@ -5880,10 +5879,10 @@ var DocumentManager = class {
5880
5879
  if (buf)
5881
5880
  await buf.showCommit();
5882
5881
  }
5883
- async browser(action = "open", range) {
5882
+ async browser(action = "open", range, permalink = false) {
5884
5883
  let buf = await this.buffer;
5885
5884
  if (buf)
5886
- await buf.browser(action, range);
5885
+ await buf.browser(action, range, permalink);
5887
5886
  }
5888
5887
  async diffCached() {
5889
5888
  let buf = await this.buffer;
@@ -6984,10 +6983,9 @@ var GitBuffer = class {
6984
6983
  }
6985
6984
  import_coc11.window.showMessage("Not positioned on a conflict");
6986
6985
  }
6987
- async browser(action = "open", range) {
6986
+ async browser(action = "open", range, permalink = false) {
6988
6987
  let {nvim} = import_coc11.workspace;
6989
6988
  let config = import_coc11.workspace.getConfiguration("git");
6990
- let mode = config.get("urlMode", "normal").trim();
6991
6989
  let head = (await this.repo.safeRun(["rev-parse", "HEAD"])).trim();
6992
6990
  let branch = config.get("browserBranchName", "").trim();
6993
6991
  if (!branch.length) {
@@ -7029,16 +7027,16 @@ var GitBuffer = class {
7029
7027
  let hostname = tmp.hostname;
7030
7028
  let fix = "|";
7031
7029
  try {
7032
- fix = config.get("urlFix")[hostname][mode == "permalink" ? 1 : 0];
7030
+ fix = config.get("urlFix")[hostname][permalink ? 1 : 0];
7033
7031
  } catch (e) {
7034
7032
  }
7035
- let url = getUrl(fix, repoURL, mode == "permalink" ? head : branch, this.relpath.replace(/\\\\/g, "/"), lines);
7033
+ let url = getUrl(fix, repoURL, permalink ? head : branch, this.relpath.replace(/\\\\/g, "/"), lines);
7036
7034
  if (url)
7037
7035
  urls.push(url);
7038
7036
  }
7039
7037
  if (urls.length == 1) {
7040
7038
  if (action == "open") {
7041
- nvim.call("coc#util#open_url", [urls[0]], true);
7039
+ await import_coc11.workspace.openResource(urls[0]);
7042
7040
  } else {
7043
7041
  nvim.command(`let @+ = '${urls[0]}'`, true);
7044
7042
  import_coc11.window.showMessage("Copied url to clipboard");
@@ -7047,7 +7045,7 @@ var GitBuffer = class {
7047
7045
  let idx = await import_coc11.window.showQuickpick(urls, "Select url:");
7048
7046
  if (idx >= 0) {
7049
7047
  if (action == "open") {
7050
- nvim.call("coc#util#open_url", [urls[idx]], true);
7048
+ await import_coc11.workspace.openResource(urls[idx]);
7051
7049
  } else {
7052
7050
  nvim.command(`let @+ = '${urls[idx]}'`, true);
7053
7051
  import_coc11.window.showMessage("Copied url to clipboard");
@@ -7764,6 +7762,9 @@ async function activate(context) {
7764
7762
  subscriptions.push(import_coc14.commands.registerCommand("git.copyUrl", async (...args) => {
7765
7763
  await manager.browser("copy", args);
7766
7764
  }));
7765
+ subscriptions.push(import_coc14.commands.registerCommand("git.copyPermalink", async (...args) => {
7766
+ await manager.browser("copy", args, true);
7767
+ }));
7767
7768
  subscriptions.push(import_coc14.commands.registerCommand("git.push", async (...args) => {
7768
7769
  await manager.push(args);
7769
7770
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-git",
3
- "version": "2.4.9",
3
+ "version": "2.4.10",
4
4
  "description": "Git extension for coc.nvim",
5
5
  "main": "lib/index.js",
6
6
  "publisher": "chemzqm",
@@ -55,6 +55,10 @@
55
55
  "title": "Copy url of current line to clipboard, github url supported.",
56
56
  "command": "git.copyUrl"
57
57
  },
58
+ {
59
+ "title": "Copy permalink of current line to clipboard, github url supported.",
60
+ "command": "git.copyPermalink"
61
+ },
58
62
  {
59
63
  "title": "Show cached diff in preview window.",
60
64
  "command": "git.diffCached"
@@ -95,14 +99,6 @@
95
99
  "default": "",
96
100
  "description": "Branch name for browserOpen and copyUrl."
97
101
  },
98
- "git.urlMode": {
99
- "type": "string",
100
- "default": "normal",
101
- "enum": [
102
- "normal",
103
- "permalink"
104
- ]
105
- },
106
102
  "git.urlFix": {
107
103
  "type": "object",
108
104
  "default": {},