@lokascript/language-server 2.0.0 → 2.1.0
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/dist-B64L7SG5.js +6807 -0
- package/dist/server.js +44 -3
- package/package.json +3 -2
package/dist/server.js
CHANGED
|
@@ -338,8 +338,9 @@ try {
|
|
|
338
338
|
parseFunction = core.parse;
|
|
339
339
|
fromCoreASTFn = core.fromCoreAST;
|
|
340
340
|
interchangeLSP = await import("@hyperfixi/core/ast-utils");
|
|
341
|
+
console.error("[lokascript-ls] @hyperfixi/core loaded \u2014 AST parsing + interchange LSP enabled");
|
|
341
342
|
} catch {
|
|
342
|
-
console.error("[lokascript-ls] @hyperfixi/core not available");
|
|
343
|
+
console.error("[lokascript-ls] @hyperfixi/core not available \u2014 diagnostics and hover degraded");
|
|
343
344
|
}
|
|
344
345
|
try {
|
|
345
346
|
lspMetadata = await import("@hyperfixi/core/lsp-metadata");
|
|
@@ -348,6 +349,21 @@ try {
|
|
|
348
349
|
"[lokascript-ls] @hyperfixi/core/lsp-metadata not available - using fallback keywords"
|
|
349
350
|
);
|
|
350
351
|
}
|
|
352
|
+
var frameworkIR = null;
|
|
353
|
+
try {
|
|
354
|
+
const fw = await import("./dist-B64L7SG5.js");
|
|
355
|
+
frameworkIR = { fromInterchangeNode: fw.fromInterchangeNode, renderExplicit: fw.renderExplicit };
|
|
356
|
+
console.error(
|
|
357
|
+
"[lokascript-ls] @lokascript/framework loaded \u2014 LSE bracket notation in hover enabled"
|
|
358
|
+
);
|
|
359
|
+
} catch {
|
|
360
|
+
console.error(
|
|
361
|
+
"[lokascript-ls] @lokascript/framework not available \u2014 hover will omit LSE bracket notation"
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
console.error(
|
|
365
|
+
`[lokascript-ls] capabilities: core=${!!parseFunction}, interchange=${!!interchangeLSP}, metadata=${!!lspMetadata}, framework=${!!frameworkIR}`
|
|
366
|
+
);
|
|
351
367
|
var FALLBACK_KEYWORDS = [
|
|
352
368
|
"toggle",
|
|
353
369
|
"add",
|
|
@@ -999,8 +1015,14 @@ connection.onHover((params) => {
|
|
|
999
1015
|
if (!currentLine2) return null;
|
|
1000
1016
|
const word2 = getWordAtPosition(currentLine2, found.localChar);
|
|
1001
1017
|
if (!word2) return null;
|
|
1002
|
-
|
|
1018
|
+
let doc2 = getHoverDocumentation(word2.text, globalSettings.language);
|
|
1003
1019
|
if (!doc2) return null;
|
|
1020
|
+
const lse2 = tryGetLSE(found.region.code);
|
|
1021
|
+
if (lse2) {
|
|
1022
|
+
doc2 += `
|
|
1023
|
+
|
|
1024
|
+
**LSE:** \`${lse2}\``;
|
|
1025
|
+
}
|
|
1004
1026
|
const startChar = found.localLine === 0 ? found.region.startChar + word2.start : word2.start;
|
|
1005
1027
|
const endChar = found.localLine === 0 ? found.region.startChar + word2.end : word2.end;
|
|
1006
1028
|
return {
|
|
@@ -1016,8 +1038,14 @@ connection.onHover((params) => {
|
|
|
1016
1038
|
if (!currentLine) return null;
|
|
1017
1039
|
const word = getWordAtPosition(currentLine, position.character);
|
|
1018
1040
|
if (!word) return null;
|
|
1019
|
-
|
|
1041
|
+
let doc = getHoverDocumentation(word.text, globalSettings.language);
|
|
1020
1042
|
if (!doc) return null;
|
|
1043
|
+
const lse = tryGetLSE(text);
|
|
1044
|
+
if (lse) {
|
|
1045
|
+
doc += `
|
|
1046
|
+
|
|
1047
|
+
**LSE:** \`${lse}\``;
|
|
1048
|
+
}
|
|
1021
1049
|
return {
|
|
1022
1050
|
contents: { kind: MarkupKind.Markdown, value: doc },
|
|
1023
1051
|
range: {
|
|
@@ -1030,6 +1058,19 @@ connection.onHover((params) => {
|
|
|
1030
1058
|
return null;
|
|
1031
1059
|
}
|
|
1032
1060
|
});
|
|
1061
|
+
function tryGetLSE(code) {
|
|
1062
|
+
if (!interchangeLSP || !parseFunction || !fromCoreASTFn || !frameworkIR) return null;
|
|
1063
|
+
try {
|
|
1064
|
+
const ast = parseFunction(code);
|
|
1065
|
+
if (!ast) return null;
|
|
1066
|
+
const interchange = fromCoreASTFn(ast);
|
|
1067
|
+
if (!interchange) return null;
|
|
1068
|
+
const semanticNode = frameworkIR.fromInterchangeNode(interchange);
|
|
1069
|
+
return frameworkIR.renderExplicit(semanticNode);
|
|
1070
|
+
} catch {
|
|
1071
|
+
return null;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1033
1074
|
function getHoverDocumentation(word, language) {
|
|
1034
1075
|
const wordLower = word.toLowerCase();
|
|
1035
1076
|
const canonicalKey = isMultilingualEnabled(resolvedMode) ? resolveCanonicalKeyword(wordLower, language) : wordLower;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokascript/language-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Language Server Protocol implementation for LokaScript/hyperscript with 21 language support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/server.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"start": "node dist/server.js --stdio",
|
|
13
13
|
"dev": "tsx src/server.ts --stdio",
|
|
14
14
|
"test": "vitest",
|
|
15
|
-
"typecheck": "tsc --noEmit"
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"test:check": "vitest run --reporter=dot 2>&1 | tail -5"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"lsp",
|