Skip to main content

major_mode_id_for_buffer_kind

Function major_mode_id_for_buffer_kind 

Source
pub fn major_mode_id_for_buffer_kind(
    registry: &ModeRegistry,
    kind: BufferKind,
) -> Option<ModeId>
Expand description

Resolve the default major-mode id for a BufferKind via the registry’s kind index (H.2).

Document returns None because the mode is determined by language detection (see lattice_syntax::major_mode_id_for_lang); when the language detection returns Lang::Plain the caller falls back further to text-mode.

All other kinds dispatch through ModeRegistry::find_major_for_kind: each major mode (FileTreeMode, OilMode, MarkdownMode for Help, MessagesMode, TerminalMode, future plugin-defined majors) declares its target kind via [Mode::target_buffer_kind] and the registry indexes them at register-time. Adding a new kind-bound major requires zero host-side hand edits — register the mode and the index picks it up.