Skip to main content

language_for_path

Function language_for_path 

Source
pub fn language_for_path(path: &str) -> &str
Expand description

Returns the language identifier for syntax highlighting based on a file path.

Filenames whose extension alone points to the wrong language (e.g. CMakeLists.txt) are looked up by name first. Otherwise the file extension is used when present; extensionless filenames (e.g. Dockerfile, Makefile) are looked up by name.