Skip to content

feat: rustanka-language-server support#74

Draft
iainlane wants to merge 28 commits intografana:mainfrom
iainlane:iainlane/rustanka-language-server
Draft

feat: rustanka-language-server support#74
iainlane wants to merge 28 commits intografana:mainfrom
iainlane:iainlane/rustanka-language-server

Conversation

@iainlane
Copy link
Member

@iainlane iainlane commented Feb 27, 2026

Introduce support for the highly experimental and buggy Rustanka language server, which is a Rust implementation of a Tanka/Jsonnet language server.

All of the server's settings are exposed.

There are currently some failing tests. I tried to keep these to cases where the server is (arguably) returning the wrong results.

How to run tests

From repo root:

npm run lint
npm run test
npm run test:integration

To run integration tests against a real Rustanka binary:

JSONNET_LSP_SERVER=/absolute/path/to/jrsonnet-lsp npm run test:integration:real

The real run requires JSONNET_LSP_SERVER and uses the same scenario suite, so fake and real modes are directly comparable.

Debounce file watcher updates and cancel in-flight eval requests.

Track request ids so stale responses cannot overwrite newer output.
Create session-scoped temp file metadata and clean up both file and

directory when the eval result document is closed.
Use async fs/process APIs for eval temp output and installer checks.

This avoids blocking the VS Code extension host event loop.
Add redirect/time limits, verify sha256 assets when available,

and install binaries with 0755 permissions.
Make the client nullable, add stopClient(), and harden restart/eval

commands when the language server is not running.
Make resolvePathsWithTanka a string-only enum and resolve relative

jpath entries against all workspace roots.
Split eval flow, importer command, LSP requests, settings mapping,

and client lifecycle out of extension.ts.
Apply consistent whitespace and wrapping after the module split.
Enable @typescript-eslint/no-unused-vars and annotate intentional

unused callback parameters with underscore prefixes.
Introduce a dedicated debug configuration provider and fill in

type, request, name, program, and jpaths defaults.
Return the VS Code-provided executable descriptor when available,

falling back to the bundled jsonnet debugger adapter.
Extract pure installer parsing/asset-selection helpers and cover

version parsing, asset filtering, checksum matching, and hash parsing.
Add command-level usage details and explicit error behavior notes

for active-editor, server-state, eval, and importer outcomes.
Use a TextDocumentContentProvider-backed jsonnet-eval scheme for

live eval output updates and lifecycle cleanup.
Resolve debug jpath defaults from folder-scoped Jsonnet settings

and normalize relative entries against the workspace root.
Replace the custom extension-host runner with @vscode/test-cli and a
.vscode-test.js config. Add scenario-based integration tests under
src/test/suite plus a test-scenarios/basic workspace that includes Jsonnet
and Tanka trees, fake LSP/debugger binaries, and deterministic eval and
diagnostics behavior.

Also update docs/scripts, ignore local .vscode-test artifacts, and type
githubApiRequest's encoding as BufferEncoding for newer @types/node.
Teach integration tests to use a real LSP binary when
JSONNET_LSP_SERVER is set, while keeping fake-binary behavior as the
default.

Split .vscode-test.js into labeled fake/real configs and update npm
scripts to run each label explicitly. The real label enforces
JSONNET_TEST_REAL_LSP so missing JSONNET_LSP_SERVER fails fast.

Keep language server and debugger auto-updates disabled in the harness
for deterministic, non-interactive runs, and document the new real-mode
workflow in README.
Add *.expected.json sidecars for test scenarios and make fake-jrsonnet-lsp
load eval, diagnostics, and importer responses from those files instead of
hardcoded branches.

Update integration tests to read the same expected files, so fake-mode
assertions are data-driven by scenario fixtures. For real LSP mode, keep
eval assertions generic and skip diagnostics checks.

Document the expected-file mechanism in README.
Replace element-by-element diagnostics assertions with deep structural
equality against each scenario's expected diagnostics array.

This removes first-element indexing from diagnostics checks and keeps the
suite strict: real-LSP diagnostics now fail if expected diagnostics are not
published.
Centralize only binary-path and auto-update test settings in the harness,
while each test suite now sets its own language-server behavior flags via
setup hooks.

Drop manual `jsonnet.restartLanguageServer` calls from test setup. The
suite passes in fake mode without explicit restarts, avoiding startup-race
failures while still applying per-test configuration through workspace
settings updates.

Document that tests configure settings per case to avoid bleed-over.
Replace fake-only diagnostics fixtures with scenarios that map to
real server diagnostics.

Use `jsonnet/syntax_error.jsonnet` for parser error diagnostics and
`jsonnet/unused_variable.jsonnet` for lint warning diagnostics. Update
the diagnostics integration tests to target those files and remove the
old deprecated-field scenario fixtures.
Move the integration workspace root to `test-scenarios` and split
the former `basic` fixture tree into dedicated `commands`, `eval`,
`diagnostics`, and `importers` scenario directories.

Update integration tests to open files from their scenario
directories so fixtures are explicit per suite.

Adjust fake-jrsonnet-lsp scenario root discovery to detect the
nearest workspace that contains `.tools/fake-jrsonnet-lsp.js`,
which supports the new multi-scenario layout.

Add importer fixtures that model real transitive imports and update
the expected importer paths accordingly.
Refactor eval integration coverage into table-driven cases for JSON
and YAML file evaluation, and extract shared jsonnet-eval output
reading into a helper.

Refactor diagnostics integration coverage into table-driven cases and
remove length-based gating. Diagnostics now wait until the full
current array is deep-strict-equal to the expected scenario output.
Add scenario-backed integration coverage for hover, navigation,
rename, references, diagnostics matrix cases, formatting,
completion, signature help, inlay hints, eval runtime errors, and
Tanka mode detection.

Refactor suite utilities into reusable modules, add real-LSP race
coverage, and align fake-server expected file loading with the new
scenario layout.

Enforce deterministic harness defaults for binary paths and
auto-update settings while keeping per-test configuration in each
suite.
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.

1 participant