Expand description
ServiceRegistry: typed lookup for subsystem handles that
modes need access to from their lifecycle hooks (Phase 3 of
the mode-architecture ModeContext extension).
Used by lsp-mode: its on_deactivate needs the LSP
supervisor handle to send textDocument/didClose, plus a
buffer-id โ URI resolver to know which URI to close. The
App registers these at boot via ServiceRegistry::register;
modes pull them at activation/deactivation via
crate::ModeContext::service.
Why typed (not enum / not free-form Any): subsystem handles
are stable across renderers. A TUI host and a future GPUI
host register the same LspSupervisorHandle type; modes pull
by type without caring which host installed it. Adding a new
service is one register::<NewService>(...) call at boot
plus a ctx.service::<NewService>() consumption โ no enum
to extend, no breaking change to the trait surface.
Structsยง
- Service
Registry - Typed map keyed by
TypeId. StoresArc<dyn Any + Send + Sync>per slot; clones on lookup (cheap โ services areArcinternally). Built at boot, read-only thereafter.