Skip to content

[LSP] Complete compiler-backed LSP and IDE integrations - #693

Open
lagergren wants to merge 324 commits into
masterfrom
errs/full-testable-lsp-20261009
Open

lagergren wants to merge 324 commits into
masterfrom
errs/full-testable-lsp-20261009

Conversation

@lagergren

@lagergren lagergren commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

This is the complete compiler-backed language tooling for Ecstasy, provided as a reference: the language server, its IntelliJ and VS Code integrations, building, running and debugging programs from both editors, and the compiler and embedding mechanisms outside lang/ that make them possible. It is here so people can build and try the complete product, and see why those mechanisms are needed. It is not meant to merge as it stands; its parts land on master as their own pull requests.

Start with javatools/lsp-compiler.md — Compiler support for the language server. It explains what changed in javatools, why the compiler-backed language server needs it, how the mechanisms work, and their compatibility and validation contracts, with a file-by-file appendix of every changed javatools file.

Summary

Why?

  • The compiler-backed tooling spans compiler APIs, incomplete-source analysis, the language server, two editors and a debugger; the foundation pull requests alone cannot show the complete editing and debugging experience.
  • Reviewers need one buildable checkout to try the assembled implementation and judge whether its compiler foundations support the intended workflows.
  • This PR keeps that complete reference while the smaller compiler, runtime and embedding changes are reviewed on their own.

What it holds

  • Compiler foundations: explicit diagnostic listeners and reporting sites, host compilation outcomes, snapshots and cancellation, compilation-owned syntax and semantic facts, recovery and cursor fitting on incomplete source, and repository read failures that never block usable candidates.
  • Language server and editors: compiler-derived diagnostics, navigation, completion, hierarchies, semantic highlighting, CodeLens, formatting and checked refactorings, working on unsaved and incomplete source; the compiler adapter is the default, with Tree-sitter available through an adapter switch that restarts the server and restores open buffers.
  • Build and run: the editors build with the language server's embedded compiler, also beside a Gradle build, and run each program in a supervised execution worker of its own, with console input.
  • Debugging: a runtime debugger in javatools, and Debug Adapter Protocol sessions carried over the language server's own connection, in both editors (Debugging).
  • Tests: compiler, runtime, server and packaged-server suites, and a shared catalog of native editor scenarios that both editors' playbooks run.

How the branch is organized

The branch is 276 commits on master. Each is one feature or follow-up and compiles on its own (javatools, the language server, the DAP server, the IntelliJ plugin with its integration tests, and the VS Code extension), and none after the listener contract's migration uses the old reporting form.

  • 1–7, compiler foundations: repository read failures; the listener contract in three steps (reporting apart from abort policy, explicit listeners and reasons for silence, scoped parser diagnostics); host compilation outcomes; compilation-owned syntax and semantic facts; recovery, cursor fitting and declaration analysis.

  • 8, the integration: compiler-backed language support in the server, IntelliJ and VS Code.

  • 9–19, foundation follow-ups: repository reporting and caching, tooling contracts, compiler output without the binary AST, CI and test isolation, LSP4IJ API checks, the compiler guide, code-action and rename guards, the restart CLI, and the compiler AST cleanup.

  • 20–45, the product: embedded build and run, console input, build modes and supervised workers, entry points, the playbook cases, server responsiveness and document synchronization, formatting, refactorings, run lifecycle, and the LSP4IJ channel option.

  • 46–67, debugging: debug sessions, variables and stepping, exception stops and pause, watches and expressions, conditional breakpoints and logpoints, code run from the Debug Console, value views, source revisions, worker soak, Run to Cursor, library frames, step targets, function and data breakpoints, Restart Frame, inline values, and the IntelliJ checks for LSP4IJ's fixes.

  • 68–95: README updates, a rename-proof fix that master's newer fixtures needed, the VS Code client without the startup workarounds that vscode-languageclient 11.0.0, on master since Clear 3 of 5 Dependabot alerts, and take vscode-languageclient 11.0.0 #744, makes unneeded (Preserve the startup promise when initialization loses its connection microsoft/vscode-languageserver-node#1867, and our Handle the stop that follows a failed initialization microsoft/vscode-languageserver-node#1896), DAP's order of a step's response and the stop where the step ends, and an uncaught-exception stop that the runner's own catch no longer prevents. Then refactoring: inline every use of a private member and remove it, check X103's moved member after Undo, Safe Delete of unused public and protected members, which names the modules it checked, and an Explorer move that keeps its Ecstasy edits with refactoring auto-save off. Then a host can give lazy variables' code longer than the one second of ON_DEMAND, which the debugger tests use on a loaded machine. Commit 79 attaches the debugger to a program run outside the editor with --debug (Debugging), and 80–83 make tests in javatools and the language server wait for what they check instead of for time. 84–89 fix the IntelliJ cases that failed only in full runs: an edit lost when the language server restarts during it (X259), a library frame without its source (X324), and the harness's waits in X74, X257 and X259. 90 runs the IntelliJ playbook in a Linux container on a virtual display, where no other window takes the IDE's focus, and 91 has two more debugger tests check what their sleeps waited for. 92 analyzes again an open document whose analysis the compiler retired without a replacement, which left VS Code pulling its diagnostics without end (X116); 93 has both playbooks' diagnostics waits take only the server's report for the document as it is now, not one from before an edit; and 94 fixes the container's runs: a user instead of root, an init process that reaps the Gradle daemon a cancel stops, JDK 25 for the XDK's launchers, and mavenLocal on a volume. 95 spells the server's analyze and analyzeOne the American way.

  • 96–100: Debug of Gradle-mode runs in both editors (Debugging); the lang build fails on a compiler warning, and the ten it had are fixed; compileXtc no longer takes from the build cache a module compiled in another copy of the project, whose recorded source paths are the other copy's, so breakpoints did not bind; IntelliJ keeps the language server running while a run or debug session uses it, which LSP4IJ stopped 5 s after the last Ecstasy file closed; and the root build's containerPlaybook* tasks run both editors' playbooks in the container, with the container command org.xtclang.docker.command names.

  • 101: continuing, stepping or pausing one fiber while the program's other fibers stay stopped, with DAP's singleThread (Debugging).

  • 102: linked editing with the caret just after a local's name, where typing appends to it; the server linked nothing there, only inside the name.

  • 103: a test that a page of a value's variables starting at or past its end is empty, as DAP 1.71 specifies for a variables request (fix: clarify behavior of start/count in variablesarguments microsoft/debug-adapter-protocol#580); SessionDebugger already did that, so only the test changes.

  • 104–114, the rest of R13: Debug of a command-line run, which xtc run runs and which connects back; the debugger agent moved into javatools, with its protocol as records, and found by its provider's name in an agent jar; a debugged task's last output; deduction that finds a named module in src/main/x beside other sources; running and debugging a module's xunit tests from both editors, embedded, in Gradle and command-line mode, and in IntelliJ's test console, with tests reported as xunit's own JSON events; a closure compiled as a fold, without mutable accumulators; and no lazy-value time limit for the embedded execution tests' worker (Debugging).

  • 115–145: the docs brought up to date: the debugger's attach and R9–R12 features, running and debugging tests, the playbook catalog's 342 cases, every VS Code command by its title, lang/README's task paths and versions, the editors' test, attach and debug-task sources, the playbook container, American spelling, the editors' names as their UI reads them, Java 25 for every adapter, javatools' debugger, agent and provider, and IntelliJ's breakpoint pass count's own LSP4IJ fix. Then doc comments that stay on their properties and methods; completion of a member access at a line's end or right after its dot, and of the language model's keywords and built-in types; hover that names a type by what it is; a run's events delivered to dap-server's ProgramEvents; the formatter's shared empty-block skeleton; an embedded run's process handler in one place; camel case for properties that hold behavior or mutable state; the LSP tests split into a fast default tier and complete runs; Ecstasy's Code Style settings page, and its live templates in Ecstasy files only; Debug of a program that has an interface; and code actions in a module with a const that has a toString.

  • 146–193: tests that wait for a hang only, not for a fast machine; playbook container runs queued on one machine lock, each with its own export, and the playbook's IDE started from one place without the plugins it does not use; and a recorded tour of the IntelliJ plugin on a card game that checks what it shows. In IntelliJ: a PSI of the Ecstasy language, with Enter closing and indenting blocks; Organize imports from Optimize Imports, which also removes unused imports; brackets and words as plain text had them; Rerun Failed Tests; a line typed in the Debug console taken to the session; Undo of a server's one-file edit without asking; a method's call inserted when its completion is chosen; LSP4IJ's held edits sent before completions and signature help; a Gradle-imported project built embedded; and a closed file's errors from the workspace report. In the server: a library declaration's doc comment in hover; completion and signature help at a line's end, and a type of another module with its import; a moved type's import; Extract with an injected local and from whole lines; Create class for a statement that constructs it; code actions proved only as a request asks, compiling only the modules an edit reaches, from the previous revision's compile; on-type formatting without waiting for a compile; requests from a restarted client; and every class's errors from an embedded compile. In the runtime and the tools: configurationDone before a debug session starts its program; earlier stops kept out of a clock alarm; Future callbacks that throw or that a terminated service drops; enum values in breakpoint conditions, and why a condition cannot be evaluated; a stopped run's end; and xtc test, run and build that take a project's test module with its modules, in the same order in every JVM.

  • 194–221: a test's hang found by the CPU it stops using; a stopped run shown as stopped; a spare key per thread for a hasher map; the debugger's expression fragment made physical, which ends a paused session's daemon loop; a service's shutdown completed however it goes; tests that throw reported as aborted, with later exceptions kept and skipped tests counted; in IntelliJ, Rerun Failed Tests on a test run, Run 'All Ecstasy Tests', the embedded build's errors in the Problems window, and code action answers in full again after a budget; testXtc never taken from the cache; compiles kept for modules whose dependency's API stayed; the server saying which requests and diagnostics it still owes; a closed test module's tests from the workspace pull; the code action kinds declared; no edit asked for a rename that Undo makes; Safe Delete of a member whose body has an annotation; Restart Frame after code ran in the stop; the modules a stopped VS Code test run did not reach ended; and no diagnostics for a library source's read-only copy.

  • 222–258: a completion item's documentation on Ctrl+Q in IntelliJ, through public API only; Run to Cursor's temporary breakpoint kept until the program stops; xtc/busy with the server's open requests and compiler jobs; screen recordings of playbook runs in the container, and tours of both editors composed from passing clips; in VS Code, breakpoints in Ecstasy files, Debug with F5, a run task's args in Gradle and command-line mode, xtc.trace.server, and Run from the Run button and context menu; folding of comments and imports with the compiler adapter; deleted and removed files' diagnostics cleared in workspace pulls; moves that say when they leave uses as they were and that ask again when a change overtook their answer; playbook cases X342–X349 for xunit tests; compiles kept when only private declarations move; and Undo that asks before it takes back a rename or move of several files, shown in both tours.

  • 259–275: tours and playbooks that print their progress step by step, with their waits fixed; the debugger probe's waits failing once nothing is in progress for a minute; the unused xtc/runnableTargets request removed; a class's own child named Inner that covers the implicit Outer.Inner, tested in manualTests; hover and Go to Definition in a library copy that the debugger opens; Run All Ecstasy Tests beside Gradle's Tests on mixed test folders; and a run's embedded build compiled again when its files change on disk as it compiles.

  • 276: the VS Code extension's npm dev tools past the MSAL, glob and minimatch advisories, with vscode-languageclient's own minimatch waiting for Release with minimatch 11 to fix GHSA-g3hv-75wg-m249 microsoft/vscode-languageserver-node#1938.

