coc-git 2.4.7 → 2.4.8

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 +13 -12
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -5634,28 +5634,26 @@ var DocumentManager = class {
5634
5634
  this.conflictSrcId = conflictSrcId;
5635
5635
  this.buffers = new Map();
5636
5636
  this.disposables = [];
5637
+ this.defined = false;
5637
5638
  this.loadConfiguration();
5638
5639
  import_coc8.workspace.onDidChangeConfiguration(this.loadConfiguration, this, this.disposables);
5639
5640
  this.gitStatus = new status_default(service);
5640
- if (this.enableGutters) {
5641
- this.defineSigns().catch((e) => {
5642
- console.error(e.message);
5643
- });
5644
- }
5645
- for (let doc of import_coc8.workspace.documents) {
5641
+ const createBuffer = (doc) => {
5646
5642
  let {uri} = doc;
5647
5643
  service.createBuffer(doc, this.config).then((buf) => {
5648
5644
  if (!buf || import_coc8.workspace.getDocument(uri) == null)
5649
5645
  return;
5646
+ this.defineSigns().catch((e) => {
5647
+ console.error(e.message);
5648
+ });
5650
5649
  this.buffers.set(doc.bufnr, buf);
5651
5650
  });
5651
+ };
5652
+ for (let doc of import_coc8.workspace.documents) {
5653
+ createBuffer(doc);
5652
5654
  }
5653
5655
  import_coc8.workspace.onDidOpenTextDocument(async (e) => {
5654
- let doc = import_coc8.workspace.getDocument(e.bufnr);
5655
- let buf = await service.createBuffer(doc, this.config);
5656
- if (!buf || !import_coc8.workspace.getDocument(e.uri))
5657
- return;
5658
- this.buffers.set(e.bufnr, buf);
5656
+ createBuffer(import_coc8.workspace.getDocument(e.bufnr));
5659
5657
  }, null, this.disposables);
5660
5658
  import_coc8.workspace.onDidChangeTextDocument(async (e) => {
5661
5659
  let buf = this.buffers.get(e.bufnr);
@@ -5694,6 +5692,9 @@ var DocumentManager = class {
5694
5692
  }, null, this.disposables);
5695
5693
  }
5696
5694
  async defineSigns() {
5695
+ if (!this.enableGutters || this.defined)
5696
+ return;
5697
+ this.defined = true;
5697
5698
  let {nvim} = this;
5698
5699
  const config = import_coc8.workspace.getConfiguration("git");
5699
5700
  let items = ["Changed", "Added", "Removed", "TopRemoved", "ChangeRemoved"];
@@ -5703,7 +5704,7 @@ var DocumentManager = class {
5703
5704
  let text = config.get(`${section}.text`, "");
5704
5705
  let hlGroup = config.get(`${section}.hlGroup`, "");
5705
5706
  nvim.command(`sign define CocGit${item} text=${text} texthl=CocGit${item}Sign`, true);
5706
- nvim.command(`hi default link CocGit${item}Sign ${hlGroup}`, true);
5707
+ nvim.command(`highlight default link CocGit${item}Sign ${hlGroup}`, true);
5707
5708
  }
5708
5709
  await nvim.resumeNotification();
5709
5710
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-git",
3
- "version": "2.4.7",
3
+ "version": "2.4.8",
4
4
  "description": "Git extension for coc.nvim",
5
5
  "main": "lib/index.js",
6
6
  "publisher": "chemzqm",