mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
add find_syntax_by_name
This commit is contained in:
parent
ce8eac4f76
commit
e1c2ce176f
1 changed files with 4 additions and 0 deletions
|
|
@ -33,6 +33,10 @@ impl Syntax {
|
|||
alt: Option<&String>,
|
||||
) -> Result<Vec<(TextTag, String)>, Error> {
|
||||
if let Some(name) = alt {
|
||||
if let Some(reference) = self.syntax_set.find_syntax_by_name(name) {
|
||||
return self.syntect_buffer(source_code, source_tag, reference);
|
||||
}
|
||||
|
||||
if let Some(reference) = self.syntax_set.find_syntax_by_extension(name) {
|
||||
return self.syntect_buffer(source_code, source_tag, reference);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue