char/avril
(wip) why'd you have to go and make things so complicaaaaated?
git clone https://git.t4t.associates/char/avril
ab5df08
main
files
| README.md | 4.7 KiB |
| bridge.patch | 50.7 KiB |
| build.sh | 1.2 KiB |
Pinned native TypeScript patch
bridge.patch targets Microsoft/TypeScript commit
b5c34ba0c61a756c8abaf133236dddf982c27f45. It exposes the native language
service through the existing --api --async transport, retaining API-owned
synthetic programs, snapshots, static module resolutions and filesystem controls.
There is no second project-discovery lifecycle.
Build and maintenance
See installation. build.sh CHECKOUT [OUTPUT] verifies
the exact revision and checks patch applicability before applying it. It never
resets or cleans a checkout. It stamps the pinned distribution version with
upstream's supported linker variable and embeds upstream library resources.
Go downloads the toolchain selected by the upstream module when necessary.
The executable must be trusted; callbacks are not an OS sandbox.
Keep changes here as an upstream patch, not a checked-in compiler copy. On an upgrade, apply to the new exact revision, run the native API/IPC/auto-import tests and Avril's real-backend workspace tests, then update the pin and build version together. The added Go regression tests are part of the patch.
Protocol v1
avril/lspCapabilities({capabilities})returns{version:1, methods:string[], capabilities}.capabilitiesis the client's ordinary LSP capability object. Rust advertises the returned feature set and usesmethodsas its allowlist; text synchronization remains frontend-owned.avril/lsp({snapshot, project, projects, method, params, capabilities, preferences, moduleSpecifiers})returns the ordinary native LSP result.paramscontains compiler document identities.projectis the initiating program; searches are bounded to the explicitly suppliedprojects. An item from a different program may select another supplied program containing it.moduleSpecifierscontains{from, to, specifier}entries, with compiler file paths infrom/toand valid original import text inspecifier. Auto-imports index only those explicit programs and use these mappings, never compiler-only relative paths. Ambient-module names already declared in the programs retain their native identity. Unknown targets fail closed.preferencesis an optional nativeUserPreferencesoverlay. Omitted fields preserve snapshot defaults. Neither preferences nor capabilities can enable filesystem acquisition, plugins, typings installation or project discovery.avril/readDocument({snapshot, project, projects, textDocument:{uri}})serves onlybundled:///libs/lib.*.d.tssource files already in those programs. There is no filesystem fallback. Rust exposes them under the read-onlyavril-builtin:/typescript/scheme.- Standard
$/cancelRequestcancels asynchronous API request contexts. Native bridge requests retain their snapshots until they finish, including when the client cancels and releases its generation.
Language-service converters use UTF-16 without changing the ordinary API's UTF-8 snapshot convention. Rust maps locations, edits and document links, binds opaque continuations to generations, and rejects read-only edit sets atomically. Native completion and code-lens data must not be forwarded from an editor without that binding. Native code actions are eager; resolving one is a validated round-trip of its already-materialized edit.
Surface and limits
The patch exposes native hover, signature help, completion/resolve, definition/type definition/implementation, references, rename/prepare, highlights, document/workspace symbols, folding, selection, full/range semantic tokens, inlay hints, linked editing, call hierarchy, code lenses/resolve, diagnostics, formatting (document/range/on-type), and native code actions (including organize imports and fixes).
This does not turn the pinned native implementation into all of classic tsserver. Its full refactor catalog and type hierarchy are not implemented upstream. File moves/import updates and arbitrary execute-command requests are not exposed. No unsupported provider is advertised. See the frontend limits for acquisition, indexing and incremental-session limitations.
Native regression tests
In the patched checkout's tsc/ directory:
go test ./internal/api ./internal/ipc ./internal/ls/autoimport
The added tests exercise synthetic API snapshots (not discovered projects), graph-scoped completion/resolve and denial, preferences, UTF-16, explicitly scoped cross-program references/rename/call hierarchy, library membership, and request cancellation without disconnecting the API transport. Avril's CLI integration tests cover original URI mapping, immutable dependency edits, resolver authority, stale data and live graph refreshes end to end.