Skip to content

About

TypeScript language plugin for Nanobug

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TypeScript for Nanobug

简体中文

An independent Nanobug plugin owning TypeScript project contexts and native compiler workers. Plugin 0.1.15 supports the verified Windows x86-64 combinations of TypeScript 5.9.3, Node 24.19.0, and Vue 2.6.14, 2.7.16 and 3.5.22 through the independent Vue plugin. Vue support covers the 26 declared applicable writing combinations and their pinned dependencies. It retains the exact native service 0.1.14 archive and its SHA-256 71c2794f0833bb548d365255878362b4637750bdac05e7ff7e8392df73884f83. Plugin and native artifact versions are independent. Each selected configured root (or inferred source directory) has its own host transport lifetime; the original workspace boundary still contains shared source snapshots. This functional support declaration does not imply a Release or marketplace publication.

The unchanged native closure passed 48 source and 48 sealed tool tests with no skips. Retained native historical/edit and external-script scenarios keep their original package identities. Host verification passed S4 conflict rejection/recovery (280.28s), S5 outer update/recovery (164.27s), Worker revocation/live update (67.94s/67.84s), and the three-version warm-cache S1 scenario using the .15/.12 pending-support metadata candidates (97.62s). These are retained runs, not new runs against a support-label rebuild.

Ordinary Windows desktop observations cover the seven language operations, completion resolve with an import and one Undo, cross-file preview/cancel/apply/group Undo, project selection and persisted preference, real Chinese IME candidate/commit/cancel/Undo, scrolling and font-size changes. Warm-cache hover, light/dark prose/inline/code rendering and Ctrl+I → Escape → Ctrl+I reopening have actual regression and desktop evidence. Scope, input identities and the known accessibility teardown limitation are recorded in the host desktop verification. Exact archive identities and Package/Manager policy and pair results are tracked separately in the host delivery receipt; this metadata does not certify a particular ZIP test run.

Standard LSP provides completion and resolve, diagnostics, hover, definitions, references, cross-file rename, and formatting for JS/JSX/TS/TSX. Source synchronization uses editor snapshots; it never writes source files. Configured and inferred contexts are shared through consumer-specific opaque references. Explicit incompatible SDK selection fails instead of falling back silently. Selectable Tree-sitter providers supply syntax highlighting for all four languages; pinned sources, hashes and licenses are included under grammar/.

Compiler input is byte-bounded and ordered through physical pipe completion; paused engines apply backpressure to document dispatch. Failed adapter admission reports a versioned import-release receipt only after its candidate worker is gone (or before any candidate exists). Saved guest state is empty: compiler references and pending invocations are never restored as durable state.

Unexpected failure of an initialized compiler or admitted adapter ends its owning stdio service after all owned children close. The host then applies its ordinary bounded recovery to that context and prepares its adapters again. Other context services remain independent. Explicit shutdown, provisional adapter rejection, ordinary business errors and request cancellation do not become crash signals.

For a source included by several configured projects, the compiler enumerates actual graph membership. A native QuickPick selects the display context; the editor's Select analysis project command can change it. Explicit choices use workspace-local private preference CAS. Preference names are the 64 lowercase hex digits of SHA-256 over UTF-8 typescript.project.v1, one NUL byte, then the exact host-issued workspace-relative UTF-8 path with / separators, without case folding or Unicode normalization. Navigation can lend its source project's live context to the target for that navigation without changing the saved preference. Cancelling an ambiguous choice publishes no primary binding. Configuration fingerprints keep host generations monotonic across independently restarted workers. The public language.lsp 1.6 registry and interactive prepare profile mediate this collaboration; an internal engine declaration is excluded from user provider choices and retains ordinary consent and resource checks.

Public collaboration contracts and exact schemas are in contracts.json; usage, revision rules and authority boundaries are documented beside src/lib.rs, native/control.mjs and native/adapters.mjs. Only a host-sealed immutable export with ABI typescript.adapter/1, matching engine range and complete file digests may enter an owned adapter worker. Every attachment rechecks the closure and rejects unlisted neighbors. Node module hooks restrict ordinary require/import to that closure and the selected engine; the worker disables project TypeScript plugin loading. Native adapters retain process privileges: this does not sandbox filesystem access, VM/eval or other operating-system actions.

Primary and contribution modules resolve through the native canonical entries returned by closure verification. This preserves host-issued Windows path identity while avoiding Node's JavaScript realpath handling of raw verbatim paths; it does not grant access by trimming a prefix or changing the sealed file set.

Adapter contract 1.1 supports explicitly requested ecosystem composition. Asynchronous preparation uses plugin.services >=1.2 OpenSet and contribution-contract.json; TypeScript owns every reference and loads only host-sealed exports. Exclusive slots, incompatible ABIs and ordering cycles fail explicitly. Selection/membership changes retire the affected native composition, including a previously empty set. Older single-adapter callers remain compatible; ecosystem callers require adapter >=1.1.

Build from the repository root, using a host containing the matching public SDK:

pnpm install --frozen-lockfile --ignore-scripts
node build.mjs --stage
Compress-Archive -Path target/service/* -DestinationPath artifacts/typescript-windows-x86_64.zip -Force
node build.mjs
$hostExe = 'C:/path/to/editor-app.exe'
& $hostExe --plugin-cargo Cargo.toml build --target wasm32-wasip2 --release -j 2
& $hostExe --plugin-build .
& $hostExe --plugin-package .

The staging command copies the executing Node runtime and locked TypeScript distribution. Run it with Node 24.19.0; its upstream license is retained under licenses/. All runtime bytes are packaged with their SHA-256, so deployment needs no project-wide installation or global environment changes. The guest depends only on the host-exported SDK. A metadata-only plugin update retains the existing native archive and skips staging/compression; build.mjs keeps that artifact's independent 0.1.14 identity.

Verify with node --test --test-concurrency=1 test/*.test.mjs, node node_modules/typescript/bin/tsc -p jsconfig.json, and cargo fmt --check. Cross-repository Vue acceptance is explicit: set NANOBUG_VUE_FIXTURES to the independent Vue plugin checkout before running tests. Without it, that integration case is skipped and must not be reported as passed.

Current limits: only TS 5.9.3 is admitted. Navigation and edits are workspace-contained; external SDK/library targets return an explicit unsupported result. Configuration, extended/referenced configurations and ancestor manifest/lock changes advance generations; replacing installed dependencies without changing this evidence still requires host retirement. A different adapter for an already active project requires host configuration retirement. Unknown workspace file or configuration events may conservatively expire issued results and previews in other projects, while their bindings and transports remain available. An explicit display-context selection expires only the selected source's results. Consumer snapshot vectors must include relevant open dependencies. macOS/Linux, other architectures and live UNC share execution are untested. Real Windows IME evidence is limited to the recorded Chinese candidate/commit/cancel/Undo sequence. An existing AccessKit Windows accessibility teardown path can abort with invalid HWND/COM cannot-unwind after window closure; that upstream limitation is recorded in the host evidence and is not fixed by this plugin support declaration.

About

TypeScript language plugin for Nanobug

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages