pub enum Language {
Show 18 variants
Rust,
Python,
JavaScript,
TypeScript,
HTML,
CSS,
C,
Cpp,
Go,
Json,
Java,
CSharp,
Php,
Ruby,
Bash,
Lua,
Pascal,
Odin,
}Expand description
Language configuration for syntax highlighting
Variants§
Implementations§
Source§impl Language
impl Language
Sourcepub fn highlight_config(&self) -> Result<HighlightConfiguration, String>
pub fn highlight_config(&self) -> Result<HighlightConfiguration, String>
Get tree-sitter highlight configuration for this language
Sourcepub fn highlight_category(&self, index: usize) -> Option<HighlightCategory>
pub fn highlight_category(&self, index: usize) -> Option<HighlightCategory>
Map tree-sitter highlight index to a highlight category
Source§impl Language
impl Language
Sourcepub fn id(&self) -> &'static str
pub fn id(&self) -> &'static str
Returns the language ID (lowercase identifier used in config/internal)
Sourcepub fn display_name(&self) -> &'static str
pub fn display_name(&self) -> &'static str
Returns the human-readable display name
Sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
Try to map a syntect syntax name to a tree-sitter Language.
This is used to get tree-sitter features (indentation, semantic highlighting) when using a syntect grammar for syntax highlighting. This is best-effort since tree-sitter only supports ~18 languages while syntect supports 100+.
Syntect uses names like “Rust”, “Python”, “JavaScript”, “JSON”, “C++”, “C#”, “Bourne Again Shell (bash)”, etc.
Trait Implementations§
impl Copy for Language
impl Eq for Language
impl StructuralPartialEq for Language
Auto Trait Implementations§
impl Freeze for Language
impl RefUnwindSafe for Language
impl Send for Language
impl Sync for Language
impl Unpin for Language
impl UnwindSafe for Language
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more