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.
81 lines
3.3 KiB
Python
81 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Run the VS Code client acceptance in a disposable extension host."""
|
|
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
CLIENT = ROOT / "clients/vscode"
|
|
|
|
|
|
def check(condition, detail):
|
|
if not condition:
|
|
raise ValueError(detail)
|
|
|
|
|
|
def application(code):
|
|
"""The Nix `code` wrapper starts a detached CLI; the app binary runs tests in-process."""
|
|
resolved = code.resolve(strict=True)
|
|
candidate = resolved.parent.parent / "lib/vscode/code"
|
|
return candidate if candidate.is_file() else resolved
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--code", default=shutil.which("code"),
|
|
help="VS Code launcher (default: code on PATH)")
|
|
parser.add_argument("--server", required=True, type=Path)
|
|
parser.add_argument("--adapter", required=True, type=Path)
|
|
parser.add_argument("--trace", required=True, type=Path)
|
|
parser.add_argument("--timeout", type=float, default=240)
|
|
options = parser.parse_args()
|
|
check(options.code, "code is not on PATH")
|
|
check((CLIENT / "node_modules").is_dir(),
|
|
"run `npm install` in clients/vscode once as a development step")
|
|
subprocess.run(["npm", "run", "compile"], cwd=CLIENT, check=True,
|
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=120)
|
|
tests = CLIENT / "out/test/run.js"
|
|
check(tests.is_file(), "the extension test entry was not compiled")
|
|
executable = application(Path(options.code))
|
|
server = options.server.resolve(strict=True)
|
|
adapter = options.adapter.resolve(strict=True)
|
|
trace = options.trace.resolve(strict=True)
|
|
with tempfile.TemporaryDirectory(prefix="vls-vscode-client-") as temp:
|
|
work = Path(temp)
|
|
workspace = work / "workspace"
|
|
workspace.mkdir()
|
|
(workspace / "unit.cpp").write_text("int value = 17;\nint read() { return value; }\n",
|
|
encoding="utf-8")
|
|
command = [
|
|
str(executable),
|
|
f"--extensionDevelopmentPath={CLIENT}",
|
|
f"--extensionTestsPath={tests}",
|
|
f"--user-data-dir={work / 'user'}",
|
|
f"--extensions-dir={work / 'extensions'}",
|
|
"--no-sandbox", "--disable-gpu", "--disable-workspace-trust",
|
|
"--skip-welcome", "--skip-release-notes",
|
|
str(workspace),
|
|
]
|
|
environment = {**os.environ, "VLS_SERVER": str(server), "VLS_DAP": str(adapter),
|
|
"VLS_TRACE": str(trace)}
|
|
result = subprocess.run(command, env=environment, capture_output=True, text=True,
|
|
timeout=options.timeout)
|
|
output = result.stdout + result.stderr
|
|
if result.returncode != 0 or "VSCODE_CLIENT_PASS" not in output:
|
|
print(output[-5000:])
|
|
raise SystemExit(f"VS Code client acceptance failed (exit {result.returncode})")
|
|
print("VS Code client passed: LSP status, replay session, timeline, source, stale "
|
|
"rejection and transactional rename")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
try:
|
|
main()
|
|
except (OSError, ValueError, subprocess.SubprocessError) as exc:
|
|
raise SystemExit(f"verify-vscode-client: {exc}")
|