Files
Language-Server/README.md
T
faumaray da8003f6d4 Implement the VLS roadmap on the native VBS build
Native VBS and CMake builds of the server and every registered suite:
protocol and document sync, VBS/compdb providers, stock GCC diagnostics
(including in-process default profile preparation), the stock occurrence
observer and hover/definition, the bounded Scheduler, C++ module graph,
scan and artifact cache with real CMI production, the context-aware
symbol index with schema-2 snapshot migration, navigation and guarded
rename, reflection provenance with splice-origin extraction, index-backed
completion and signature help, live GCC worker control with a registered
DAP suite, and the Neovim and VS Code clients.

VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced
from the versioned patches and verified stepping reflection/template code
with projected values 17/34 and 41/82.
2026-12-05 14:06:50 +03:00

159 lines
7.5 KiB
Markdown

# VoidLanguageServer
A C++26 language server project for Void, using VoidLibrary. The target product
combines native Void Build System integration, compilation-database compatibility,
core IDE features, modules/reflection, and a live/replay metaprogram debugger for
Neovim and VS Code.
The native server supports stdio lifecycle, UTF-8/UTF-16 negotiation and
incremental document synchronization. It reads native VBS build metadata and
`compile_commands.json` without launching the project compiler. The JSON
capability suite passes on VoidLibrary main, including exact numeric request IDs
and valid numbers outside the parser's machine range. See the
[verification record](docs/agent-workflow/VERIFICATION.md).
The provider and compiler work is in progress. Semantic IDE features, debugging
and editors have separate acceptance gates in the [27-part roadmap](docs/roadmap/README.md),
[requirements](docs/roadmap/REQUIREMENTS.md) and [architecture](docs/roadmap/ARCHITECTURE.md).
## Compiler requirements
Void projects can keep their existing compiler. Building VLS itself has been
verified with stock GCC 16.2. Its C++26 reference tests include VoidLibrary
reflection and module imports.
The Linux/Nix development profile enables editor diagnostics with unmodified
GCC 16.2. VLS runs the selected translation unit's checked command and sends
`textDocument/publishDiagnostics` as the user edits. It also tracks unsaved
headers and optional headers that appear on disk. Separate module tests feed
GCC dependency scans to the C++ planner. Completion, navigation and editor
scheduling for modules remain in development.
An experimental GDB adapter observed nested `consteval` return values live on
an unmodified x86-64 Linux GCC 16.2 package. It uses the matching GCC headers
and an internal evaluator symbol. A separate experiment uses a patched frontend
for richer events. Saved GCC recordings can be opened in a DAP client without
a compiler on PATH. Live DAP control remains in development.
See the [stock compiler experiment](tests/corpus/frontend/README.md).
## Build and test
Use a VoidBuildSystem CLI with its matching SDK, GCC 16.2 with C++26 reflection,
Git and Python 3. The commands below use the local `dev cpp-gcc` environment.
Set `VBS` to the absolute path of your CLI when it is outside that environment's
`PATH`.
```sh
VBS=${VBS:-vbs}
tools/prepare-voidlibrary
dev cpp-gcc -c "$VBS" build --project "$PWD" --build-dir "$PWD/build/native" --profile debug
dev cpp-gcc -c "$VBS" test --project "$PWD" --build-dir "$PWD/build/native" --profile debug
python3 tests/native/Preparation.py
```
Preparation fetches VoidLibrary `main` and selects an immutable generation
under `build/voidlibrary`. Run it again to pick up an update. For an explicit
development checkout, use `tools/prepare-voidlibrary --source /path/to/VoidLibrary`.
The selected generation's `provenance.json` records the tested revision and
local input changes. A prepared generation also supports an offline build.
## Run and install
```sh
build/native/profiles/debug/out/bin/vls --help
build/native/profiles/debug/out/bin/vls --stdio
dev cpp-gcc -c "$VBS" install --project "$PWD" --build-dir "$PWD/build/native" \
--profile debug --prefix "$PWD/build/stage" --no-cmake-export
build/stage/bin/vls --version
```
The VBS development checkout's dependency-aware install path passed the
staged-executable test. VBS commit `6c225c2` builds and tests VLS, but that
revision's install command fails while resolving `Void::Data`. The native
build executable above is available with either CLI. See the
[verification record](docs/agent-workflow/VERIFICATION.md).
## Replay a recorded constant evaluation
Configure a DAP executable with the installed `vls-dap` and the arguments
`--replay /absolute/path/to/recording.vls`. Send a DAP `launch` request.
The included `tests/debug/fixtures/integral-17.vls` opens at the inner
`reflected_value` return of 17. Continue moves to the enclosing `twice`
return of 34 and then to the later recorded values 22 and 44.
Use Stack Trace and Variables to inspect a return. Loaded Sources exposes
the captured primary text even after its file changes. The recorded function
locations are logical declarations, so clients display the frame name without
jumping to a physical source line. The versioned timeline preserves which
values the compiler actually paused on. The stdio process tests and headless
Neovim session use the same installed executable interface.
```sh
python3 -B tests/native/DapReplay.py --adapter "$PWD/build/stage/bin/vls-dap"
```
## Enable stock GCC editor diagnostics
Prepare the profile in the same development shell used to build the project.
Pass the project root and the profile's absolute path in the editor's VLS command.
```sh
dev cpp-gcc -c tools/prepare-gcc-profile --output "$PWD/build/gcc-profile.json"
build/native/profiles/debug/out/bin/vls --stdio \
--workspace-root "$PWD" --gcc-profile "$PWD/build/gcc-profile.json"
```
With the prepared stock occurrence observer, the same profile also enables
hover and definition for verified direct calls:
```sh
dev cpp-gcc -c tools/prepare-gcc-observer --output "$PWD/build/stock-observer-014/occurrences.so"
dev cpp-gcc -c tools/prepare-gcc-profile --observer "$PWD/build/stock-observer-014/occurrences.so" \
--output "$PWD/build/gcc-profile.json"
```
The launcher sets the workspace's CLI tool-approval list to the profile's single
compiler. This takes precedence over the tool list in a user settings file.
The selected VBS metadata or compilation database
must name the same compiler. The editor supplies the workspace folder and opens
the source document as usual. With no profile the server provides passive build
information and document synchronization.
The development worker supports one GCC 16.2 Linux/Nix toolchain profile and
analyzes one open translation unit at a time. It captures source bytes under the
launcher root and uses the toolchain's immutable system headers. A client can
request `voidLanguageServer/analysisStatus` with `{"textDocument":{"uri":"…"}}`
to inspect the active context or a compiler message whose editor range could
not be verified. Each checked document has its own result. Project-wide
diagnostics, cross-file navigation and module artifact production remain open.
With no arguments or with `--stdio`, the server reads Content-Length-framed
UTF-8 JSON on stdin, writes protocol responses on stdout and diagnostics on
stderr. Help and version are standalone options.
### Comparison build
The CMake 4/Ninja bootstrap is retained for comparison. A fresh configure
refreshes the fetched revision of VoidLibrary.
```sh
dev cpp-gcc -c cmake --fresh -S . -B build/bootstrap -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
dev cpp-gcc -c cmake --build build/bootstrap
dev cpp-gcc -c ctest --test-dir build/bootstrap --output-on-failure
```
## Development
[Current state](docs/agent-workflow/STATE.md) and
[task ownership](docs/agent-workflow/TASKS.md) distinguish implemented, verified and
blocked work. User decisions and preflight corrections are recorded alongside them.
Run meaningful tests and obtain independent review of integrated changes.
The first usable release includes both live and recorded replay debugging of
templates, constraints, constexpr/consteval and reflection, through DAP and custom
views in both editors. Frontend/debugger feasibility and native VBS producer work
are explicit gates.
Project licensing is intentionally deferred until the backend decision. Local
initialization does not authorize commits, pushes, publication or sibling edits.