Skip to main content

Module language

Module language 

Source
Expand description

Language identification for files.

Provides LanguageId — a lightweight newtype over Cow<'static, str> — and detect_language, which maps a file path to a language using first the file extension then a mime-type fallback via mime_guess.

Built-in IDs match the LSP languageId convention (lowercase, e.g. “rust”, “cpp”). Using Cow keeps zero-allocation for the built-in static strings while allowing owned Strings for future config-driven mappings.

Structs§

LanguageId
A language identifier string (e.g. "rust", "cpp", "python").

Functions§

detect_language
Detect the language of a file from its path.