Skip to content

Reload placeholder: remaining reader gaps after #923 #1142

Description

@atusy

Follow-up to #923 (PR fixing it: see linked PR). That PR gave the settings-reload placeholder provenance (ParseSnapshot::awaiting_reparse) and made selectionRange, formatting and rangeFormatting wait past it. Other readers were audited and intentionally left accepting the placeholder. These related gaps remain. Each is pre-existing or best-effort, not a regression:

  1. The reparse is scheduled late. apply_shared_settings_locked (src/lsp/lsp_impl.rs) invalidates documents and then awaits bridge.propagate_settings. Only after that does it return reparse_uris for scheduling. The placeholder window therefore includes the propagation time, and the 500 ms explicit-action wait can expire before the reparse is even queued. Consider scheduling the reparses right after drop(parser_reload).
  2. formatting skips the host layer without a tree. formatting_impl returns Ok(None) when doc.snapshot() is None, before the host layer runs, even though the host formatter needs only text. rangeFormatting gates only its virtual layer on the snapshot.
  3. rename/prepareRename don't get the explicit-action wait. The parse-snapshot ADR lists them as explicit actions with that wait. In the code they go through resolve_bridge_contexts → ensure_document_parsed, a 200 ms wait that accepts the placeholder.
  4. Pull diagnostics can miss the reload. A virt-layer pull that lands on the placeholder records degraded-pull debt only when region slots or a pull layer are already cached. So a reload that newly enables an injected pull-only server may not be re-driven after the reparse. The comment at lsp_impl.rs ("the re-pull waits for the reparse") is not accurate for the virt layer.
  5. Highlighting flashes on reload. The reload's semantic-tokens refresh lands on the placeholder, which serves empty tokens. The settle refresh repaints them, at the cost of a second refresh. captures/full answers null immediately.
  6. Test gap: the resolve_reload_placeholder calls on reparse_latest's language-load-failure exit and final no-tree exit have no test. There is no hermetic way to force a tree-less parse for a detected language.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions