Skip to content

Commit 9dfd03e

Browse files
committed
highlight: Sipmlify injection API w/ new injection.combined property
1 parent f374786 commit 9dfd03e

File tree

3 files changed

+238
-195
lines changed

3 files changed

+238
-195
lines changed

cli/benches/benchmark.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ lazy_static! {
1717
static ref REPETITION_COUNT: usize = env::var("TREE_SITTER_BENCHMARK_REPETITION_COUNT")
1818
.map(|s| usize::from_str_radix(&s, 10).unwrap())
1919
.unwrap_or(5);
20-
2120
static ref TEST_LOADER: Loader = Loader::new(SCRATCH_DIR.clone());
2221
static ref EXAMPLE_PATHS_BY_LANGUAGE_DIR: BTreeMap<PathBuf, Vec<PathBuf>> = {
2322
fn process_dir(result: &mut BTreeMap<PathBuf, Vec<PathBuf>>, dir: &Path) {
@@ -137,7 +136,7 @@ fn main() {
137136
eprintln!("");
138137
}
139138

140-
fn aggregate(speeds: &Vec<(usize)>) -> Option<(usize, usize)> {
139+
fn aggregate(speeds: &Vec<usize>) -> Option<(usize, usize)> {
141140
if speeds.is_empty() {
142141
return None;
143142
}

cli/src/tests/highlight_test.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ fn test_highlighting_empty_lines() {
317317
}
318318

319319
#[test]
320-
fn test_highlighting_ejs() {
321-
let source = vec!["<div><% foo() %></div>"].join("\n");
320+
fn test_highlighting_ejs_with_html_and_javascript() {
321+
let source = vec!["<div><% foo() %></div><script> bar() </script>"].join("\n");
322322

323323
assert_eq!(
324324
&to_token_vector(&source, &EJS_HIGHLIGHT).unwrap(),
@@ -335,7 +335,18 @@ fn test_highlighting_ejs() {
335335
("%>", vec!["keyword"]),
336336
("</", vec!["punctuation.bracket"]),
337337
("div", vec!["tag"]),
338-
(">", vec!["punctuation.bracket"])
338+
(">", vec!["punctuation.bracket"]),
339+
("<", vec!["punctuation.bracket"]),
340+
("script", vec!["tag"]),
341+
(">", vec!["punctuation.bracket"]),
342+
(" ", vec![]),
343+
("bar", vec!["function"]),
344+
("(", vec!["punctuation.bracket"]),
345+
(")", vec!["punctuation.bracket"]),
346+
(" ", vec![]),
347+
("</", vec!["punctuation.bracket"]),
348+
("script", vec!["tag"]),
349+
(">", vec!["punctuation.bracket"]),
339350
]],
340351
);
341352
}

0 commit comments

Comments
 (0)