Repository navigation
Conversation
symbol_names() and type_names() iterated a HashMap, so completion results (and glob imports) came out in a different order on every run.
Split rue-lsp into a library and a thin binary so the Backend can be tested, and add tests covering hover, go to definition, references, completion, diagnostics, formatting, and an end-to-end JSON-RPC session. Fix crashes found along the way: - Completion at the start of a file underflowed when checking the previous character. - on_change panicked on non-file URIs, invalid Rue.toml files, and missing entrypoints.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #63
Summary
rue-lspis now a library (Backend) plus a small binary that runs it over stdio, so the server can be tested.src/tests/mod.rs). It writes a temporary project to disk, opens each file in the server, and records the cursor from a$0marker. Results are rendered as text and compared withexpect-testsnapshots.document_endwith CRLF and UTF-16, andfuzzy_matchLspServiceThe snapshots record how the server behaves today, so later refactors will show up as snapshot diffs.
Fixes found by the tests
index - 1underflow).on_changepanicked on non-file URIs, invalidRue.tomlfiles, and missing entrypoints. It now returns no diagnostics in those cases.Scope::symbol_names()/type_names()iterated aHashMap, so completion order was different on every run. They now useIndexMap(insertion order).Behaviour the snapshots record but this PR doesn't change
{unresolved}as their type in completions.let name: type....rest: Listinstead ofList<Int>.fn main(value: $0)).Test plan
cargo test --workspace --all-featurescargo clippy --workspace --all-features --all-targets(no warnings)cargo fmt --check,cargo macheteNote
Low Risk
Mostly test infrastructure and defensive error handling in the LSP; no security or data-path changes, with small behavior fixes for panics and completion ordering.
Overview
Adds a broad LSP test suite by turning
rue-lspinto a library + thin stdio binary:Backendand server logic live inlib.rs, andmain.rsonly wires upLspService.Introduces a
TestProjectharness (tempRue.tomlproject,$0cursor markers,expect-testsnapshots) plus JSON-RPC end-to-end coverage viaLspService. Tests lock in hover, go-to-definition/references, completion, diagnostics, formatting, and protocol behavior.Production fixes bundled with the tests: completion no longer uses
index - 1(avoids panics at BOF);on_change_implreturns empty diagnostics instead of panicking on non-file URIs, bad manifests, or failed compiles;Scopesymbol/type name maps useIndexMapso completion order is stable across runs.Reviewed by Cursor Bugbot for commit 7b97d26. Bugbot is set up for automated code reviews on this repo. Configure here.