mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
add find_syntax_by_name
This commit is contained in:
parent
ce8eac4f76
commit
e1c2ce176f
@ -33,6 +33,10 @@ impl Syntax {
|
|||||||
alt: Option<&String>,
|
alt: Option<&String>,
|
||||||
) -> Result<Vec<(TextTag, String)>, Error> {
|
) -> Result<Vec<(TextTag, String)>, Error> {
|
||||||
if let Some(name) = alt {
|
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) {
|
if let Some(reference) = self.syntax_set.find_syntax_by_extension(name) {
|
||||||
return self.syntect_buffer(source_code, source_tag, reference);
|
return self.syntect_buffer(source_code, source_tag, reference);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user