feat: restore gateway HMR and add WRN formatting

This commit is contained in:
2026-07-13 14:54:03 +05:30
parent 3b46c69601
commit cff420a29e
71 changed files with 727 additions and 119 deletions
+12
View File
@@ -2,6 +2,7 @@
"use strict";
const vscode = require("vscode");
const { formatWrn } = require("./formatter.js");
// The .wrn compiler, bundled to CJS by `bun run build:compiler`. Loaded
// defensively so the rest of the extension (highlighting, snippets, completion)
@@ -112,6 +113,17 @@ function activate(context) {
// Completions.
context.subscriptions.push(
vscode.languages.registerDocumentFormattingEditProvider("wrn", {
provideDocumentFormattingEdits(document, options) {
if (!vscode.workspace.getConfiguration("wrnexus").get("format.enable", true)) return [];
const formatted = formatWrn(document.getText(), options);
if (formatted === document.getText()) return [];
const end = document.positionAt(document.getText().length);
return [
vscode.TextEdit.replace(new vscode.Range(new vscode.Position(0, 0), end), formatted),
];
},
}),
vscode.languages.registerCompletionItemProvider(
"wrn",
{ provideCompletionItems: provideCompletions },