164 lines
9.7 KiB
Plaintext
164 lines
9.7 KiB
Plaintext
page wrnexuslanguageserver {
|
|
seo {
|
|
title = "@wrnexus/language-server"
|
|
description = "Editor-neutral language intelligence for WRN files."
|
|
}
|
|
|
|
view {
|
|
<div class="docs-shell">
|
|
<a href="#main" class="skip-link">Skip to content</a>
|
|
<header class="topbar">
|
|
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
|
|
<nav aria-label="Primary"><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
|
|
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.8.4</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
|
|
</header>
|
|
<div class="mobile-doc-nav"><details><summary>Browse documentation</summary><nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a><a href="/tutorial">Tutorial</a><a href="/guides/project-structure">Guides</a><a href="/examples">Examples</a><a href="/search">Search</a></nav></details></div>
|
|
<main class="portal-main docs-layout">
|
|
<article id="main" class="documentation prose standalone package-document"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/packages">Packages</a><span>/</span><span aria-current="page">@wrnexus/language-server</span></nav><section class="doc-intro"><span class="eyebrow">Tooling · Package reference</span><h1>@wrnexus/language-server</h1><p>Editor-neutral language intelligence for WRN files.</p><div class="doc-meta"><span>v0.8.4</span><span>Private registry</span><span>Tooling</span></div><section id="access" class="access-callout"><h2>Install the package</h2><p>After WorkRoot approves private registry access, install the release-aligned package:</p><pre><code>bun add @wrnexus/language-server@0.8.4</code><button type="button" class="copy-button" aria-label="Copy installation command">Copy</button></pre><p><a href="/access">Request preview access</a>. Never put registry tokens in source control.</p></section></section><section id="guide"><p>Editor-neutral Language Server Protocol support for <code>.wrn</code> files. It uses the canonical <code>@wrnexus/syntax</code> parser, diagnostics, accessibility rules, and formatter.</p>
|
|
<pre data-language="bash"><code>bunx wrnexus-language-server --stdio</code></pre>
|
|
<p>Capabilities include syntax, accessibility and TypeScript expression diagnostics, formatting, completion, hover, document symbols, go-to-definition, references, rename, and quick fixes. The custom <code>wrnexus/virtualDocument</code> request returns the mapped TypeScript representation of an open <code>.wrn</code> document for editor TypeScript plugins and safe refactoring tools. Any LSP 3.x client can launch the stdio command. Example Neovim configuration:</p>
|
|
<pre data-language="lua"><code>vim.lsp.start({
|
|
name = "wrnexus",
|
|
cmd = { "bunx", "wrnexus-language-server", "--stdio" },
|
|
root_dir = vim.fs.root(0, { "wrnexus.config.ts", "package.json", ".git" }),
|
|
})</code></pre>
|
|
<p>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.</p></section><section id="api" class="api"><h2>Complete TypeScript API</h2><p>Generated from the exact installed package declarations.</p><pre data-language="typescript"><code>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 };
|
|
</code></pre></section><section id="examples" class="examples"><h2>Examples</h2><p>Copy-ready examples from the installed package documentation.</p><div class="example-grid"><article class="example-card"><h3>@wrnexus/syntax parser, diagnostics, accessibility rules, and formatter.</h3><pre data-language="bash"><code>bunx wrnexus-language-server --stdio</code></pre></article><article class="example-card"><h3>stdio command. Example Neovim configuration</h3><pre data-language="lua"><code>vim.lsp.start({
|
|
name = "wrnexus",
|
|
cmd = { "bunx", "wrnexus-language-server", "--stdio" },
|
|
root_dir = vim.fs.root(0, { "wrnexus.config.ts", "package.json", ".git" }),
|
|
})</code></pre></article></div></section></article>
|
|
<aside class="on-this-page"><h2>On this page</h2><nav><a class="toc-level-2" href="#guide">Guide</a><a class="toc-level-2" href="#api">Complete API</a><a class="toc-level-2" href="#examples">Examples</a></nav></aside>
|
|
</main>
|
|
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.8.4</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
|
|
</div>
|
|
}
|
|
}
|