coc-sonarlint 0.0.11 → 0.0.13

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 +17 -13
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -13110,7 +13110,7 @@ function toggleRule(level) {
13110
13110
  level = !current || current == "on" ? "off" : "on";
13111
13111
  }
13112
13112
  let localLevel = !level ? rules[ruleKey] : level;
13113
- rules = Object.assign({ [ruleKey]: { localLevel } }, rules);
13113
+ rules = { [ruleKey]: { localLevel }, ...rules };
13114
13114
  if (localLevel === "off") {
13115
13115
  const result = await coc8.window.showPrompt(
13116
13116
  `Are you sure you want to disable rule ${ruleKey}? `
@@ -13122,11 +13122,7 @@ function toggleRule(level) {
13122
13122
  coc8.window.showWarningMessage(
13123
13123
  `Changed level of rule ${ruleKey} to ${localLevel}`
13124
13124
  );
13125
- return await configuration.update(
13126
- "rules",
13127
- rules,
13128
- coc8.ConfigurationTarget.Global
13129
- );
13125
+ return await configuration.update("rules", rules);
13130
13126
  } else {
13131
13127
  const { key, activeByDefault } = ruleKey;
13132
13128
  let localLevel = level;
@@ -13147,11 +13143,7 @@ function toggleRule(level) {
13147
13143
  delete rules[key];
13148
13144
  }
13149
13145
  coc8.window.showWarningMessage(`Changed level of rule ${key} to ${localLevel}`);
13150
- return await configuration.update(
13151
- "rules",
13152
- rules,
13153
- coc8.ConfigurationTarget.Global
13154
- );
13146
+ return await configuration.update("rules", rules);
13155
13147
  }
13156
13148
  };
13157
13149
  }
@@ -14091,8 +14083,20 @@ function deactivate() {
14091
14083
  }
14092
14084
  async function showRulesView(title) {
14093
14085
  allRulesView.title = title;
14094
- if (!allRulesView.visible) {
14095
- await allRulesView?.show();
14086
+ if (allRulesView?.visible) {
14087
+ const winId = allRulesView.windowId;
14088
+ const tabnr = await import_coc3.nvim.call("tabpagenr");
14089
+ const buflist = await import_coc3.nvim.call("tabpagebuflist", [tabnr]);
14090
+ const bufId = await import_coc3.nvim.call("winbufnr", [winId]);
14091
+ const found = buflist.find((bufnr) => {
14092
+ return bufId == bufnr;
14093
+ });
14094
+ if (!found) {
14095
+ await import_coc3.nvim.call("coc#window#close", [winId]);
14096
+ await allRulesView?.show("botright 10split");
14097
+ }
14098
+ } else if (!allRulesView?.visible) {
14099
+ await allRulesView?.show("botright 10split");
14096
14100
  }
14097
14101
  }
14098
14102
  function logWithPrefix(data, prefix) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-sonarlint",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "sonarlint for coc.nvim",
5
5
  "author": "asmodeus812",
6
6
  "license": "MIT",