feat: restore gateway HMR and add WRN formatting
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user