Get new theme structure working
* Fix precedence of extends directives * Always group color with font properties for text theming Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
parent
5761756fb4
commit
802f1f4e78
@@ -654,16 +654,8 @@ mod tests {
|
||||
.unwrap();
|
||||
let theme = Theme {
|
||||
syntax: vec![
|
||||
(
|
||||
"mod.body".to_string(),
|
||||
Color::from_u32(0xff0000ff),
|
||||
Default::default(),
|
||||
),
|
||||
(
|
||||
"fn.name".to_string(),
|
||||
Color::from_u32(0x00ff00ff),
|
||||
Default::default(),
|
||||
),
|
||||
("mod.body".to_string(), Color::from_u32(0xff0000ff).into()),
|
||||
("fn.name".to_string(), Color::from_u32(0x00ff00ff).into()),
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
@@ -676,7 +668,7 @@ mod tests {
|
||||
grammar: grammar.clone(),
|
||||
highlight_query,
|
||||
brackets_query: tree_sitter::Query::new(grammar, "").unwrap(),
|
||||
theme_mapping: Default::default(),
|
||||
highlight_map: Default::default(),
|
||||
});
|
||||
lang.set_theme(&theme);
|
||||
|
||||
@@ -752,16 +744,8 @@ mod tests {
|
||||
.unwrap();
|
||||
let theme = Theme {
|
||||
syntax: vec![
|
||||
(
|
||||
"mod.body".to_string(),
|
||||
Color::from_u32(0xff0000ff),
|
||||
Default::default(),
|
||||
),
|
||||
(
|
||||
"fn.name".to_string(),
|
||||
Color::from_u32(0x00ff00ff),
|
||||
Default::default(),
|
||||
),
|
||||
("mod.body".to_string(), Color::from_u32(0xff0000ff).into()),
|
||||
("fn.name".to_string(), Color::from_u32(0x00ff00ff).into()),
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
@@ -774,7 +758,7 @@ mod tests {
|
||||
grammar: grammar.clone(),
|
||||
highlight_query,
|
||||
brackets_query: tree_sitter::Query::new(grammar, "").unwrap(),
|
||||
theme_mapping: Default::default(),
|
||||
highlight_map: Default::default(),
|
||||
});
|
||||
lang.set_theme(&theme);
|
||||
|
||||
@@ -953,7 +937,7 @@ mod tests {
|
||||
let mut snapshot = map.update(cx, |map, cx| map.snapshot(cx));
|
||||
let mut chunks: Vec<(String, Option<&str>)> = Vec::new();
|
||||
for (chunk, style_id) in snapshot.highlighted_chunks_for_rows(rows) {
|
||||
let style_name = theme.syntax_style_name(style_id);
|
||||
let style_name = theme.highlight_name(style_id);
|
||||
if let Some((last_chunk, last_style_name)) = chunks.last_mut() {
|
||||
if style_name == *last_style_name {
|
||||
last_chunk.push_str(chunk);
|
||||
|
||||
Reference in New Issue
Block a user