@x18n/lsp 0.0.12 → 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.
package/dist/index.d.mts CHANGED
@@ -97,6 +97,8 @@ export interface UsageReportResult {
97
97
  }
98
98
  export interface Decoration {
99
99
  readonly range: Range;
100
+ /** The whole call holding the key, when the scanner knows it. */
101
+ readonly expression?: Range | undefined;
100
102
  readonly key: string;
101
103
  readonly value: string | undefined;
102
104
  readonly state: "ok" | "missing" | "dynamic";
package/dist/src.mjs CHANGED
@@ -28,7 +28,7 @@ const commands = {
28
28
  };
29
29
  //#endregion
30
30
  //#region package.json
31
- var version = "0.0.12";
31
+ var version = "0.0.13";
32
32
  //#endregion
33
33
  //#region src/server.ts
34
34
  const severities = {
@@ -72,7 +72,8 @@ var Server = class {
72
72
  settings = {
73
73
  annotationMaxLength: 40,
74
74
  displayLocale: void 0,
75
- codeLens: false
75
+ codeLens: false,
76
+ showFlags: true
76
77
  };
77
78
  ready = Promise.resolve();
78
79
  folders = [];
@@ -178,6 +179,7 @@ var Server = class {
178
179
  if (typeof settings?.displayLocale === "string") this.settings.displayLocale = settings.displayLocale;
179
180
  if (typeof settings?.annotationMaxLength === "number") this.settings.annotationMaxLength = settings.annotationMaxLength;
180
181
  if (typeof settings?.codeLens === "boolean") this.settings.codeLens = settings.codeLens;
182
+ if (typeof settings?.showFlags === "boolean") this.settings.showFlags = settings.showFlags;
181
183
  return {
182
184
  serverInfo: {
183
185
  name: "x18n",
@@ -409,7 +411,8 @@ var Server = class {
409
411
  const value = display(project.lookup(target.key, locale)?.value);
410
412
  const change = changes[i];
411
413
  const changed = dated ? ` ${change ? changedAt(change).replace(/\|/g, "\\|") : ""}${outdated.has(locale) ? " · **outdated**" : ""} |` : "";
412
- lines.push(`| ${project.localeInfo(locale).flag ?? ""} ${locale} | ${value === void 0 ? "_missing_" : value === "" ? "_empty_" : value.replace(/\|/g, "\\|").replace(/\n/g, " ")} |${changed}`);
414
+ const flag = this.settings.showFlags ? project.localeInfo(locale).flag : void 0;
415
+ lines.push(`| ${flag ?? ""} ${locale} | ${value === void 0 ? "_missing_" : value === "" ? "_empty_" : value.replace(/\|/g, "\\|").replace(/\n/g, " ")} |${changed}`);
413
416
  });
414
417
  }
415
418
  const usages = target.type === "subtree" ? project.usages({ prefix: target.key }) : project.usages({ key: target.key });
@@ -417,7 +420,7 @@ var Server = class {
417
420
  project: at.entry.name,
418
421
  key: target.key
419
422
  }]));
420
- lines.push("", `${usages.length} usage${usages.length === 1 ? "" : "s"} · [Open in UI](command:x18n.openKey?${args}) · [Copy translate prompt](command:x18n.copyTranslatePrompt?${args})`);
423
+ lines.push("", `${usages.length} usage${usages.length === 1 ? "" : "s"} · [Open in UI](command:x18n.openKey?${args}) · [Copy translate prompt](command:x18n.copyTranslatePrompt?${args}) · [Translate with agent](command:x18n.translateWithAgent?${args})`);
421
424
  return {
422
425
  contents: {
423
426
  kind: "markdown",
@@ -819,6 +822,7 @@ var Server = class {
819
822
  const state = usage.dynamic !== false ? "dynamic" : value === void 0 ? "missing" : "ok";
820
823
  return [{
821
824
  range: this.range(entry, path, usage.range),
825
+ ...usage.expression ? { expression: this.range(entry, path, usage.expression) } : {},
822
826
  key: usage.key,
823
827
  value,
824
828
  state
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@x18n/lsp",
3
3
  "type": "module",
4
- "version": "0.0.12",
4
+ "version": "0.0.13",
5
5
  "description": "x18n language server for any LSP editor",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -29,10 +29,10 @@
29
29
  "node": ">=22"
30
30
  },
31
31
  "dependencies": {
32
- "@x18n/builtins": "0.0.12",
33
- "@x18n/core": "0.0.12",
34
- "@x18n/node": "0.0.12",
35
- "@x18n/ui": "0.0.12",
32
+ "@x18n/builtins": "0.0.13",
33
+ "@x18n/core": "0.0.13",
34
+ "@x18n/node": "0.0.13",
35
+ "@x18n/ui": "0.0.13",
36
36
  "devframe": "^1.2.6",
37
37
  "vscode-languageserver": "^10.1.2",
38
38
  "vscode-languageserver-textdocument": "^1.0.15"