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.rs44
1 files changed, 15 insertions, 29 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index aecf09a6..a229f01e 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -1,7 +1,7 @@
use crate::{
align_view,
annotations::diagnostics::InlineDiagnostics,
- document::{DocumentColorSwatches, DocumentInlayHints},
+ document::DocumentInlayHints,
editor::{GutterConfig, GutterType},
graphics::Rect,
handlers::diagnostics::DiagnosticsHandler,
@@ -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,
@@ -474,23 +482,6 @@ impl View {
.add_inline_annotations(padding_after_inlay_hints, None);
};
let config = doc.config.load();
-
- if config.lsp.display_color_swatches {
- if let Some(DocumentColorSwatches {
- color_swatches,
- colors,
- color_swatches_padding,
- }) = &doc.color_swatches
- {
- for (color_swatch, color) in color_swatches.iter().zip(colors) {
- text_annotations
- .add_inline_annotations(std::slice::from_ref(color_swatch), Some(*color));
- }
-
- text_annotations.add_inline_annotations(color_swatches_padding, None);
- }
- }
-
let width = self.inner_width(doc);
let enable_cursor_line = self
.diagnostics_handler
@@ -691,7 +682,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 +702,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 +877,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 +907,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 +931,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 +1015,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);