Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/view.rs')
-rw-r--r--helix-view/src/view.rs25
1 files changed, 14 insertions, 11 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index aecf09a6..d6f10753 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -11,6 +11,7 @@ use crate::{
use helix_core::{
char_idx_at_visual_offset,
doc_formatter::TextFormat,
+ syntax::Highlight,
text_annotations::TextAnnotations,
visual_offset_from_anchor, visual_offset_from_block, Position, RopeSlice, Selection,
Transaction,
@@ -445,7 +446,9 @@ impl View {
let mut text_annotations = TextAnnotations::default();
if let Some(labels) = doc.jump_labels.get(&self.id) {
- let style = theme.and_then(|t| t.find_highlight("ui.virtual.jump-label"));
+ let style = theme
+ .and_then(|t| t.find_scope_index("ui.virtual.jump-label"))
+ .map(Highlight);
text_annotations.add_overlay(labels, style);
}
@@ -458,10 +461,15 @@ impl View {
padding_after_inlay_hints,
}) = doc.inlay_hints.get(&self.id)
{
- let type_style = theme.and_then(|t| t.find_highlight("ui.virtual.inlay-hint.type"));
- let parameter_style =
- theme.and_then(|t| t.find_highlight("ui.virtual.inlay-hint.parameter"));
- let other_style = theme.and_then(|t| t.find_highlight("ui.virtual.inlay-hint"));
+ let type_style = theme
+ .and_then(|t| t.find_scope_index("ui.virtual.inlay-hint.type"))
+ .map(Highlight);
+ let parameter_style = theme
+ .and_then(|t| t.find_scope_index("ui.virtual.inlay-hint.parameter"))
+ .map(Highlight);
+ let other_style = theme
+ .and_then(|t| t.find_scope_index("ui.virtual.inlay-hint"))
+ .map(Highlight);
// Overlapping annotations are ignored apart from the first so the order here is not random:
// types -> parameters -> others should hopefully be the "correct" order for most use cases,
@@ -691,7 +699,7 @@ mod tests {
use super::*;
use arc_swap::ArcSwap;
- use helix_core::{syntax, Rope};
+ use helix_core::Rope;
// 1 diagnostic + 1 spacer + 3 linenr (< 1000 lines) + 1 spacer + 1 diff
const DEFAULT_GUTTER_OFFSET: u16 = 7;
@@ -711,7 +719,6 @@ mod tests {
rope,
None,
Arc::new(ArcSwap::new(Arc::new(Config::default()))),
- Arc::new(ArcSwap::from_pointee(syntax::Loader::default())),
);
doc.ensure_view_init(view.id);
@@ -887,7 +894,6 @@ mod tests {
rope,
None,
Arc::new(ArcSwap::new(Arc::new(Config::default()))),
- Arc::new(ArcSwap::from_pointee(syntax::Loader::default())),
);
doc.ensure_view_init(view.id);
assert_eq!(
@@ -918,7 +924,6 @@ mod tests {
rope,
None,
Arc::new(ArcSwap::new(Arc::new(Config::default()))),
- Arc::new(ArcSwap::from_pointee(syntax::Loader::default())),
);
doc.ensure_view_init(view.id);
assert_eq!(
@@ -943,7 +948,6 @@ mod tests {
rope,
None,
Arc::new(ArcSwap::new(Arc::new(Config::default()))),
- Arc::new(ArcSwap::from_pointee(syntax::Loader::default())),
);
doc.ensure_view_init(view.id);
@@ -1028,7 +1032,6 @@ mod tests {
rope,
None,
Arc::new(ArcSwap::new(Arc::new(Config::default()))),
- Arc::new(ArcSwap::from_pointee(syntax::Loader::default())),
);
doc.ensure_view_init(view.id);