Files

184 lines
14 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.8</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 id="main" class="portal-main docs-layout docs-layout--navigation"><aside class="docs-section-menu" aria-label="Documentation sections"><nav>
<section><strong>Get started</strong><a href="/getting-started">Quick start</a><a href="/tutorial">Tutorial</a><a href="/guides/full-stack-auth-demo">Auth dashboard demo</a><a href="/guides/configuration-and-profiles">Configuration</a></section>
<section><strong>Build</strong><a href="/guides/pages-and-components">Pages and components</a><a href="/guides/routing">Routing</a><a href="/guides/server-data">Server data</a><a href="/guides/forms-and-validation">Forms and validation</a><a href="/guides/database">Database</a></section>
<section><strong>Auth and security</strong><a href="/guides/authentication">Authentication</a><a href="/guides/authorization">Authorization</a><a href="/guides/security">Application security</a><a href="/security">Security policy</a></section>
<section><strong>Reference</strong><a href="/packages">Packages overview</a><a href="/packages/cli">CLI</a><a href="/language">.wrn language</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/examples">Examples</a></section>
<section class="package-menu"><strong>Packages</strong><a href="/packages/ai">@wrnexus/ai</a><a href="/packages/auth">@wrnexus/auth</a><a href="/packages/authz">@wrnexus/authz</a><a href="/packages/benchmark">@wrnexus/benchmark</a><a href="/packages/cache">@wrnexus/cache</a><a href="/packages/captcha">@wrnexus/captcha</a><a href="/packages/cli">@wrnexus/cli</a><a href="/packages/compiler">@wrnexus/compiler</a><a href="/packages/content">@wrnexus/content</a><a href="/packages/core">@wrnexus/core</a><a href="/packages/csr">@wrnexus/csr</a><a href="/packages/db">@wrnexus/db</a><a href="/packages/dev-server">@wrnexus/dev-server</a><a href="/packages/dev-toolbar">@wrnexus/dev-toolbar</a><a href="/packages/encryption">@wrnexus/encryption</a><a href="/packages/graphql">@wrnexus/graphql</a><a href="/packages/helpers">@wrnexus/helpers</a><a href="/packages/i18n">@wrnexus/i18n</a><a href="/packages/identity">@wrnexus/identity</a><a href="/packages/image">@wrnexus/image</a><a href="/packages/jwt">@wrnexus/jwt</a><a href="/packages/language-server">@wrnexus/language-server</a><a href="/packages/mcp">@wrnexus/mcp</a><a href="/packages/mobile">@wrnexus/mobile</a><a href="/packages/native">@wrnexus/native</a><a href="/packages/oauth">@wrnexus/oauth</a><a href="/packages/observability">@wrnexus/observability</a><a href="/packages/playground">@wrnexus/playground</a><a href="/packages/plugin">@wrnexus/plugin</a><a href="/packages/pubsub">@wrnexus/pubsub</a><a href="/packages/pwa">@wrnexus/pwa</a><a href="/packages/queue">@wrnexus/queue</a><a href="/packages/reactive">@wrnexus/reactive</a><a href="/packages/realtime">@wrnexus/realtime</a><a href="/packages/router">@wrnexus/router</a><a href="/packages/security">@wrnexus/security</a><a href="/packages/ssr">@wrnexus/ssr</a><a href="/packages/store">@wrnexus/store</a><a href="/packages/styles">@wrnexus/styles</a><a href="/packages/syntax">@wrnexus/syntax</a><a href="/packages/test">@wrnexus/test</a><a href="/packages/tracking">@wrnexus/tracking</a><a href="/packages/typecheck">@wrnexus/typecheck</a><a href="/packages/ui">@wrnexus/ui</a><a href="/packages/uploader">@wrnexus/uploader</a><a href="/packages/validation">@wrnexus/validation</a></section>
</nav></aside><div class="docs-reading-column">
<article 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.8</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.8</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(&#123;
name = &quot;wrnexus&quot;,
cmd = &#123; &quot;bunx&quot;, &quot;wrnexus-language-server&quot;, &quot;--stdio&quot; &#125;,
root_dir = vim.fs.root(0, &#123; &quot;wrnexus.config.ts&quot;, &quot;package.json&quot;, &quot;.git&quot; &#125;),
&#125;)</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 &#123;
label: string;
kind: number;
detail: string;
insertText?: string;
data?: Record&lt;string, unknown&gt;;
&#125;
declare function workspaceCompletionItems(root: string): WorkspaceCompletionItem[];
declare function clearWorkspaceIndexCache(root?: string): void;
declare function workspaceSymbolLocations(root: string, name: string, limit?: number): &#123;
uri: string;
range: Range;
&#125;[];
declare function extractComponentRefactor(document: TextDocument, range: Range, name: string): &#123;
documentChanges: (&#123;
kind: string;
uri: string;
textDocument?: undefined;
edits?: undefined;
&#125; | &#123;
textDocument: &#123;
uri: string;
version: number | null;
&#125;;
edits: &#123;
range: Range;
newText: string;
&#125;[];
kind?: undefined;
uri?: undefined;
&#125;)[];
&#125;;
declare function htmlToWrn(html: string, name?: string): string;
interface Position &#123;
line: number;
character: number;
&#125;
interface Range &#123;
start: Position;
end: Position;
&#125;
interface TextDocument &#123;
uri: string;
text: string;
version?: number;
&#125;
declare const WRN_COMPLETIONS: readonly [&quot;page&quot;, &quot;component&quot;, &quot;layout&quot;, &quot;props&quot;, &quot;outputs&quot;, &quot;state&quot;, &quot;computed&quot;, &quot;effect&quot;, &quot;watch&quot;, &quot;lifecycle&quot;, &quot;load&quot;, &quot;action&quot;, &quot;api&quot;, &quot;realtime&quot;, &quot;view&quot;, &quot;style&quot;, &quot;runtime&quot;, &quot;hydrate&quot;];
declare function offsetAt(text: string, position: Position): number;
declare function positionAt(text: string, requestedOffset: number): Position;
declare function wordAt(text: string, position: Position): &#123;
word: string;
range: Range;
&#125; | null;
declare function documentDiagnostics(document: TextDocument, options?: &#123;
includeTypes?: boolean;
&#125;): &#123;
range: &#123;
start: &#123;
line: number;
character: number;
&#125;;
end: &#123;
line: number;
character: number;
&#125;;
&#125;;
severity: number;
code: string;
source: string;
message: string;
&#125;[];
/** TypeScript representation consumed by editor TypeScript plugins and safe refactoring tools. */
declare function virtualTypeScriptDocument(document: TextDocument): &#123;
uri: string;
languageId: &quot;typescript&quot;;
text: string;
mappings: Array&lt;&#123;
virtualStartLine: number;
virtualEndLine: number;
sourceStartLine: number;
sourceStartColumn: number;
&#125;&gt;;
&#125;;
declare function formatDocument(document: TextDocument, tabSize?: number, insertSpaces?: boolean): &#123;
range: &#123;
start: &#123;
line: number;
character: number;
&#125;;
end: Position;
&#125;;
newText: string;
&#125;[];
declare function documentSymbols(document: TextDocument): &#123;
name: string;
kind: number;
range: &#123;
start: Position;
end: Position;
&#125;;
selectionRange: &#123;
start: Position;
end: Position;
&#125;;
&#125;[];
declare function symbolLocations(document: TextDocument, position: Position): &#123;
uri: string;
range: &#123;
start: Position;
end: Position;
&#125;;
&#125;[];
declare function definitionLocation(document: TextDocument, position: Position): &#123;
uri: string;
range: &#123;
start: Position;
end: Position;
&#125;;
&#125; | null;
declare function hover(document: TextDocument, position: Position): &#123;
contents: &#123;
kind: string;
value: string;
&#125;;
range: Range;
&#125; | null;
declare function completionItems(): &#123;
label: &quot;page&quot; | &quot;component&quot; | &quot;layout&quot; | &quot;props&quot; | &quot;outputs&quot; | &quot;state&quot; | &quot;computed&quot; | &quot;effect&quot; | &quot;watch&quot; | &quot;lifecycle&quot; | &quot;load&quot; | &quot;action&quot; | &quot;api&quot; | &quot;realtime&quot; | &quot;view&quot; | &quot;style&quot; | &quot;runtime&quot; | &quot;hydrate&quot;;
kind: number;
detail: string;
&#125;[];
declare const semanticTokensLegend: &#123;
tokenTypes: &quot;variable&quot;[];
tokenModifiers: (&quot;declaration&quot; | &quot;modification&quot;)[];
&#125;;
/** Encode state declarations, reads, and writes using the LSP relative token format. */
declare function semanticTokens(document: TextDocument): &#123;
data: number[];
&#125;;
export &#123; type Position, type Range, type TextDocument, WRN_COMPLETIONS, type WorkspaceCompletionItem, clearWorkspaceIndexCache, completionItems, definitionLocation, documentDiagnostics, documentSymbols, extractComponentRefactor, formatDocument, hover, htmlToWrn, offsetAt, positionAt, semanticTokens, semanticTokensLegend, symbolLocations, virtualTypeScriptDocument, wordAt, workspaceCompletionItems, workspaceSymbolLocations &#125;;
</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(&#123;
name = &quot;wrnexus&quot;,
cmd = &#123; &quot;bunx&quot;, &quot;wrnexus-language-server&quot;, &quot;--stdio&quot; &#125;,
root_dir = vim.fs.root(0, &#123; &quot;wrnexus.config.ts&quot;, &quot;package.json&quot;, &quot;.git&quot; &#125;),
&#125;)</code></pre></article></div></section></article></div>
<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.8</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>
}
}