Skip to content

Cover the four remaining language-server handlers - #71

Merged
74nu5 merged 1 commit into
mainfrom
test/lsp-handlers-rest
Jul 19, 2026
Merged

Cover the four remaining language-server handlers#71
74nu5 merged 1 commit into
mainfrom
test/lsp-handlers-rest

Conversation

@74nu5

@74nu5 74nu5 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Definition, document symbols, synchronisation de document et fichiers surveillés n'avaient aucun test direct. Les cinq gestionnaires sont désormais couverts.

Definition et Document Symbol

« Aller à la définition » résout l'usage d'une variable vers sa déclaration, ne renvoie rien sur ce qui n'est pas une variable, et dégrade sur un URI jamais ouvert.

L'outline liste le bloc settings, les environnements et les variables, et exclut les symboles venant d'un fichier inclus — les instructions incluses sont fusionnées dans le même AST, donc sans vérification de fichier elles apparaissaient dans l'outline, à des numéros de ligne appartenant à un autre fichier.

Les deux gestionnaires de notification

Ils publient au lieu de retourner : ce qu'ils font n'est visible qu'à travers la façade. RecordingLanguageServer la remplace et capture chaque publication avec son URI et son nombre de diagnostics.

Tout autre canal lève — un gestionnaire qui se mettrait à en utiliser un échoue bruyamment ici plutôt que de passer en silence.

Les tests épinglent : didOpen publie ; didChange republie avec les nouveaux diagnostics ; didClose efface les diagnostics du fichier fermé en dernier — l'ordre corrigé plus tôt, que rien ne vérifiait ; un changement de fichier surveillé republie les documents qui l'incluent, et un fichier que personne n'inclut ne publie rien.

Sur la construction du double

Deux tentatives, et ça mérite d'être noté : PublishDiagnostics passe par la surcharge non générique SendNotification(IRequest), pas par la générique. La première version n'enregistrait donc rien et les cinq tests rapportaient « 0 publié ».

C'était l'échec du double, pas des gestionnaires — le genre de faux négatif qui aurait pu me faire conclure que le code était cassé.

398 → 409 tests.

🤖 Generated with Claude Code

Definition, document symbols, document synchronisation and watched files had no
direct tests. All five handlers are covered now.

Go-to-definition resolves a variable use to its declaration, returns nothing for
something that is not a variable, and degrades on a URI the server never opened.
The outline lists the settings block, environments and variables, and excludes
symbols coming from an included file — included statements are merged into the
same AST, so without a file check they appeared in the outline at line numbers
belonging to another file.

The two notification handlers publish rather than return, so what they do is only
visible through the facade. RecordingLanguageServer stands in for it and captures
each publish with its URI and diagnostic count; every other channel throws, so a
handler that starts using one fails loudly here instead of passing silently. The
tests pin that didOpen publishes, that didChange republishes with the new
diagnostics, that didClose clears the closed document's diagnostics last — the
ordering fixed earlier, which nothing had verified — and that a watched-file
change republishes the documents that include it while a file nobody includes
publishes nothing.

Building the stand-in took two attempts worth recording: PublishDiagnostics routes
through the non-generic SendNotification(IRequest) overload, not the generic one,
so the first version recorded nothing and every test reported zero published. That
failure was the stub's, not the handlers'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@74nu5
74nu5 merged commit 3bfbf2e into main Jul 19, 2026
3 checks passed
@74nu5
74nu5 deleted the test/lsp-handlers-rest branch July 19, 2026 20:46
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