The branch was regrouped from its development history on 2026-10-28; errs-693-regroup-2026-10-28.tsv on lagergren/errs maps each commit to the commits it came from. Commits 115–276 came from lagergren/errs from 2026-11-04 to 2026-11-09; errs-693-sync-2026-11-04-to-09.tsv gives the errs commits each one carries, as a copy, an adapted copy or a per-feature aggregate.

Already on master

Parts of this work have landed on master as pull requests of their own, and this branch is rebased onto them: #699 and #700 (comparison and equality chains, tuple foreach targets), #703 (running a named entry method with arguments and console input), #717 (the lexer at a source's end), #718 (assert:debug in embedded runs), #720 (weak map arrays), #723 (Nibble from its bits), #734 (the temporary module file), #735 (the console debugger's E with injected variables), #716 (ending embedded runs, and kills with a pending call), #742 (the caller's javadoc for Runtime's debugger accessors), #724 (a JSON string's \u escapes, and a Char's), #744 (three Dependabot alerts, and vscode-languageclient 11.0.0) and #743 (the javadoc errors, with javadoc in check).

Changes

The merge-base comparison contains 945 changed paths: 298 modified, 644 added, 2 renamed and 1 deleted. Of these, 727 are under lang/ and 218 are outside it. 377 changed paths are under src/test/, in addition to runtime fixtures and other acceptance assets.

  • javatools/src/main/java/org/xvm/api/ and org/xvm/asm/: compilation outcomes, diagnostic ownership, cancellation, repository read observations, snapshots and ordinary partial progress; and a versioned method-record layout containing only executable code and source information.
  • javatools/src/main/java/org/xvm/compiler/Parser.java and compiler/ast/: typed source-tree copying, compilation-owned semantic facts, recovery, cursor fitting, declaration/header analysis and the compiler correctness fixes used by tooling.
  • lang/lsp-server/src/main/kotlin/org/xvm/lsp/adapter/xdk/XdkAdapter.kt: compiler sessions and dependency graphs, semantic queries, incomplete-source support, checked edits, cancellation and resource ownership.
  • lang/lsp-server/src/main/kotlin/org/xvm/lsp/server/XtcTextDocumentService.kt: document synchronization and LSP feature routing, asynchronous work, diagnostics and workspace edits.
  • lang/intellij-plugin/ and lang/vscode-extension/: native editor actions, settings and adapter selection, project/compiler-model integration, semantic theme support, lifecycle handling and acceptance harnesses.
  • javatools/src/main/java/org/xvm/runtime/SessionDebugger.java and PureExpression.java: a runtime debugger that a host drives through calls, beside the console's DebugConsole, and the interpreter accessors it reads (Frame, Fiber, ServiceContext, Container); Connector.shutdown() lets a finished runtime go.
  • lang/dap-server/, lang/lsp-server/src/main/kotlin/org/xvm/lsp/run/ and server/DebugSessions.kt, EmbeddedRuns.kt, CompiledSources.kt: one DAP session per launch inside the language server, routed to its program's execution worker, with breakpoints mapped to the text the program was built from.
  • lang/vscode-extension/src/debug-adapter.ts and lang/intellij-plugin/src/main/kotlin/org/xtclang/idea/dap/: VS Code's inline debug adapter and IntelliJ's LSP4IJ DAP client, both carrying the session over the language client; the standalone dap-server launcher is removed.
  • lang/tree-sitter/build.gradle.kts, the DSL and grammar: native parser build support and the retained syntax adapter/highlighting fallback.
  • plugin/, lang/gradle/compiler-model.init.gradle, shared build logic and CI: evaluated compiler inputs, library/source discovery, test infrastructure and packaged-server checks.
  • gradle/libs.versions.toml: IntelliJ/LSP4IJ versions above, Starter dependencies Kodein 7.26.1, IntelliJ coroutines 1.10.2-intellij-2 and serviceMessages 2024.07, plus a shared XDK library bundle.
  • lang/vscode-extension/package.json and lockfile: JSONC/ZIP handling, Playwright-based test support, Node 24 and VS Code 1.140 typings; master's updated ESLint, Mocha and TypeScript-ESLint versions are retained alongside the new test dependencies.
  • lang/doc/manual-test-plan.md: 338 shared scenarios, native harness instructions, feature boundaries, known host failures and evidence requirements. Existing compiler, server and editor READMEs are also updated.

Debugging

With the embedded compiler, both editors debug Ecstasy programs: VS Code with F5 or a launch.json configuration, IntelliJ with Debug on an Ecstasy Application configuration. A debug session builds and runs the module as Run does, in the same execution workers, under the runtime debugger SessionDebugger. The editor's DAP messages reach it over the language server's own connection (xtc/debugStart, xtc/debugMessage, xtc/debugEnd), so no second process, port or credentials are needed.

  • Breakpoints: line breakpoints with conditions, hit counts and logpoints; function breakpoints by method name; data breakpoints on an object's field; uncaught or all exceptions, filtered by class, with exceptionInfo. Breakpoints and stops follow the text the program was built from when a file is edited during the session.
  • Stopping and stepping: Step Over, Step Into, Step Out, Step Into a chosen call of the line, Run to Cursor, Restart Frame, Pause and stop on entry.
  • Threads and stacks: every fiber of the program, stacks without the runner's frames, and frames in bundled XDK libraries opened in their bundled source; modules and loaded sources.
  • Values: variables with lazy computed properties and toString(), hexadecimal values and identity codes, large arrays a page at a time, Set Value, and inline values beside the code from textDocument/inlineValue.
  • Evaluation: watches, hovers, conditions and logpoint expressions use Ecstasy's operators without running the program's code. A Debug Console line that needs code, such as a call, runs on the stopped fiber for at most two seconds and can be cancelled; a launch option lets the rest of the program run meanwhile. The console completes names as they are typed.

IntelliJ checks less where LSP4IJ 0.21.0 lacks the DAP feature. Pause (#1757), exception filter conditions (#1760), loaded sources (#1774), Restart Frame (#1778), function breakpoints (#1780), inline values (#1781), data breakpoints (#1782) and a line breakpoint's hit count (#1787) are merged into LSP4IJ, unreleased. The playbook's IntelliJ checks for them are ready for the release that has them; each case's IntelliJ limitation in the catalog names its fix. Both editors also attach to a program started outside them: xec --debug listen:127.0.0.1:5005,suspend,agent=<the language server's jar> App.x waits before its first line for a debugger on this machine, and VS Code's Ecstasy: Attach to Program configuration or IntelliJ's Ecstasy Attach configuration attaches to it, optionally stopping at its first line (X336). Stopping the session detaches, and the program runs on. VS Code's Ecstasy: Copy Option to Debug a Program Outside the Editor copies the option, and IntelliJ's configuration shows it. In Gradle mode, Debug runs the module's Gradle task with the plugin's xtcDebug and xtcDebugAgent properties, and the program it starts connects back to the session (X337): VS Code runs the task in a Debug terminal, IntelliJ's Ecstasy Application configuration shows its output in the Debug console, and stopping the session ends the task and the program. With DAP's singleThread on continue, next, stepIn and stepOut (supportsSingleThreadExecutionRequests), only that thread's fiber runs, with the fibers of other services it calls, while the others stay stopped; when it stops again, at a breakpoint, an exception stop, its step's end or a pause, that is the program's stop again, and if it ends first, the program stops at a waiting fiber with the reason pause. Embedded runs and Gradle-launched or attached programs take it alike, through the shared worker protocol (24). Neither editor sends singleThread yet (microsoft/vscode#166450; LSP4IJ none), so it is checked at the protocol level.

To try it, follow the debugging cases X304–X331 in the manual playbook, or the debugging sections of the IntelliJ and VS Code READMEs. The session's messages and capabilities are described in the language server README.

Validation

Fresh runs on this branch's tree passed. They ran on f7f8620d0c, before #716 and #742 merged. 51c0b48aed, commit 70, is the same branch on master with both, and its tree differs only in Runtime.setDebugger()'s javadoc, which is now master's; it compiles, and spotlessCheck passes. Commit 71's checks follow the table:

Suite Passed Skipped
Java compiler/runtime, SessionDebuggerTest's 48 and EmbeddingSupportTest's 30 included 660 42
DAP server 38 0
Language server, 54 embedded execution cases with a real worker included 2,420 2
Packaged compiler server over stdio 83 0
IntelliJ plugin 151 0
VS Code extension, headless 70 0

One language server case, a Debug Console line in a stopped frame, failed once in the full run while the machine's load average was about 100: a value's toString() went past its one-second limit. It passed when its class was rerun, 54 of 54, and three times on its own. Every commit compiles on its own, as described above. verifyPlugin reports the plugin compatible with IntelliJ IDEA 2026.2.3 (262.10968.63); the LSP4IJ DAP descriptor classes the debugger uses are experimental API, which the verifier reports without failing.

CI passed on ee7ac4d9a0, commit 82, with the language server's and the DAP server's tests, as it did on ac19f15d8a, commit 78, and 37cf6396d9, commit 75; CI passed on 28bed8676c, commit 90; CI passed on 4be374497f, commit 91, before the rebase onto #724 and #744. Commit 75 stops at an uncaught exception that only the runner would catch: the runner starts the program inside a try whose catch counted as the program's while the runner's fiber was still in the call, which CI's stack trace showed; javatools passes 695 (42 skipped). Commits 73, 74, 76 and 77 add the refactorings above and catalog cases X332–X335 (the catalog has 337); on lagergren/errs, whose files they match, the language server passes 2,434 (2 skipped), the IntelliJ plugin 151 and VS Code's headless suite 70, and X332–X335 pass natively in both editors (X335 is VS Code's).

Commit 79, attaching, and 80–82 ran on lagergren/errs, whose files they match: javatools passes 702 (42 skipped, none of them the debugger's or the launcher's), the language server 2,442 (2 skipped; its agent tests were rerun, 8 of 8, after a last change to a log message), the DAP server 43, the IntelliJ plugin 151 and VS Code's headless suite 73; X336 passes natively in VS Code and in IntelliJ with LSP4IJ 0.21.0, with no IDE errors. Running xec from xdk:installDist with the server's packaged jar as its agent found that the launcher closed the jar while the agent's thread still loaded classes, which commit 79 fixes. On this branch, commits 79–90 compile and pass spotlessCheck. Commits 83–90 ran on lagergren/errs, whose files they match: the IntelliJ plugin passes 154; X74, X259 and X324 pass natively (run-3574220030596104685) and in the container, and X307 passes 3 of 3 in the container, all with LSP4IJ 0.21.0 and no IDE errors.

Commits 92–94 ran on lagergren/errs, whose files they match: the language server passes 2,443 (2 skipped), the IntelliJ plugin 157 and VS Code's headless suite 73. With them, VS Code's playbook passed 337 of the catalog's 338 cases natively (X218 fails on VS Code's Undo order, as before), and IntelliJ's passed in the container every one of the 329 cases it implements, 15 of them with the catalog's partial coverage, with LSP4IJ 0.21.0. On this branch they compile and pass spotlessCheck, and CI passed on 7c94c7d168, commit 94, on master df8e28238d. Rebased onto #743, whose check runs javadoc, the branch has no javadoc errors in javatools, javatools_jitbridge, javatools_utils or javatools_unicode; CI passed on the tip, 5deada5ac1, commit 95, which runs that javadoc.

