@x18n/lsp 0.0.13 → 0.0.14
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/src.mjs +14 -5
- package/package.json +5 -5
package/dist/src.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relative, resolve, sep } from "node:path";
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import { extractItems, findCandidates } from "@x18n/builtins/extractors";
|
|
4
|
-
import { createLineIndex, createOverlayHost, isX18nError, renderPrompt } from "@x18n/core";
|
|
4
|
+
import { createLineIndex, createOverlayHost, isX18nError, joinKey, renderPrompt, splitKey } from "@x18n/core";
|
|
5
5
|
import { loadWorkspace, migrateI18nAlly } from "@x18n/node";
|
|
6
6
|
import { CodeActionKind, CompletionItemKind, DiagnosticSeverity, DidChangeWatchedFilesNotification, FileChangeType, ResponseError, SymbolKind, TextDocumentSyncKind, TextDocuments } from "vscode-languageserver";
|
|
7
7
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
@@ -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.14";
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/server.ts
|
|
34
34
|
const severities = {
|
|
@@ -61,7 +61,9 @@ function changedAt(change) {
|
|
|
61
61
|
change.author
|
|
62
62
|
].filter(Boolean).join(" · ");
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
function posix(path) {
|
|
65
|
+
return sep === "\\" ? path.replace(/\\/g, "/") : path;
|
|
66
|
+
}
|
|
65
67
|
var Server = class {
|
|
66
68
|
connection;
|
|
67
69
|
options;
|
|
@@ -461,9 +463,16 @@ var Server = class {
|
|
|
461
463
|
const scopeNs = usage?.scopeNamespace ?? project.config.namespace.default;
|
|
462
464
|
const prefix = usage?.scopePrefix ? `${usage.scopePrefix}.` : "";
|
|
463
465
|
const range = this.range(at.entry, at.path, slot);
|
|
464
|
-
|
|
466
|
+
const { separator, fallback } = project.config.namespace;
|
|
467
|
+
const keys = project.keys();
|
|
468
|
+
const known = new Set(keys);
|
|
469
|
+
return keys.flatMap((key) => {
|
|
465
470
|
let insert = key;
|
|
466
|
-
if (project.namespaced
|
|
471
|
+
if (project.namespaced) {
|
|
472
|
+
const { namespace, path } = splitKey(key);
|
|
473
|
+
const bare = path.join(".");
|
|
474
|
+
insert = namespace === scopeNs || namespace !== void 0 && fallback.includes(namespace) && !known.has(joinKey(scopeNs, path)) || namespace === void 0 ? bare : `${namespace}${separator}${bare}`;
|
|
475
|
+
}
|
|
467
476
|
if (prefix) {
|
|
468
477
|
if (!insert.startsWith(prefix)) return [];
|
|
469
478
|
insert = insert.slice(prefix.length);
|
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.14",
|
|
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.14",
|
|
33
|
+
"@x18n/core": "0.0.14",
|
|
34
|
+
"@x18n/node": "0.0.14",
|
|
35
|
+
"@x18n/ui": "0.0.14",
|
|
36
36
|
"devframe": "^1.2.6",
|
|
37
37
|
"vscode-languageserver": "^10.1.2",
|
|
38
38
|
"vscode-languageserver-textdocument": "^1.0.15"
|