@x18n/lsp 0.0.0 → 0.0.3
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/cli.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as commands, r as methods, t as setupServer } from "./src
|
|
1
|
+
export { n as commands, r as methods, t as setupServer } from "./src.mjs";
|
|
@@ -28,7 +28,7 @@ const commands = {
|
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region package.json
|
|
31
|
-
var version = "0.0.
|
|
31
|
+
var version = "0.0.3";
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/server.ts
|
|
34
34
|
const severities = {
|
|
@@ -384,7 +384,7 @@ var Server = class {
|
|
|
384
384
|
if (target.type === "key") {
|
|
385
385
|
lines.push("| | |", "| --- | --- |");
|
|
386
386
|
for (const locale of project.locales) {
|
|
387
|
-
const value = display(project.
|
|
387
|
+
const value = display(project.lookup(target.key, locale)?.value);
|
|
388
388
|
lines.push(`| ${project.localeInfo(locale).flag ?? ""} ${locale} | ${value === void 0 ? "_missing_" : value === "" ? "_empty_" : value.replace(/\|/g, "\\|").replace(/\n/g, " ")} |`);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
@@ -414,7 +414,7 @@ var Server = class {
|
|
|
414
414
|
const hints = [];
|
|
415
415
|
for (const { usage } of entry.project.usages({ path })) {
|
|
416
416
|
if (usage.key === void 0 || usage.dynamic !== false || usage.range.start < start || usage.range.end > end) continue;
|
|
417
|
-
const value = display(entry.project.
|
|
417
|
+
const value = display(entry.project.lookup(usage.key, locale)?.value);
|
|
418
418
|
hints.push({
|
|
419
419
|
position: index.position(usage.range.end + 1),
|
|
420
420
|
label: value === void 0 ? " ⚠ missing" : ` ${truncate(value, this.settings.annotationMaxLength)}`,
|
|
@@ -441,7 +441,7 @@ var Server = class {
|
|
|
441
441
|
if (!insert.startsWith(prefix)) return [];
|
|
442
442
|
insert = insert.slice(prefix.length);
|
|
443
443
|
}
|
|
444
|
-
const source = display(project.
|
|
444
|
+
const source = display(project.lookup(key, project.sourceLocale)?.value);
|
|
445
445
|
return [{
|
|
446
446
|
label: insert,
|
|
447
447
|
kind: CompletionItemKind.Text,
|
|
@@ -738,8 +738,8 @@ var Server = class {
|
|
|
738
738
|
})) : entry.project.usages({ path }).flatMap(({ usage }) => usage.key === void 0 ? [] : [{
|
|
739
739
|
key: usage.key,
|
|
740
740
|
range: this.range(entry, path, usage.range),
|
|
741
|
-
value: display(entry.project.
|
|
742
|
-
missing: usage.dynamic === false && entry.project.
|
|
741
|
+
value: display(entry.project.lookup(usage.key, locale)?.value),
|
|
742
|
+
missing: usage.dynamic === false && entry.project.lookup(usage.key, entry.project.sourceLocale) === void 0,
|
|
743
743
|
dynamic: usage.dynamic !== false
|
|
744
744
|
}]),
|
|
745
745
|
hardStrings: entry.project.hardStrings(path).map((h) => ({
|
|
@@ -791,7 +791,7 @@ var Server = class {
|
|
|
791
791
|
locale,
|
|
792
792
|
decorations: entry.project.usages({ path }).flatMap(({ usage }) => {
|
|
793
793
|
if (usage.key === void 0) return [];
|
|
794
|
-
const value = display(entry.project.
|
|
794
|
+
const value = display(entry.project.lookup(usage.key, locale)?.value);
|
|
795
795
|
const state = usage.dynamic !== false ? "dynamic" : value === void 0 ? "missing" : "ok";
|
|
796
796
|
return [{
|
|
797
797
|
range: this.range(entry, path, usage.range),
|
|
@@ -806,7 +806,7 @@ var Server = class {
|
|
|
806
806
|
/** Registers the x18n handlers on a connection. The caller owns transport and `listen()`. */
|
|
807
807
|
function setupServer(connection, options = {}) {
|
|
808
808
|
let ui;
|
|
809
|
-
const openUi = options.openUi ?? (async (entry) => (await (ui ??= import("./ui
|
|
809
|
+
const openUi = options.openUi ?? (async (entry) => (await (ui ??= import("./ui.mjs").then((m) => m.createUiServers(connection)))).open(entry));
|
|
810
810
|
connection.onShutdown(async () => {
|
|
811
811
|
await (await ui)?.close();
|
|
812
812
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x18n/lsp",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
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.
|
|
33
|
-
"@x18n/core": "0.0.
|
|
34
|
-
"@x18n/node": "0.0.
|
|
35
|
-
"@x18n/ui": "0.0.
|
|
32
|
+
"@x18n/builtins": "0.0.3",
|
|
33
|
+
"@x18n/core": "0.0.3",
|
|
34
|
+
"@x18n/node": "0.0.3",
|
|
35
|
+
"@x18n/ui": "0.0.3",
|
|
36
36
|
"devframe": "^1.2.5",
|
|
37
37
|
"vscode-languageserver": "^10.1.2",
|
|
38
38
|
"vscode-languageserver-textdocument": "^1.0.15"
|
|
File without changes
|