replace find_syntax_by_extension with find_syntax_by_token

This commit is contained in:
yggverse 2024-12-03 04:11:44 +02:00
parent 3bbeab5713
commit 15a63a21c9

View File

@ -32,12 +32,12 @@ impl Syntax {
source_tag: &TextTag, source_tag: &TextTag,
alt: Option<&String>, alt: Option<&String>,
) -> Result<Vec<(TextTag, String)>, Error> { ) -> Result<Vec<(TextTag, String)>, Error> {
if let Some(name) = alt { if let Some(value) = alt {
if let Some(reference) = self.syntax_set.find_syntax_by_name(name) { if let Some(reference) = self.syntax_set.find_syntax_by_name(value) {
return self.syntect_buffer(source_code, source_tag, reference); return self.syntect_buffer(source_code, source_tag, reference);
} }
if let Some(reference) = self.syntax_set.find_syntax_by_extension(name) { if let Some(reference) = self.syntax_set.find_syntax_by_token(value) {
return self.syntect_buffer(source_code, source_tag, reference); return self.syntect_buffer(source_code, source_tag, reference);
} }
} }