rust: Extract runtime language detection into separate crate

This patch adds a new `tree-sitter-loader` crate, which holds the CLI's
logic for finding and building local grammar definitions at runtime.
This allows other command-line tools to use this logic too!
This commit is contained in:
Douglas Creager 2021-06-09 12:51:28 -04:00
parent 162ce789bc
commit 66c30648c2
14 changed files with 117 additions and 62 deletions

View file

@ -1,5 +1,4 @@
use super::util;
use crate::loader::Loader;
use ansi_term::Color;
use anyhow::Result;
use lazy_static::lazy_static;
@ -12,6 +11,7 @@ use std::sync::atomic::AtomicUsize;
use std::time::Instant;
use std::{fs, io, path, str, usize};
use tree_sitter_highlight::{HighlightConfiguration, HighlightEvent, Highlighter, HtmlRenderer};
use tree_sitter_loader::Loader;
pub const HTML_HEADER: &'static str = "
<!doctype HTML>