Commit 72 sends the response to a step, continue, pause or restart frame before the stopped event that follows, as DAP orders them; on a loaded CI machine a short step's stop went out first, and EmbeddedExecutionTest's step into a call failed. The DAP server's tests pass, 40 with two new cases that fail without it, and EmbeddedExecutionTest passes 54 with a real worker.

Commit 71, vscode-languageclient 11.0.0, ran in VS Code on lagergren/errs, whose extension is the same: with the workarounds removed on 10.1.2, X272 (a JVM that fails to start) fails with an unhandled rejection; on 11.0.0 without them, X271 and X272 pass three times, the headless suite passes all 70, and the full playbook passes 332 of 333 cases, as on 10.1.2, the one failure being X218, VS Code's own Undo order (microsoft/vscode#344765). On this branch, the extension compiles and passes eslint.

The native run and debug cases X31, X131, X280–X289 and X304–X331 ran on d3aceb5785, whose tree differs from the tip's only in that javadoc: VS Code passed all 40 (run-kLv2zk); IntelliJ, with LSP4IJ 0.21.0, ran the 33 of them implemented there (run-5224751324208668446), 21 passed and 12 partially as the catalog declares (X286–X288, X311, X313–X318, X320 and X323), with no IDE errors.

Commits 96–100 ran on lagergren/errs, whose files they match: the Gradle plugin passes 65 with its TestKit tests (none skipped), the DAP server 45, the language server 2,446 (2 skipped) and the IntelliJ plugin 158; in the playbook container, run with commit 100's tasks, IntelliJ passes X336 and X337 and X303 partially, as the catalog declares, with LSP4IJ 0.21.0, and VS Code passes X303, X336 and X337. X337 fails without commit 98 in VS Code (its breakpoint does not bind) and without commit 99 in IntelliJ (the session ends with the language server). On this branch, the tip compiles with commit 97's -Werror, the VS Code extension compiles, and the plugin's tests pass, 65. Each of commits 96–99 compiles on its own.

