Skip to content

Dynamic registrations that the server withdraws while LSP4IJ installs them can stay installed, or remove what a registration again of their id installed #2273

Done

Description

@lagergren

A language server can withdraw a dynamic registration (client/unregisterCapability) while LSP4IJ is still installing it, from the batch of a client/registerCapability request, and then register the same id again. LSP4IJ didn't handle these overlaps.

What went wrong

  • Withdrawn before it's installed: the registration was installed anyway, and stayed with no way for the server to remove it.
  • Withdrawn while it's installed: what it installed stayed after its installation ended.
  • Registered again with the same id meanwhile: the late end of the withdrawn installation could remove, or replace, what the later registration had installed:
    • workspace/didChangeWatchedFiles: the watchers are registered by id, so the withdrawn registration's cleanup removed the later registration's watchers. If it added its own watchers late, they replaced the later ones, and its cleanup then left the later registration with none. File changes then no longer reached the server until it registered its watchers again or restarted.
    • workspace/executeCommand: the cleanup's removeAll dropped the later registration's copy of the same command. With assertions on, the later registration wasn't installed at all.
    • workspace/didChangeWorkspaceFolders: the later registration was ignored as "already enabled", and the withdrawn one then turned the workspace folders off.

Expected

A withdrawn registration installs nothing, or only until its installation ends. Its cleanup removes only what it added itself. A later registration of the same id keeps what it installed.

These are found and fixed in #2254, whose tests reproduce each case.

Activity

  1. added this to the 0.30.2 milestone on Nov 25, 2026
  2. added
    bug
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions