@wrnexus/language-server
Editor-neutral language intelligence for WRN files.
Install the package
After WorkRoot approves private registry access, install the release-aligned package:
bun add @wrnexus/language-server@0.8.7Request preview access. Never put registry tokens in source control.
Editor-neutral Language Server Protocol support for .wrn files. It uses the canonical @wrnexus/syntax parser, diagnostics, accessibility rules, and formatter.
bunx wrnexus-language-server --stdio
Capabilities include syntax, accessibility and TypeScript expression diagnostics, formatting, completion, hover, document symbols, go-to-definition, references, rename, and quick fixes. The custom wrnexus/virtualDocument request returns the mapped TypeScript representation of an open .wrn document for editor TypeScript plugins and safe refactoring tools. Any LSP 3.x client can launch the stdio command. Example Neovim configuration:
vim.lsp.start({
name = "wrnexus",
cmd = { "bunx", "wrnexus-language-server", "--stdio" },
root_dir = vim.fs.root(0, { "wrnexus.config.ts", "package.json", ".git" }),
})
JetBrains users can register the same command through an LSP client/plugin. The server does not require VS Code and never reads environment secrets or sends source over a network.
Complete TypeScript API
Generated from the exact installed package declarations.
interface WorkspaceCompletionItem {
label: string;
kind: number;
detail: string;
insertText?: string;
data?: Record<string, unknown>;
}
declare function workspaceCompletionItems(root: string): WorkspaceCompletionItem[];
declare function clearWorkspaceIndexCache(root?: string): void;
declare function extractComponentRefactor(document: TextDocument, range: Range, name: string): {
documentChanges: ({
kind: string;
uri: string;
textDocument?: undefined;
edits?: undefined;
} | {
textDocument: {
uri: string;
version: number | null;
};
edits: {
range: Range;
newText: string;
}[];
kind?: undefined;
uri?: undefined;
})[];
};
declare function htmlToWrn(html: string, name?: string): string;
interface Position {
line: number;
character: number;
}
interface Range {
start: Position;
end: Position;
}
interface TextDocument {
uri: string;
text: string;
version?: number;
}
declare const WRN_COMPLETIONS: readonly ["page", "component", "layout", "props", "outputs", "state", "computed", "effect", "watch", "lifecycle", "load", "action", "api", "realtime", "view", "style", "runtime", "hydrate"];
declare function offsetAt(text: string, position: Position): number;
declare function positionAt(text: string, requestedOffset: number): Position;
declare function wordAt(text: string, position: Position): {
word: string;
range: Range;
} | null;
declare function documentDiagnostics(document: TextDocument): {
range: {
start: {
line: number;
character: number;
};
end: {
line: number;
character: number;
};
};
severity: number;
code: string;
source: string;
message: string;
}[];
/** TypeScript representation consumed by editor TypeScript plugins and safe refactoring tools. */
declare function virtualTypeScriptDocument(document: TextDocument): {
uri: string;
languageId: "typescript";
text: string;
mappings: Array<{
virtualStartLine: number;
virtualEndLine: number;
sourceStartLine: number;
sourceStartColumn: number;
}>;
};
declare function formatDocument(document: TextDocument, tabSize?: number, insertSpaces?: boolean): {
range: {
start: {
line: number;
character: number;
};
end: Position;
};
newText: string;
}[];
declare function documentSymbols(document: TextDocument): {
name: string;
kind: number;
range: {
start: Position;
end: Position;
};
selectionRange: {
start: Position;
end: Position;
};
}[];
declare function symbolLocations(document: TextDocument, position: Position): {
uri: string;
range: {
start: Position;
end: Position;
};
}[];
declare function definitionLocation(document: TextDocument, position: Position): {
uri: string;
range: {
start: Position;
end: Position;
};
} | null;
declare function hover(document: TextDocument, position: Position): {
contents: {
kind: string;
value: string;
};
range: Range;
} | null;
declare function completionItems(): {
label: "page" | "component" | "layout" | "props" | "outputs" | "state" | "computed" | "effect" | "watch" | "lifecycle" | "load" | "action" | "api" | "realtime" | "view" | "style" | "runtime" | "hydrate";
kind: number;
detail: string;
}[];
export { type Position, type Range, type TextDocument, WRN_COMPLETIONS, type WorkspaceCompletionItem, clearWorkspaceIndexCache, completionItems, definitionLocation, documentDiagnostics, documentSymbols, extractComponentRefactor, formatDocument, hover, htmlToWrn, offsetAt, positionAt, symbolLocations, virtualTypeScriptDocument, wordAt, workspaceCompletionItems };
Examples
Copy-ready examples from the installed package documentation.
@wrnexus/syntax parser, diagnostics, accessibility rules, and formatter.
bunx wrnexus-language-server --stdiostdio command. Example Neovim configuration
vim.lsp.start({
name = "wrnexus",
cmd = { "bunx", "wrnexus-language-server", "--stdio" },
root_dir = vim.fs.root(0, { "wrnexus.config.ts", "package.json", ".git" }),
})