feat: integrate monaco-languageclient v10 with NWScript LSP

Replace hand-rolled LSP client (lspClient.ts, useLspClient.ts) with
monaco-languageclient v10 extended mode using @typefox/monaco-editor-react.
NWScript TextMate grammar from the LSP submodule provides syntax highlighting.
Full LSP features: completion, hover, diagnostics, go-to-definition, signature
help — all wired through WebSocket to the nwscript-language-server.

LSP server patches: fix workspaceFolders null assertion crash, handle missing
workspace/configuration gracefully, derive rootPath from rootUri when null,
guard tokenizer getRawTokenContent against undefined tokens.

Backend fixes: WebSocket routing changed to noServer mode so /ws, /ws/lsp,
and /ws/terminal/* don't conflict. TLK index loaded at startup (41,927 entries
from nwn-haks/layonara.tlk.json). Workspace routes get proper try/catch.
writeConfig creates parent directories. setupClone ensures workspace structure.

Frontend: GffEditor and AreaEditor rewritten with inline styles and TLK
resolution for CExoLocString fields. EditorTabs rewritten with lucide icons.
Tab content hydrates from API on refresh. Setup wizard gets friendly error
messages. SimpleEditor/SimpleDiffEditor for non-LSP editor uses. Vite config
updated for monaco-vscode-api compatibility.
This commit is contained in:
plenarius
2026-04-21 05:23:52 -04:00
parent cbe51a6e67
commit f39f1d818b
62 changed files with 9355 additions and 1137 deletions
+24 -9
View File
@@ -9,21 +9,36 @@ import {
const router = Router();
router.get("/config", async (_req, res) => {
const config = await readConfig();
const sanitized = { ...config, githubPat: config.githubPat ? "***" : undefined };
res.json(sanitized);
try {
const config = await readConfig();
const sanitized = { ...config, githubPat: config.githubPat ? "***" : undefined };
res.json(sanitized);
} catch (err: unknown) {
const message = err instanceof Error ? err.message : "Failed to read config";
res.status(500).json({ error: message });
}
});
router.put("/config", async (req, res) => {
const current = await readConfig();
const updated = { ...current, ...req.body };
await writeConfig(updated);
res.json({ ok: true });
try {
const current = await readConfig();
const updated = { ...current, ...req.body };
await writeConfig(updated);
res.json({ ok: true });
} catch (err: unknown) {
const message = err instanceof Error ? err.message : "Failed to save config";
res.status(500).json({ error: message });
}
});
router.post("/init", async (_req, res) => {
await ensureWorkspaceStructure();
res.json({ ok: true, path: getWorkspacePath() });
try {
await ensureWorkspaceStructure();
res.json({ ok: true, path: getWorkspacePath() });
} catch (err: unknown) {
const message = err instanceof Error ? err.message : "Failed to initialize workspace";
res.status(500).json({ error: message });
}
});
export default router;