On 2026-11-02 the branch was rebased onto master ca51c57bd7 (#746–#749). The one conflict was in the VS Code extension's package.json and package-lock.json, in commit 8: master's typescript-eslint 8.72.1, kept with the branch's yauzl. The tree differs from the one before only by those four master commits. The rebased tip, 7066762204, passes spotlessCheck and compiles: javatools, the plugin, the language server, the DAP server, the IntelliJ plugin with its integration tests, and the VS Code extension.

On 2026-11-09 the branch was rebased onto master 8097b66a89 (#759–#762). The one conflict was commit 276's, in the VS Code extension's package.json and package-lock.json, resolved on #762's @vscode/vsce 4.1.0 and eslint 10.14.0 with the same changes. The tree differs from the one before only by those four master commits. The rebased tip, ffe34357bb, passes spotlessCheck with #761's Spotless 8.11.0 and compiles the main and test code of javatools, the plugin, the language server, the DAP server and the IntelliJ plugin; the VS Code extension installs, compiles and passes eslint.

Commit 276 ran on lagergren/errs, whose files it matches: the VS Code extension's headless suite passes 95 and its VSIX builds, and npm audit reports 2 of the 16 vulnerabilities it reported before, both from vscode-languageclient's minimatch 10. On this branch the extension installs, compiles and passes eslint.

Commits 104–275 came from lagergren/errs from 2026-11-03 to 2026-11-07. CI passed on c4f916bf44, commit 114, on 6f88d9fd82, commit 193, after the branch was rebased onto master 46a5536e1f (#758) without a change to any commit, and on f74fc9ad02, commit 275.

Commit 103 ran on lagergren/errs: SessionDebuggerTest passes 53 tests, none skipped. On this branch it is a clean cherry-pick, and the class passes there too.

Commit 102 ran on lagergren/errs, whose files it matches: the language server passes 2,449 (2 skipped) and spotlessCheck; without its fallback, its two new assertions fail. On this branch, it is a clean cherry-pick, its main and test code compile, and XdkLinkedEditingTest passes.

Commit 101 ran on lagergren/errs, whose files it matches: javatools passes 706 (42 skipped, as before), the language server 2,448 (2 skipped) and the DAP server 46; its tests continue, step and pause one fiber alone in the runtime, over a real worker and over a real agent, and check that the other fiber's state stays the same. On this branch, it is a clean cherry-pick, and the tip compiles and passes spotlessCheck.

Known follow-ups

Try it

Keyboard shortcuts, logs and server restart

Both editors use two-step shortcuts: press Control+Option+X on macOS (Ctrl+Alt+X on Windows/Linux), release the keys, then press L or A. On macOS this is Control, not Command. Custom keymaps may override these defaults.

Action IntelliJ IDEA VS Code
Show/hide the server log Control+Option+X, then L (macOS) / Ctrl+Alt+X, then L; also Tools → Toggle Ecstasy Language Server Log Same shortcut; also Ecstasy: Show Language Server Output / Ecstasy: Hide Language Server Output in the Command Palette
Switch Compiler / Tree-sitter and restart Control+Option+X, then A (macOS) / Ctrl+Alt+X, then A; also Tools → Switch Ecstasy Language Adapter Same shortcut with an Ecstasy editor active; also Ecstasy: Switch Language Adapter, or click the ready Ecstasy status-bar item
Restart without changing adapter Settings → Ecstasy Server Runtime and Logs → Restart running Ecstasy servers with saved settings (restarts running Ecstasy servers in this IDE), or the project-specific CLI below Ecstasy: Restart Language Server in the Command Palette
Export logs for a bug report Tools → Export Ecstasy Server Logs Ecstasy: Export Server Logs in the Command Palette

The restart and export actions have no plugin-defined keyboard shortcut; assign one in the editor's Keymap / Keyboard Shortcuts if desired. Open VS Code's Command Palette with Command+Shift+P on macOS or Ctrl+Shift+P on Windows/Linux. The log toggle retains history while hidden; use it directly if an error notification's Show Logs link does not bring the IntelliJ tool window forward.

For a terminal-controlled restart, run from this checkout with Python 3 installed:

# Discover the editor sessions and their exact project roots.
python3 lang/scripts/xtc-lsp list

# Replace /path/to/project with a root reported by list; choose the relevant editor.
python3 lang/scripts/xtc-lsp restart --project /path/to/project --ide intellij
python3 lang/scripts/xtc-lsp restart --project /path/to/project --ide vscode

The plugins also bundle this CLI as bin/xtc-lsp. The project must be open in an editor running the updated plugin; for IntelliJ, open an Ecstasy file at least once to start its server. If multiple sessions match, select one using --session <id> from list. Restart goes through the owning editor, restores unsaved buffers without saving them, and remains available after a language-server crash. It does not require restarting the IDE or sending a process signal. Installing the updated plugin into an already-running IDE requires the usual one-time editor reload/restart first.

See the IntelliJ controls and VS Code controls for settings and shortcut customization.

Run the native editor playbooks

The manual playbook on this branch contains the launch instructions, copyable demo programs, scenario actions and expected results. Use it to manually explore any feature; the shared scenario catalog contains additional source variants and per-case manual notes.

From the repository root, run the full native suites one at a time on a graphical desktop:

# IntelliJ: feature catalog plus startup, focus, settings and project lifecycle
./gradlew :lang:intellij-plugin:testCompilerPlaybook \
    -PincludeBuildLang=true -PincludeBuildAttachLang=true -Plsp.adapter=compiler \
    --rerun-tasks --no-build-cache

# VS Code: feature catalog plus server and packaged-stdio regression suites
./gradlew :lang:vscode-extension:testCompilerPlaybook \
    -PincludeBuildLang=true -PincludeBuildAttachLang=true -Plsp.adapter=compiler \
    --rerun-tasks --no-build-cache

Use JDK 25 or newer to start Gradle. Dependencies and isolated IDE profiles are prepared by the build. To keep the test IDEs off the desktop, run the playbooks in a Linux container on a virtual display instead: ./gradlew containerPlaybookBuild, then ./gradlew containerPlaybook -PplaybookCases=X1,X2 (both editors; all cases without the property), or containerPlaybookIntellij / containerPlaybookVsCode. They use docker, or the command -Porg.xtclang.docker.command=podman names. VS Code can use xvfb-run on headless Linux. Leave the test window to the harness; manual interaction can change the active file and invalidate a case.

For a short selection covering structure, diagnostics, hover and typed completion:

./gradlew :lang:intellij-plugin:testCompilerPlaybook \
    --tests '*CompilerPlaybookTest.compilerPlaybook' \
    -PincludeBuildLang=true -PincludeBuildAttachLang=true -Plsp.adapter=compiler \
    -PintellijPlaybookCases=X1,X2,X3,X6 --rerun --no-build-cache
./gradlew :lang:vscode-extension:testCompilerPlaybook \
    -PincludeBuildLang=true -PincludeBuildAttachLang=true -Plsp.adapter=compiler \
    -PcompilerPlaybookCases=X1,X2,X3,X6

Replace the IDs with the cases you want to examine. The IntelliJ method filter limits this selection to the feature session, and the selected VS Code task does not schedule the host regression suites. These selected runs do not establish whole-catalog acceptance.

Reports are written to lang/intellij-plugin/build/reports/compiler-playbook/run-*/ and lang/vscode-extension/build/reports/compiler-playbook/run-*/; VS Code also writes latest-run.txt. Check per-case results, selected/excluded cases, errors and the recorded revision. The acceptance instructions explain logs, coverage limits and expected negative-test notifications.

Explore the demo programs manually

To try the product:

  1. Check out this PR and launch either editor from the repository root; run native editor sessions sequentially because their actions use desktop focus.

    ./gradlew :lang:intellij-plugin:runIde -PincludeBuildLang=true -PincludeBuildAttachLang=true
    ./gradlew :lang:vscode-extension:runCode -PincludeBuildLang=true -PincludeBuildAttachLang=true
  2. Open an Ecstasy module, introduce and repair an error without saving, then try hover, completion, references and rename; copy the named demo programs from the manual walkthrough, preserving their filenames and module layout, then follow the case actions and expected results.

  3. Switch between Compiler and Tree-sitter using Tools → Switch Ecstasy Language Adapter in IntelliJ or Ecstasy: Switch Language Adapter in VS Code; confirm that the restarted server restores the unsaved buffers.

  4. Use the native acceptance commands and report instructions when recording a review finding, including the scenario ID and the actual editor/server logs.

@lagergren
lagergren force-pushed the errs/full-testable-lsp-20261009 branch from 11f3c94 to 2dd4e31 Compare October 12, 2026 11:41
@lagergren lagergren changed the title [LSP-FULL-IMPLEMENTATION - SHOULD LIKELY NOT BE MERGED AS IS] Complete compiler-backed LSP and IDE integrations [LSP] Complete compiler-backed LSP and IDE integrations Oct 12, 2026
@lagergren
lagergren requested a balanced review from Copilot October 12, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It is an explicitly non-mergeable reference draft aggregating multiple foundation PRs and sweeping compiler, build, and multi-editor changes across ~900 files, which requires human review and a deliberate landing plan.

2 open findings
What changed in this PR

This PR assembles the complete compiler-backed Language Server Protocol (LSP) implementation for Ecstasy/XVM into a single buildable branch, combining several in-flight foundation PRs (#683 repository-read observation, #685 embedding/diagnostic-ownership and the ErrorListener API migration, #686 transient-local lifecycle, #687 callable typing, #692 binary-AST removal) with the language server, IntelliJ plugin, and VS Code extension. It is explicitly labeled a reference draft that "SHOULD LIKELY NOT BE MERGED AS IS", intended so reviewers can build and exercise the full editing experience while the smaller foundation PRs are reviewed independently. It bumps the .xtc format to 0.20261012 and removes the abandoned binary-AST record slot entirely (no legacy compatibility shim).

Changes:

  • Migrates compiler diagnostics to an operation-owned ErrorListener contract (log returns void; callers consult isAbortDesired(); BLACKHOLE→silent(PROBE/DISCARD); SafeLookAhead→Attempt), adds embedding/snapshot/cancellation APIs, and removes the binary-AST classes.
  • Adds the Kotlin LSP server plus IntelliJ and VS Code integrations (diagnostics, navigation, completion, hierarchies, theme highlighting, CodeLens, checked refactorings, incomplete/unsaved-source analysis), with a compiler/Tree-sitter adapter switch.
  • Enables the language build and compiler adapter in gradle.properties, consolidates the XDK library bundle, updates IntelliJ/LSP4IJ/VS Code tooling versions, and adds extensive compiler/server/editor test fixtures and a manual playbook.
File Description
javatools/​src/​main/​java/​org/​xvm/​asm/​ErrorListener.java Core of the diagnostic-ownership migration (void reporting + isAbortDesired/silent/at/in helpers).
javatools/​src/​main/​java/​org/​xvm/​api/​EmbeddingSupport.java Host-facing compile/analyze/run APIs; errs enforced non-null via requireNonNull in run().
javatools/​src/​main/​java/​org/​xvm/​api/​InterpreterControl.java finish() now reports via errs.error(...); safe since callers guarantee non-null listener.
javatools/​src/​main/​java/​org/​xvm/​tool/​TestRunner.java Launcher migrated to the new listener contract; javadoc still says "optional" (flagged).
javatools/​src/​test/​java/​org/​xvm/​compiler/​ParserTest.java Tests Parser.Attempt recovery; comment grammar regression flagged.
lang/​lsp-server/​src/​main/​kotlin/​org/​xvm/​lsp/​** Document service, XDK adapter, model conversions (Lsp4jConversions, SymbolInfo) for compiler-backed features.
lang/​intellij-plugin/​**, lang/​vscode-extension/​** Native editor actions, adapter selection, settings reporting, and acceptance harnesses.
gradle.properties, gradle/​libs.versions.toml, xdk/​build.gradle.kts, version.properties Enables language build/compiler adapter, raises metaspace, consolidates XDK bundle, bumps .xtc format.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lagergren
lagergren force-pushed the errs/full-testable-lsp-20261009 branch from d83e765 to a86cfef Compare October 13, 2026 07:50
@lagergren
lagergren marked this pull request as ready for review October 13, 2026 17:02
@lagergren
lagergren force-pushed the errs/full-testable-lsp-20261009 branch 2 times, most recently from 4a75f4b to 672b96f Compare October 13, 2026 17:53
@lagergren
lagergren force-pushed the errs/full-testable-lsp-20261009 branch 3 times, most recently from 8f0d178 to 4c87387 Compare October 15, 2026 12:21
lagergren added a commit that referenced this pull request Oct 15, 2026
Take #693's version of the files its own commits changed: the review
fixes, the dropped repository reporting and cache changes, and the
deduplications. Where errs has its own edits in those files, keep them
on top of #693's version: the diagnostic origin POC, the duplicate
source type regression task, the partial-analysis nesting test, the
f_errs field names and unnamed variables, and the Indents cleanup.
@lagergren
lagergren force-pushed the errs/full-testable-lsp-20261009 branch from 4c87387 to a37d5dd Compare October 15, 2026 13:57
lagergren added a commit that referenced this pull request Oct 15, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
#697's regressions to errs' own misc.x and errors.x, keeping the
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 15, 2026
- javatools/LSP-COMPILER.md is now javatools/lsp-compiler.md, matching
  the other lowercase guides; links in javatools/README.md,
  docs/errs-error-listeners.md and the guide itself follow.
- lang/README.md, lang/lsp-server/README.md, editor-setup.md and
  plugin/README.md pointed at CLAUDE.md for project rules; they now
  link AGENTS.md (#composite-build-semantics), which holds them.
  CLAUDE.md only includes AGENTS.md.

Draft #693 and the outside-lang comparison branch still use the old
file name; mirror this rename there when they are next synchronized.
lagergren added a commit that referenced this pull request Oct 15, 2026
- docs/errs-integration-plan.md: R1-R5 marked partial with what the
  delivery covers, and a new "Embedded build and run R2-R5" section
  with the commit and extraction map (5a14da2, 94a1e8c, 1a89eb1,
  50fb713, 590935e), the proposed homes (a small runtime-execution
  PR outside lang/ for the three javatools/lib_runner files; #693 or
  the editor review for lang/; mirror the lsp-compiler.md rename), and
  the validation receipt with commands.
- pr-roadmap.md: a dated entry noting this work is outside every
  prepared branch and PR, including #693, and is not mirrored yet; the
  deferred-work line no longer says runtime execution is absent.
- docs/errs.md: a dated summary, the execution-architecture note, and
  runMethod in the embedding API table.
lagergren added a commit that referenced this pull request Oct 16, 2026
A backlog sweep of the tracking and planning documents found items still presented as open
although later sections, the code or GitHub show them done, superseded or changed. Each was
checked against its closing evidence before editing: the later journal section, the code
(git grep / git log), or `gh pr view`. Dated journal entries keep their history: an unchecked box
that later work closed is ticked with a "Done later" pointer, and a dated statement that still read
as current gets a short "Later:" or "Superseded:" line. Current-status tables and undated status
text are updated in place.

Integration plan (docs/errs-integration-plan.md):
- Ticked, with the closing section linked: demo notification cleanup, PLAT2c/L67, PLAT2e, the
  cursor/header forms (superseded by L57–L59/L64), the native IntelliJ parity checkpoint, the
  retained heap growth (TransientThreadLocal fix; October 8 growth below 150 KB over 1,800 cycles),
  the combined gate rerun, the uninterrupted IntelliJ receipt, L62 cross-module/overlapping moves,
  the support bundle and failure links, and the L63 items the closure implemented within its
  bounds.
- Kept open with what remains: visible Cancel is done but UP16/UP17 and platform acceptance are
  not; X105 has not recurred but was never diagnosed; mutable captures, inverse substitution,
  runtime Class/Type values without a source owner and explicit generic qualifiers were moved out
  of L63 scope and are still unimplemented; dependent/dynamic type shapes are still refused;
  remote-host acceptance moves to L82.

Journals (docs/errs.md, docs/errs-audit.md):
- Status table rows 2.2 (highlights do distinguish read/write), 3.5 (partial: cross-file
  definition/references over the source graph; no persistent index), 3.6 (bounded compiler-only
  completion and signature help) and 4.2 (final-type checks pinned by
  TypeInfoFinalCompositionTest; the 70-message survey stays open) now state the current state.
- "Later:" pointers for the 121-call recount, positioning, AST2/AST4, the build-model import, the
  uninterrupted IntelliJ runs, visible Cancel and shared-process windows, and the heap growth.

Playbook (lang/doc/manual-test-plan.md):
- The heap paragraph no longer calls the October 1 run "the latest" with growth under
  investigation; it records the fix and the October 6/8 runs. Multi-hour and platform evidence stay
  open. Visible Cancel pointers added; §14 signature help and §15 document links name the compiler
  adapter as well as Tree-sitter.

PR roadmap (pr-roadmap.md), from gh on 2026-10-16:
- #685 was closed unmerged on 2026-10-12, not merged as the roadmap said. #683 was closed
  unmerged on 2026-10-15. #686, #687, #688 and #689 are merged; #687 merged as df29154 with four
  files, not the six or three the roadmap gave in two places. #693 is open and no longer a draft.

Plans and guides (lang/doc/plans/*, lang/README.md, docs/errs-upstream-issues.md):
- Dated status notes: the naming audit is done (no user-facing "XTC" in the five listed IntelliJ
  files; only KDoc, log messages and the icon path), per-file Tree-sitter re-indexing, the obsolete
  conditional Tree-sitter build, format on save, the VS Code plan (implemented except runtime
  debugging and Marketplace publishing), VS Code commands, compiler doc generation, workspace-wide
  hierarchy and editor workspace discovery in IntelliJ, compiler-backed semantics.
- formatting-plan: the manual checklist points to §13a and OnTypeFormattingTest; the `)` outdent,
  `->` indent and `/**` skeleton items are struck through with their tests.
- Upstream register: UP23 and UP24 rows added from the doc's own sections; the UP01–UP29 rows were
  split across three fragments (blank lines and a repeated header made two of them render as plain
  text) and are one table again. A stray "j" before conditional-build.md's title is removed.

Validation: documentation only. All 57 new relative links and anchors resolve (checked by script
against each target's headings); git diff --check is clean. PR states were read with gh.

Limits: several closing pointers cite commit hashes from before the 2026-10-05 rebase, following
the documents' existing convention; those commits live on backup/errs-pre-master-rebase-20261005,
not in this branch's history. The L63 consolidated list still ticks some forms (runtime Class/Type
receivers, capture preservation) more broadly than its closure table supports; its own caveat
limits the ticks to the closure's supported forms, so it is left as written.
lagergren added a commit that referenced this pull request Oct 16, 2026
Adds "Console input, embedded build snapshots and stale-document follow-up (2026-10-16)" to the
integration plan: the seven commits after c308bd7, each with its extraction target, plus their
receipts. 82b6ba5 splits on the directory boundary like 5a14da2: its javatools part joins the
proposed runtime-execution PR, which then needs its own javatools test. The R2, R3, R5 and R6 lines
of the runtime checklist now say what those commits delivered. The PR roadmap gets one row
pointing to the map.

Validation: documentation only; the roadmap's anchor matches the new heading, and git diff --check
is clean.

Limits: nothing is mirrored into #693 or the review branches yet, as decided; the full catalog and
combined-suite checkpoint is still to run.
lagergren added a commit that referenced this pull request Oct 16, 2026
docs/errs-integration-plan.md, 2026-10-16 map:
- rows for 3046c57 (playbook focus), a975e96, 2c48a55 and 5a94657 (embedded as the
  default build mode), the reverted attempts 78032ae, f1d323b and 174518d (nothing to
  extract), and b7cb7df and 7460633 (#693 server, with 3f9c1ee);
- what went wrong after 3f9c1ee (X116, X273, X274), the two causes, why the first attempts were
  reverted, and the receipts at 7460633;
- the DocumentLockTest race, with an open item to make that case deterministic.

The X273 item records that its initial invalidation is diagnosed and fixed in b7cb7df. It stays
open: LSP has no color refresh, so a genuine recompile while a color request waits still leaves
no swatches until the next edit.

pr-roadmap.md: a row for 3046c57…74606334e pointing to the map.

Validation: documentation only. Commits, run identifiers and counts were checked against git and
the newest results.json of each run; the new link uses the same anchor as the existing roadmap row.
lagergren added a commit that referenced this pull request Oct 16, 2026
- plan-embedded-execution.md: status, a "First delivery (2026-10-15)"
  section with the decisions taken (automatic default mode, save all
  before building, one persistent worker per server, no debugging yet,
  builds on the existing compile queue), what was delivered per area,
  known limits, and partial progress on R1-R5.
- plans/README.md lists the plan; plan-ide-integration.md,
  idea-specific.md, vscode-specific.md and plan-dap-debugging.md get
  status notes where they described Run, tasks or DAP as missing.
- manual-test-plan.md: Run lens cases now need a callable run method,
  a new section 18a covers embedded build, errors, unsaved edits, run,
  arguments, stop, rerun, Gradle mode, F5 and configuration migration,
  and the V9 task and code-lens rows describe the build mode.
- lang/README.md and lang/doc/README.md link the feature.

On #693 the plan documents stay as on master: this copy adds plan-embedded-execution.md, which the guides link to, and its row in the plans index, without the plan's link to the errs integration plan; the plan-ide-integration, idea-specific and vscode-specific status notes are not copied.

(cherry picked from commit 50fb713)
lagergren added a commit that referenced this pull request Oct 16, 2026
- javatools/LSP-COMPILER.md is now javatools/lsp-compiler.md, matching
  the other lowercase guides; links in javatools/README.md,
  docs/errs-error-listeners.md and the guide itself follow.
- lang/README.md, lang/lsp-server/README.md, editor-setup.md and
  plugin/README.md pointed at CLAUDE.md for project rules; they now
  link AGENTS.md (#composite-build-semantics), which holds them.
  CLAUDE.md only includes AGENTS.md.

Draft #693 and the outside-lang comparison branch still use the old
file name; mirror this rename there when they are next synchronized.

(cherry picked from commit 590935e)
lagergren added a commit that referenced this pull request Oct 16, 2026
The DAP placeholder answered as if it were debugging: every breakpoint came back verified, launch
and attach succeeded and sent `initialized`, and `threads` invented a main thread. A client that
reached it showed set breakpoints that would never be hit and a session waiting on nothing.

The Mock adapter, which is also what a Tree-sitter build falls back to when the native library
cannot load, inherited the default capability set. The server therefore advertised selection
ranges, signature help, semantic tokens, workspace symbols, code lenses, on-type formatting and
linked editing, all of which only reach the empty `[NOT IMPLEMENTED]` defaults in AbstractAdapter.
An editor treats an advertised feature that answers empty as working with nothing to show.

Changes:
- XtcDebugServer is an honest placeholder. Breakpoints are reported unverified with the reason
  (`NOT_AVAILABLE`), launch and attach fail with RequestFailed and that reason, there are no
  threads, and initialize advertises only `supportsConfigurationDoneRequest`. The other requests
  stay accepted no-ops.
- MockAdapter overrides `capabilities` with what it implements: hover, completion, definition,
  references, document symbols, highlights, folding, rename, code actions, document links and the
  shared full/range formatting. The server already gates every provider on that set.
- dap-server gets a JUnit test task; XtcDebugServerTest checks unverified breakpoints, refused
  launch/attach and the exact advertised capabilities on the wire.
- XtcLanguageServerTest's capability audit asserted the stubbed providers for the mock backend. It
  now asserts the mock's real set and, in a separate test, that the seven stubbed providers are
  absent. The on-type formatting trigger characters, previously checked only there, are now checked
  in compiler mode (XdkLanguageServerTest), which does implement on-type formatting.

Docs: the VS Code README Debugging section says what the placeholder answers; the DAP plan status
and Phase 0 heading no longer claim the wiring is complete while IntelliJ registration is disabled;
playbook V10/V11 no longer say F5 stops at breakpoints (they now match X285); plan-embedded-execution
marks the placeholder half of R6 done; plan-ide-integration and the integration plan describe the
placeholder instead of verified breakpoints; the lsp-server README lists the mock's fallback role and
no longer claims it has workspace symbols.

Validation:
- :lang:lsp-server:test full suite: 2293 tests in 309 classes, 0 failures, 2 existing skips (JUnit XML, fresh timestamps)
- :lang:dap-server:test: 3 tests, 0 failures

Limits:
- VS Code never starts the DAP server in practice: the debug configuration provider runs the module
  and returns undefined. The placeholder matters for any client or configuration that bypasses it.
- The Tree-sitter-to-Mock fallback is still reported only in the server log, not to the user.
- Tree-sitter keeps the default capability set: it overrides every feature in it. Whether each of
  those answers well is not re-audited here.
- Real debugging remains R6 (session service) and R7 (runtime bridge).

On #693, XtcDebugServer.kt is taken whole from lagergren/errs: the copies differed only in comment wrapping and one ktlint suppression, from errs' formatting alignment (ad4a117).

(cherry picked from commit eba208b)
lagergren added a commit that referenced this pull request Oct 16, 2026
A backlog sweep of the tracking and planning documents found items still presented as open
although later sections, the code or GitHub show them done, superseded or changed. Each was
checked against its closing evidence before editing: the later journal section, the code
(git grep / git log), or `gh pr view`. Dated journal entries keep their history: an unchecked box
that later work closed is ticked with a "Done later" pointer, and a dated statement that still read
as current gets a short "Later:" or "Superseded:" line. Current-status tables and undated status
text are updated in place.

Integration plan (docs/errs-integration-plan.md):
- Ticked, with the closing section linked: demo notification cleanup, PLAT2c/L67, PLAT2e, the
  cursor/header forms (superseded by L57–L59/L64), the native IntelliJ parity checkpoint, the
  retained heap growth (TransientThreadLocal fix; October 8 growth below 150 KB over 1,800 cycles),
  the combined gate rerun, the uninterrupted IntelliJ receipt, L62 cross-module/overlapping moves,
  the support bundle and failure links, and the L63 items the closure implemented within its
  bounds.
- Kept open with what remains: visible Cancel is done but UP16/UP17 and platform acceptance are
  not; X105 has not recurred but was never diagnosed; mutable captures, inverse substitution,
  runtime Class/Type values without a source owner and explicit generic qualifiers were moved out
  of L63 scope and are still unimplemented; dependent/dynamic type shapes are still refused;
  remote-host acceptance moves to L82.

Journals (docs/errs.md, docs/errs-audit.md):
- Status table rows 2.2 (highlights do distinguish read/write), 3.5 (partial: cross-file
  definition/references over the source graph; no persistent index), 3.6 (bounded compiler-only
  completion and signature help) and 4.2 (final-type checks pinned by
  TypeInfoFinalCompositionTest; the 70-message survey stays open) now state the current state.
- "Later:" pointers for the 121-call recount, positioning, AST2/AST4, the build-model import, the
  uninterrupted IntelliJ runs, visible Cancel and shared-process windows, and the heap growth.

Playbook (lang/doc/manual-test-plan.md):
- The heap paragraph no longer calls the October 1 run "the latest" with growth under
  investigation; it records the fix and the October 6/8 runs. Multi-hour and platform evidence stay
  open. Visible Cancel pointers added; §14 signature help and §15 document links name the compiler
  adapter as well as Tree-sitter.

PR roadmap (pr-roadmap.md), from gh on 2026-10-16:
- #685 was closed unmerged on 2026-10-12, not merged as the roadmap said. #683 was closed
  unmerged on 2026-10-15. #686, #687, #688 and #689 are merged; #687 merged as df29154 with four
  files, not the six or three the roadmap gave in two places. #693 is open and no longer a draft.

Plans and guides (lang/doc/plans/*, lang/README.md, docs/errs-upstream-issues.md):
- Dated status notes: the naming audit is done (no user-facing "XTC" in the five listed IntelliJ
  files; only KDoc, log messages and the icon path), per-file Tree-sitter re-indexing, the obsolete
  conditional Tree-sitter build, format on save, the VS Code plan (implemented except runtime
  debugging and Marketplace publishing), VS Code commands, compiler doc generation, workspace-wide
  hierarchy and editor workspace discovery in IntelliJ, compiler-backed semantics.
- formatting-plan: the manual checklist points to §13a and OnTypeFormattingTest; the `)` outdent,
  `->` indent and `/**` skeleton items are struck through with their tests.
- Upstream register: UP23 and UP24 rows added from the doc's own sections; the UP01–UP29 rows were
  split across three fragments (blank lines and a repeated header made two of them render as plain
  text) and are one table again. A stray "j" before conditional-build.md's title is removed.

Validation: documentation only. All 57 new relative links and anchors resolve (checked by script
against each target's headings); git diff --check is clean. PR states were read with gh.

Limits: several closing pointers cite commit hashes from before the 2026-10-05 rebase, following
the documents' existing convention; those commits live on backup/errs-pre-master-rebase-20261005,
not in this branch's history. The L63 consolidated list still ticks some forms (runtime Class/Type
receivers, capture preservation) more broadly than its closure table supports; its own caveat
limits the ticks to the closure's supported forms, so it is left as written.

On #693 the plan documents stay as on master, so the plugin-stability-followups row in the plans index is not updated.

(cherry picked from commit b1b4ea0)
lagergren added a commit that referenced this pull request Oct 16, 2026
The javatools test for EmbeddingSupport.runMethod and console input (from 5a14da2 and
82b6ba5), the same file as in the runtime pull request that carries those changes to master and
in #693. It runs real modules against the installed XDK and is skipped without it: entry method
selection (InterpreterControl.entryArguments) and its refusals, exact arguments including non-ASCII
text, readLine with and without console input, and a missing entry method. Runs use a temporary
root directory.

Validation: the class passes here, 5 tests, none skipped (fresh JUnit XML). On the runtime branch,
changing runMethod to drop the console input makes the console test fail.
lagergren added a commit that referenced this pull request Oct 16, 2026
docs/errs-integration-plan.md:
- The 2026-10-15 embedded build/run and hardening sections and the 2026-10-16 section say their
  commits were mirrored into #693 on 2026-10-16, instead of "not mirrored".
- The 2026-10-16 map gains e4f357f (VS Code build mode command and status bar) and 843bc12
  (EmbeddingRunMethodTest).
- New section "#693 synchronization and the runtime pull request (2026-10-16)": #693 moved from
  a37d5dd to 4abcfbb; what was left out and why (tracking files, the reverted pair and their
  revert); how the plan documents, XtcDebugServer.kt and the lowercase renames were handled; the
  two #693-only commits; a table mapping all 41 #693 commits to the commits here; the #693
  receipts (all suites, both full native catalogs, and the toggle); the runtime branch
  lagergren/embedded-run-runtime (9a38204, b99159a, 90334a1), how it differs from this
  branch on master, its receipts, and open items to open its pull request and to rebase #693 once
  it merges.

pr-roadmap.md: a row for e4f357f and 843bc12, a note on the 2026-10-16 synchronization, and
the runtime-execution paragraph updated for its branch and #693 carrying the same changes.

Validation: documentation only. Commit identifiers in the map come from the cherry-pick lines on
#693's branch; run identifiers and counts were read from each run's results.json and JUnit XML.
The pull request itself is not opened yet: the auto-mode permission check refused gh pr create.
… the Build window's messages by their target

- ProblemFiles.projectErrorSources lists what Project Errors has in a file, each with the class of
  the provider that reported it; X341's failure messages use it.
- X341, right after the Build: every entry must be the provider's. The Build window hands each of
  its events to its listeners in order and synchronously (AbstractViewManager.onEvent), and
  BuildViewProblemsService registers first, so a copy that IntelliJ makes of a Build's error, as
  2026.3 does of a build view's file message, is already in Project Errors when the Build ends, and
  stays until the next Build: the check fails at once instead of waiting out the hour bound. After
  the "listed once" wait, the case prints its record: "[playbook] X341: Project Errors in
  Project/Child.x after the Build: [...]".
- EmbeddedExecutionUi.build records a Build window message that goes to a file as
  "File.x:line:column: kind: message", from its navigatable's file, line and column, as it records a
  file message; X281's and X341's checks of the reported lines now check where each error leads.

Validation
- 2026.2.3: run-7835392141255911648, X341 and X281 passed; record "[1:21 COMPILER-30: Unresolvable
  name: ... [ProjectErrors]]"; JUnit XML tests=1 failures=0.
- 2026.3, with the uncommitted Starter 263 experiment of the previous commit:
  run-8704265814916614805 (before it) failed at the new check with a [BuildViewProblemsService]
  entry beside [ProjectErrors]; run-356384057713571395 and run-12895301785843798610 (after it)
  passed X341's and X281's checks.
- compileIntegrationTestKotlin and spotlessCheck.
…s unit tests

Cherry-picked onto errs in a checkout that had built before #766 turned code instrumentation off,
the plugin's unit tests failed: ClosedDocumentDiagnosticsTest 6 of 10 (each expected publications
and got none) and EmbeddedBuildProblemsTest with NoClassDefFoundError. A fresh worktree passed.

Cause: with instrumentCode = false nothing writes build/instrumented any more, but the IntelliJ
Platform Gradle Plugin still puts build/instrumented/instrumentTestCode first in the test task's
testClassesDirs and at index 0 of its classpath, ahead of build/classes/kotlin/test. That checkout
still had the directory from 2026-11-10, with errs' old test classes in it, so they shadowed the
current ones: ClosedDocumentDiagnosticsTest ran as its old 10-test version, whose fake Connection
has no reported(); the current ClosedDocumentDiagnostics.apply calls connection.reported first, so
each report ended in an AbstractMethodError, an Error that the bridge's catch of RuntimeException
does not take and the CompletableFuture swallowed, so nothing was published or logged. The removed
EmbeddedBuildProblemsTest still ran from there, against main classes without EmbeddedBuildProblems.

Fix: the test task filters build/instrumented out of testClassesDirs and the classpath. The
filter keeps a java.io.File, which the configuration cache stores.

Validation
- Reproduced in a fresh worktree by copying that checkout's build/instrumented into it: exactly
  the 6 failures and the NoClassDefFoundError. With the fix, and the stale directory still there,
  the test classpath and testClassesDirs no longer list it.
- :lang:intellij-plugin:test --rerun, from deleted results, fresh JUnit XML (61 files): 260 tests,
  0 failures, 0 errors, 0 skipped; ClosedDocumentDiagnosticsTest 11 of 11; EmbeddedBuildProblemsTest
  not run. The configuration cache entry was stored, and reused by a later run.
- verifyPlugin: Compatible against IU-263.7307.200, no unreviewed internal APIs. spotlessCheck.
- The plugin's behavior is unchanged, so X341 was not run again.
- Nothing else refers to EmbeddedBuildProblems but a historical note in doc/errs/remaining.md.

Limits
- An Error from the bridge's Connection, such as this AbstractMethodError, is still dropped
  without a log by the CompletableFuture.
…its in xtc/languageServiceStatus

The status's heap now also says what the garbage collections leave in use: after the last one, the lowest in the
last minute (the estimate of the live data, since one collection's figure also counts garbage a later one frees,
G1's young collections the old garbage up to its next marking), and the most; with the collectors, their
collection count and time, and the soft heap limit when one is set. The compile queue's snapshot adds how long its
oldest job has waited and its longest running job has run.

ServerHealth listens to the JVM's collection notifications, so nothing polls the heap, and checks the queue every
5 s. It logs a warning once when the live-data estimate reaches 50%, 75% or 90% of the maximum, and once when it
falls 10 points below the share it reached; once when the estimate has doubled, by 256 MB or more; once when the
queue holds 10 jobs or its oldest has waited 30 s, and once when it has caught up; and once for each job that runs
2 minutes. The status's new "health" list holds the latest 20 of these lines.

This is in the status, not in LSP telemetry events, since LSP4IJ's telemetryEvent does nothing.

Validation: ServerHealthTest (5 tests, figures and times fed in, no collections or clocks) and XdkStdioTest (66),
which checks the new fields over stdio; spotlessCheck. ZGC's pause notifications report no usage, so only its
cycles count.
… JVM options choose otherwise

Both editors now start the server with -XX:+UseZGC -XX:SoftMaxHeapSize=1G when the user's JVM options name no
collector and no -Xmx. G1, the JVM's default, ignores SoftMaxHeapSize (JDK-8236073) and grows toward its maximum,
a quarter of the machine's memory, 16 GB on a 64 GB machine. ZGC keeps the heap near the soft limit, grows past
it only as far as the live data needs, up to that same maximum, and gives back memory it no longer uses. A
maximum heap the user chose keeps G1: ZGC has no compressed pointers, so the same data takes about half as much
heap again, which a small cap would not hold. Leaving the soft limit out under a user's -Xmx also avoids the
JVM's refusal to start with a soft limit above the maximum.

Measured with the whole-library compile of ecstasy that Go to Definition into String.x starts, on one library
and then with collections, json, net and web open too (compile seconds, peak resident MB, live MB after a full
collection):

  G1 as before           12.6 s 1213 MB  365 MB | 17.3 s 1857 MB  612 MB
  G1 -Xmx1g               9.6 s 1106 MB  367 MB | 14.6 s 1283 MB  614 MB
  G1 -Xmx2g              10.3 s 1119 MB  366 MB | 14.8 s 1384 MB  613 MB
  ZGC                    13.5 s 3616 MB  560 MB | 18.7 s 5188 MB  912 MB
  ZGC, soft limit 1g      9.7 s 1439 MB  558 MB | 15.9 s 1612 MB  914 MB
  ZGC, soft limit 2g     13.0 s 2590 MB  558 MB | 18.6 s 2788 MB  910 MB

Limits: with five libraries open the live data is 914 MB, just under the target; a larger workspace runs above
it, where ZGC collects back to back, costing CPU rather than failing. The status's heap figures and health lines
show it.

Validation: ServerJvmOptionsTest (5); the VS Code extension compiles, and its runtime-settings suite has the same
cases but runs only in the VS Code test host, which this change did not run; configuration.md's citations into
lsp-client.ts and runtime-settings.ts are remapped and each checked against its line.
…nished test results in X339 and X340

X50, X124 and X134 failed once the diagnostics waits ended on a final report (f46eac6). Each deletes or
overwrites a file on disk that IntelliJ's virtual file system already has, X124 and X134 outside the project,
and then waits for the diagnostics the change brings. refreshAndFindFileByPath refreshes only a path the file
system does not have yet, so the change reached LSP4IJ, and the server, only with IntelliJ's file watcher, some
time later; X50's trace shows no notification for its delete before the case failed. Until then the server had
nothing to do, so its report was final, and the wait failed rather than waiting the watcher out.

A probe, DiskChanges, now refreshes a path synchronously whether the file system had it or not, and the
workspace's refresh uses it. changeOnDisk makes a change, refreshes, and waits until LSP4IJ's sent
didChangeWatchedFiles notifications name the path or a directory above it, an event rather than a time; delete
and X124's and X134's changes after their documents open go through it.

X339 and X340 failed since 6a139a9, whose test-run probe lists a test from its start, as running. Their waits
for the run's and the debugged test's results asked only that each test be listed, and then found one still
running; they now wait until each is finished.

Validation: X50, X124, X134 passed and X339, X340 partial, as before the regressions, in the container on
IntelliJ 2026.2.3 (run-7125301734966166612); spotlessApply, compileIntegrationTestKotlin.
…s refresh check independent of timing

XdkRetentionTest's edit storm asserted that seven of eight quick compiles of a document are cancelled. That held
only while the test sent all eight within the adapter's 100 ms debounce and before the first compile finished:
a pause of more than 100 ms plus a compile, as on a loaded machine, let an earlier one finish uncancelled.
XdkAdapter now takes an optional debounce, which runs a submitted compile once the editing has paused and returns
what cancels it; without one it keeps its own 100 ms timer. The test's debounce holds a storm's compiles until its
last edit, as an editor's pause would, and runs other compiles at once.

The same cycle asserted that closing a document cancels a rename on it. The rename goes straight onto the
adapter's one compile worker, so it held only while the test closed the document before the worker had run the
rename. Each cycle now holds the worker with a compile of another module, Other.x, whose compile waits on a gate
the test opens after the close, so the close always finds the rename queued.

LibraryContentProtocolTest asserted that no workspace/textDocumentContent/refresh arrived within 2 s of a
dependency change: 2 s of every run, and blind to a later one. The server takes a dependency change under its lock
and sends that change's refreshes before it returns, so the test now checks for none right after the change and
again once a query has waited for the document's analysis after it.

The assertions are the same; only when they look changed.

Validation: XdkRetentionTest (default, and -PlspTests=heavy: 120 cycles, 960 edit requests, 3503 compiler objects
released) and LibraryContentProtocolTest (5 run, 1 parameterized case left to the full set), with the IntelliJ
playbook's container loading the machine; spotlessApply.
IntelliJ had shortcuts to switch the adapter (Ctrl+Alt+X, then A), which restarts the server only when the adapter
changes, and to show the log (Ctrl+Alt+X, then L), but a plain restart with the same adapter needed the Language
Servers view or the runtime settings page. Restart Ecstasy Language Server, in the Tools menu and on Ctrl+Alt+X,
then R (Control+Option+X, then R on macOS, in both macOS keymaps), restarts the project's server with its adapter
and the saved runtime settings. It checks those settings first, as the settings page's restart button does, so
that invalid ones stop no working server and a notification says why; with no server started in the project, a
notification says so. The button and the action now share restartEcstasyServers.

The plugin README and manual-test-plan.md describe it; the manual steps also check that Search Everywhere and Find
Action find the restart, adapter and log actions by name.

Validation: PluginManifestTest (10), whose shortcut check now includes the action's three keymaps; spotlessApply.
Not yet run in an IDE.
…panded

X1 failed in a full playbook run when the driver's JTreeTextFixture.expandAll, which gives a tree's expansion a few
seconds of its own, timed out while other builds loaded the machine; its TimeoutException stopped the whole run, as
the playbook stops on any. Expanding again is harmless, so StructureViews now takes that timeout as rows not all
there yet and expands again in its wait, which the hang bound ends for a tree that never expands; any other failure
still ends the case.

Validation: compileIntegrationTestKotlin, spotlessApply; X1 in the next full run.
… then R

IntelliJ restarts the Ecstasy language server with Ctrl+Alt+X, then R; VS Code's Ecstasy: Restart Language Server
had no shortcut. It now has the same chord, Control+Option+X, then R on macOS as the other chords, without a when
clause, as the log's, so that it also works outside an Ecstasy editor, as IntelliJ's does. The README's command
table, the plugin README and the manual restart steps say so.

Validation: package.json parses; npmCompile.
The health status, the debounce parameter and the restart shortcut moved lines in XtcLanguageServer.kt,
XdkAdapter.kt, plugin.xml and XdkRetentionTest.kt that configuration.md cites. Each such citation, a bare `:N`
after its file's too, now names the same line text in the current file, which a line diff found.

formatting-plan.md's citations of the formatting capability already pointed at a bracket and a comment; they now
name the capability, and the formatting handler, which is in XtcTextDocumentService.kt, not XtcLanguageServer.kt.
…finished indexing

X218 hung in a full playbook run on IntelliJ 2026.2.3: the probe called MoveHandler.doMove while IntelliJ indexed
the files the case had just written, and the platform asked, in a modal Yes/No, whether to move files without
updating their usages during indexing. Nothing answers that question, and indexing cannot finish while it holds
the event thread, so the case waited until its hang bound. It passed the day before, and on 2026.3, when indexing
happened to finish first; this morning's synchronous refresh of the files a case writes makes IntelliJ index more
of them at once.

The probe's move and rename now run through DumbService.smartInvokeLater, on the event thread once indexing has
finished, which is what the question is about: no time, and the hang bound still ends an IDE that never finishes.

Validation: compileIntegrationTestKotlin, spotlessApply; X218 in the next full run (run-16227692337490803963
shows the question in its thread dumps).
IntelliJ had no action for the build mode, only Build, Execution, Deployment > Ecstasy; VS Code had Ecstasy: Select
Build Mode and the status bar, without a shortcut. Select Ecstasy Build Mode, in IntelliJ's Tools menu, chooses
Automatic, Embedded compiler or Gradle from a list, as the adapter switch chooses an adapter, and a notification
says what Build, Rebuild and Run now use. Both editors put it on Ctrl+Alt+X, then B (Control+Option+X, then B on
macOS, in both macOS keymaps). The next build or run uses the mode: the language server does not read it, so
nothing restarts, syncs or reindexes; Build in Gradle mode needs the Gradle project linked in IntelliJ.

The plugin README, VS Code's command table and the manual test plan's build mode steps describe it.

Validation: PluginManifestTest (10), whose shortcut check includes the action's three keymaps; npmCompile;
package.json parses; spotlessApply. Not yet run in an IDE.
…t when a case reads them

37ed3e1 made the workspace's refresh(path) refresh a file IntelliJ already has, so that a case's own change on
disk reached LSP4IJ at once. Cases also find files through it to read them, and X219's check of the files a move
had written refreshed them: IntelliJ took that as a change outside the IDE, which ends the project's Undo of
them, and the case waited for Undo until its hang bound in a full run on 2026.2.3.

refresh(path) finds a file again as it did before, refreshing only a path IntelliJ does not have; write and
changeOnDisk, where a case has changed the disk itself, refresh through DiskChanges as before.

Validation: X50, X124, X134, X218 and X219 passed in the container on IntelliJ 2026.2.3
(run-17137306524796778050); compileIntegrationTestKotlin, spotlessApply.
…s against 2026.2.3

-PintellijPlaybookIde=2026.3 runs the IntelliJ playbook on IntelliJ 2026.3; without it the playbook drives the IDE
the plugin builds against, 2026.2.3, as before. IDE Starter and its driver follow the IDE they drive, so on 2026.3
the integration tests take Starter 263.7307.200 and the Kodein and coroutines that it needs
(lang-intellij-next-* in libs.versions.toml), while the plugin itself compiles against 2026.2.3.

Starter 263 changed a few signatures: IdeInstaller.install is no longer suspend, CIServer.reportTestFailure has
additionalMetadata, and waitForIndicators needs an opt-in. CachedIdeInstaller, FailureCollector and
StartupIndicators have one copy per Starter line, in src/starter262 and src/starter263, and the build compiles the
one for the IDE it drives; the IDE lookup they share is CachedIdes. The probes the IDE runs moved into a source set
of their own, src/playbookProbe, compiled against the plugin's IDE, so that either line's driver calls them.

On 2026.3:
- the Problems view is a bundled plugin of its own, and the driver SDK has no Problems view helpers for it: the
  probe plugin depends on it optionally, and ProblemFiles reads the File tab's problems through the platform's
  classes, which keep their names in both lines;
- closing an editor and reloading a document from disk need the write-intent lock, which a driver call on the EDT
  had implicitly on 2026.2: the probes now take it, and the playbook closes editors and reloads documents through
  them;
- the IDE's test folder is nested one level deeper, and the container's copy_runs finds IDE logs in both layouts.

configuration.md has the intellijPlaybookIde row and its build-script citations remapped; testing.md says how the
playbook drives a newer IntelliJ.

Validation: full IntelliJ playbook in the container on IntelliJ 2026.3 (run-16968013414583787248, with
-PintellijPlaybookHang=600) and on 2026.2.3 (run-2702324546959338057, the hour bound): 327 passed, 17 partial,
9 not implemented, none failed, each. The 2026.3 run predates the X1, X218 and X219 harness fixes; X122, which
hung once on 2026.3 in an earlier full run, passed alone (run-4326259061252673093) and in the full run.
compileIntegrationTestKotlin for both lines.
The playbook ends only a hang, at an hour, so that no case's result depends on the machine's speed; a case that
hangs then costs a run an hour before it fails. -PintellijPlaybookHang=<seconds> (xtc.playbook.hang) shortens the
bound for a quicker look at such a case, in the playbook and in the IDE it drives, whose probes get the same
system property; without it the bound stays an hour. A run with it says nothing about a slow machine, so
validation runs keep the hour.

configuration.md has the intellijPlaybookHang row, and PlaybookIde.kt's citations follow its new import.

Validation: the full IntelliJ playbook on 2026.3 ran with -PintellijPlaybookHang=600 (run-16968013414583787248),
X122 alone with it (run-4326259061252673093); compileIntegrationTestKotlin.
…f failing every file

A workspace whose discovered modules declared one name twice could not be analyzed at all: XdkProject refused
the whole graph, and every compile in the workspace reported SOURCE-GRAPH "Duplicate source module name" at the
top of its file, without the name. The XVM repository is such a workspace: FizzBuzz, HelloWorld, HelloClient,
TestMisc, TestSimple, MyApp and Test are each declared by two example, manual-test, fixture or archived files,
so every .x file opened in it, ecstasy.x included, showed only that error, in both editors.

Discovery now leaves a name that two or more module files declare out of the graph, so that the rest of the
workspace is analyzed as before. Each of those files is analyzed on its own, as a file of no module in the graph
is, with a SOURCE-GRAPH warning that names the other files: "Another module file declares this module's name
too: <files>. Neither is part of the workspace's module graph, so no module can import it; each is analyzed on
its own." A module that imports such a name finds no source module for it. A host's explicit modules, from its
settings or a Gradle build, still refuse a duplicate, as a configuration error, now naming the module and its
files. The docs' line citations into these files follow them.

Validation: XdkProjectServerTest's new case, two Twin modules beside a Library and its Consumer: the Consumer is
analyzed without diagnostics, and each Twin has only the warning naming the other; without the fix the Consumer
never gets a clean report. XdkProjectServerTest (11), CompilerConfigurationTest (9), FileChangeSnapshotsTest (2),
IndexingProgressTest (2), XdkConsumerDiscoveryTest (3). The server, rebuilt, over a clean XVM checkout as its
workspace folder: ecstasy.x and json.x report nothing, where both had the error; doc/examples/FizzBuzz.x and
manualTests/src/main/x/TestSimple.x each have the warning naming their twin.
…ory, instead of the bundled XDK

In the XVM repository the language server analyzed lib_ecstasy, lib_json and the other XDK libraries against the
bundled XDK it carries: discovery dropped every module named like a bundled library, so each library file compiled
alone, and a library that uses another, json using ecstasy, compiled against the bundled one. A change to the
repository's ecstasy was invisible to the others, and Go to Definition from them opened the bundled read-only copies.

A workspace whose modules declare ecstasy.xtclang.org now holds the XDK's own sources (XdkWorkspaceMode):
- discovery keeps its library modules, marked as replacing the bundled ones, and gives every module of it an edge to
  ecstasy, which each imports without saying so; mack.xtclang.org and _native.xtclang.org stay bundled, as ecstasy
  compiles against mack's binary and _native must match the runtime the server carries;
- a source module may then carry a bundled library's name, and so may a dependency that the server's compiler emitted
  from one, never a binary from disk; the compiler's library repository already puts the server's dependencies ahead
  of the bundled libraries, so json compiles against the workspace's ecstasy, its unsaved edits included;
- a module's own identities are its declarations: SemanticModelBuilder no longer takes the bundled copy's declaration
  for an identity of the module it builds, which had left ecstasy's artifact without the declarations that the bundled
  ecstasy also has, and sent Go to Definition on Int from json to the bundled copy; a bundled library's read-only copy
  still answers with the bundled declarations' content;
- such a workspace has no embedded builds or runs, which run the bundled XDK's runtime: they say so, and Gradle mode
  builds and runs it; xtc/languageServiceStatus lists the replaced libraries as xdkWorkspace.
-Dxtc.lsp.xdkWorkspace=false, or a maximum heap under that of a library's whole compile, keeps every library bundled,
as in any other workspace, which nothing here changes. configuration.md has the property, and its citations follow
the moved lines.

Limits: the server compiles the workspace's ecstasy with its own compiler, so a compiler change that the plugin's
build predates is not understood; renames of an XDK library's symbols are still proven against the bundled library,
which shadow-aware rename facts are to fix; import suggestions and the bundled libraries' hover documentation come
from the bundle; the property has no editor setting yet.

Validation: XdkWorkspaceModeTest (heavy), over copies of the repository's lib_ecstasy and lib_json: ecstasy compiles
from source in about 10 s, json against it with a method that only an unsaved edit of the workspace's String has,
Go to Definition on Int goes to the workspace's Int64.x, the status lists ecstasy and json without mack, and a build
is refused. XdkWorkspaceDiscoveryTest's new case: the libraries, not mack, each depending on ecstasy, and none with
the property off. The default lsp-server tests (2508, none failing), compilerStdioTest (83). The rebuilt server over
an XVM checkout: json resolves String and Int to the checkout's lib_ecstasy.
…raph is in use

6cad350 kept discovered modules that share a name out of the graph and warned on each of their files. When a host
then named the modules itself, as the IntelliJ plugin does once it has a project's configuration, discovery's
problem was cleared but its duplicates were not, so files that the explicit graph left alone kept the warning.
The playbook's workspace, whose case folders declare many of the same names, showed it: X30, X267, X270 and X272
expected clean reports and got the SOURCE-GRAPH warning in a full run on 2026.2.3.

The duplicates are cleared wherever the problem is, on the switch to explicit modules and back, and a compile takes
them only while discovery's graph is the one in use.

Validation: XdkProjectServerTest's duplicate case now also switches to explicit modules and expects the twin's report
to be clean, which fails without the fix; XdkProjectServerTest (11), CompilerConfigurationTest (9),
XdkWorkspaceDiscoveryTest (9), FileChangeSnapshotsTest (2), IndexingProgressTest (2), XdkConsumerDiscoveryTest (3).
X30, X267, X270 and X272 passed in the container on IntelliJ 2026.2.3 (run-14120579967405012475).
…ver the project is configured

The XDK's own sources replaced the bundled libraries only in a workspace whose discovered modules
declared ecstasy.xtclang.org; a project configured from Gradle's model or with explicit
sourceModules refused every module named as a bundled library ("Project sources cannot replace
bundled compiler libraries"), so the XVM repository configured from its Gradle model failed, and
a project with its own copy of json could not have it at all.

Now one rule, XdkLibraryReplacement, applied by discovery, Gradle's model and explicit
configuration alike: a source module named as a bundled library replaces it, and a replaced
ecstasy is a dependency of every other module, which imports it without saying so, also where
Gradle's project dependencies do not name it. mack and _native are never replaced: a source
module cannot take a bootstrap module's name. -Dxtc.lsp.replaceLibraries=false (was
xtc.lsp.xdkWorkspace), or a heap too small for ecstasy's whole compile in a workspace with its
sources, leaves such modules and the dependencies on them out. Whether a module replaces a
library follows from its name, not from a flag each construction had to carry, so modules that
queries rebuild keep it. The status key is replacedLibraries (was xdkWorkspace).

Validated: XdkWorkspaceDiscoveryTest (json alone replaces json; with ecstasy every module depends
on it; off, nothing does), XdkBuildModelTest (the XDK's libraries in Gradle's model, without
project dependencies, depend on ecstasy), CompilerConfigurationTest (an explicit json is taken, an
explicit mack is refused), XdkRepositoryWorkspaceTest (heavy, over copies of lib_ecstasy and
lib_json), XdkProjectServerTest and LibraryContentProtocolTest: 43 tests, 0 failures, 0 skipped. XdkLibrariesTest
now expects a bootstrap module's name, mack.xtclang.org, to be refused, instead of xml's.
…lugin's own switch

The build turned searchable options off by disabling the buildSearchableOptions task. Since
IntelliJ Platform Gradle Plugin 2.20.0 (master has 2.20.1 since #770), prepareJarSearchableOptions
reads a directory under build/ that only buildSearchableOptions creates; before, it read that
task's temporaryDir, which Gradle creates when it is asked for. With the task disabled, every build
of the plugin failed:

    A problem was found with the configuration of task ':lang:intellij-plugin:prepareJarSearchableOptions'
    (type 'PrepareJarSearchableOptionsTask'). Input file does not exist: property 'inputDirectory'
    specifies directory '.../lang/intellij-plugin/build/tmp/buildSearchableOptions' which doesn't exist

Master's CI builds without the lang build (includeBuildLang=false), so it did not see this.

intellijPlatform.buildSearchableOptions, set from the same -Plsp.buildSearchableOptions property,
makes the platform plugin skip buildSearchableOptions, prepareJarSearchableOptions and
jarSearchableOptions together. The property's declaration moves above the intellijPlatform block
that now reads it.

Validated: :lang:intellij-plugin:buildPlugin with those three tasks SKIPPED, and
:lang:intellij-plugin:test, 261 tests, 0 failures, 0 skipped.
…pull request

lang/scripts/publish-preview-plugins.sh builds the IntelliJ plugin and the VS Code extension from
a pull request's head, #693 by default, and publishes them to the GitHub pre-release
intellij-plugin-pr<N> of xtclang/xvm, without the JetBrains Marketplace. It is run by hand;
there is no schedule.

- It builds in a worktree of its own (~/.cache/xtc-preview/xvm-pr<N>), at the pull request's
  head, as CI builds for the Marketplace: -PenablePublish with the suffix
  <UTC timestamp>.pr<N>, so each preview has a version of its own, such as
  0.4.4-SNAPSHOT.20261117145843.pr693, which sorts after every earlier build.
- It uploads the plugin ZIP with its checksum and the VSIX, and replaces the release's
  updatePlugins.xml. IntelliJ users add that file's URL as a custom plugin repository
  (Settings | Plugins | Manage Plugin Repositories) and get each newer preview as an update;
  VS Code users install the VSIX.
- The version, name and since-build in updatePlugins.xml come from the built plugin.xml, and
  the script stops if the version isn't the one it built.
- The release keeps the last 10 previews (--keep), and --dry-run builds without uploading.
- It works with the clone it is run in, whatever that has checked out, so the latest script runs
  straight from #693: git fetch -q origin errs/full-testable-lsp-20261009 &&
  bash <(git show FETCH_HEAD:lang/scripts/publish-preview-plugins.sh)

It runs under macOS's bash 3.2 too: the here-documents are written to files, not inside $(...).

Validated: a dry run with /bin/bash 3.2 built 0.4.4-SNAPSHOT.20261117145843.pr693 (since-build
262) from #693's head; the ZIP has the tree-sitter libraries of darwin-arm64, darwin-x64,
linux-arm64, linux-x64 and windows-x64. A second dry run, from a clone on another branch through
bash <(...), built 0.4.4-SNAPSHOT.20261117150610.pr693 and left that clone's checkout as it was.
…n of a trailing space in the repository URL

A preview had the Marketplace builds' name, so IntelliJ listed both as "Ecstasy Language Support".
The script now sets the name in the preview's own plugin.xml after the build, to "Ecstasy Language
Support (bleeding edge)" by default (--name), and updatePlugins.xml takes it from there. Only that
file in the plugin's jar changes; the plugin id stays org.xtclang.idea, so the preview and the
Marketplace builds stay versions of one plugin and are never installed side by side. No build file
changes.

The first preview didn't install: the repository URL had been pasted with a trailing space, which
IntelliJ keeps, and PluginDownloader.toAbsoluteUrl then fails with "URISyntaxException: Illegal
character in path at index 88" (IntelliJ IDEA 2026.3's idea.log). The release notes now say to paste
the URL without one.

Validated: a dry run from a clone on another branch built 0.4.4-SNAPSHOT.20261117152505.pr693 and
named it; the renamed ZIP passes unzip -t, has the built ZIP's entries, and differs from it only in
the plugin jar's META-INF/plugin.xml, whose name is the new one and whose id and version are the same.
includeBuildLang and includeBuildAttachLang are false again, as on master. They were turned on
so that the root build would also build and test the language server, but lang resolves a large
amount (the IntelliJ Platform, the VS Code tooling and their dependencies), which an ordinary build
of the XDK shouldn't pay for. A run that needs lang passes -PincludeBuildLang=true
-PincludeBuildAttachLang=true, or sets ORG_GRADLE_PROJECT_includeBuildLang=true and
ORG_GRADLE_PROJECT_includeBuildAttachLang=true; gradle.properties now says so.

CI is unaffected: commit.yml already sets both to false for pushes and pull requests and passes
them to every step that builds lang, and the root build.gradle.kts doesn't refer to lang.
A module records the directory it was compiled in, which may be another
checkout or another machine, such as for a module from a build cache.
The debugger joined that directory with each class's source path to
index the methods by file, to match breakpoints and to name the file of
a stack frame, so a breakpoint in the checkout being edited did not bind.

The language server knows where the workspace's modules are. It now
sends the directory of each one's sources with the debugger's setup,
for embedded runs and for attached, Gradle, command-line and test runs,
and SessionDebugger.setSourceDirs uses it in place of the recorded
directory. A module the language server does not know keeps the
directory it records.
…hanges on disk

698882c lets a diagnostics wait fail once nothing could change the report: three quiet status polls, 75 ms
apart. A change a case makes on disk to a file no editor has open reaches the server through VS Code's file watcher,
and the language client holds what the watcher reports for 250 ms more, so the wait took the report as final before
the server had heard of the change. X27, X50, X124 and X134 failed in the container on their own, and X49 after
other cases. IntelliJ passes them: its playbook tells the IDE of a change at once.

xtc/languageServiceStatus now gives watchedFileChanges: when the server received each file's latest watched-file
event, by URI, recorded once the rediscovery the event asked for has run, so that any compile it submitted is queued.
The VS Code playbook changes files through disk.ts, node:fs/promises that remembers each change, and its wait takes
nothing as final while the server has not received an event later than a change, of the file, of a directory it is
in, or of a file in it. A change no watcher reports is never heard of, which leaves the wait to its timeout, as it
was before 698882c.

With it, X27, X49, X50, X124, X134 and X173 pass three runs in a row, and the whole VS Code playbook runs to its end:
349 passed. X218 fails, as its register says it must until VS Code repairs UP23, and X122 and X127 failed once with
cancelled code actions; both pass on their own, with and without this change.
…s empty symbols

X5 hung for the hour of the hang bound in a full IntelliJ playbook run, and the run ended with 175 cases not run.
After X5 removed its module's closing brace, LSP4IJ 0.21.0 sent textDocument/documentSymbol for the edited text
ahead of the edit's didChange; the server answered ContentModified, and LSP4IJ kept that empty answer as the edited
text's symbols, so the Structure view showed none until the next edit, which never came. LSP4IJ #1738, on its main
branch and in 0.30.0, sends a request for a document after the changes made to it before the request.

Until the playbook's LSP4IJ is 0.30.0, a Structure view that has not shown what a case expects after ten seconds
has its text edited and changed back, which makes LSP4IJ ask again, and the run prints a warning that names #1738.
A local LSP4IJ build or a channel's has the fix, and is not given the edit.
A hang ends the run, so the hour it waited cost an hour and every case after it. The slowest case takes 45 seconds
from start to end, so ten minutes still ends only a hang, and no case's result depends on the machine's speed.
-PintellijPlaybookHang still sets it, and the tour's bound, which is the playbook's unless -PintellijTourHang sets
it, follows.
…k cases change

X260-X264 copy the same Gradle files into the workspace and delete them again, outside IntelliJ. X263 rewrites
settings.gradle.kts and deletes it, and X264 copies it back milliseconds later; IntelliJ heard of both only from its file
watcher, took them for one edit of the same file, and indexed the earlier content under the later timestamp. X264's
Gradle sync then read the script through Kotlin's Gradle support and logged "Outdated stub in index", which fails the
run. The cases now tell IntelliJ of each copy, rewrite and removal before going on, as write() and delete() do.
…no document of a moved file yet

The check after a Move, Undo or Redo looked up the document of each file it found on disk and failed the case when
IntelliJ had none. While IntelliJ moves a file it can find one already on disk whose document it cannot give yet, which
failed X162 once at once. The check now counts such a file as not there yet and asks again until its time runs out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants