|
1 | 1 | use snippet::{Annotation, AnnotationType, Slice, Snippet}; |
2 | | - |
3 | | -pub struct DisplayList { |
4 | | - pub body: Vec<DisplayLine>, |
5 | | -} |
6 | | - |
7 | | -#[derive(Debug, Clone, PartialEq)] |
8 | | -pub enum DisplayLine { |
9 | | - Annotation { |
10 | | - label: Vec<DisplayTextFragment>, |
11 | | - id: Option<String>, |
12 | | - aligned: bool, |
13 | | - annotation_type: DisplayAnnotationType, |
14 | | - }, |
15 | | - Origin { |
16 | | - path: String, |
17 | | - pos: Option<(usize, usize)>, |
18 | | - header_type: DisplayHeaderType, |
19 | | - }, |
20 | | - EmptySource, |
21 | | - Source { |
22 | | - lineno: usize, |
23 | | - inline_marks: Vec<DisplayMark>, |
24 | | - content: String, |
25 | | - range: (usize, usize), |
26 | | - }, |
27 | | - SourceAnnotation { |
28 | | - inline_marks: Vec<DisplayMark>, |
29 | | - range: (usize, usize), |
30 | | - label: Vec<DisplayTextFragment>, |
31 | | - annotation_type: DisplayAnnotationType, |
32 | | - annotation_part: DisplayAnnotationPart, |
33 | | - }, |
34 | | - Fold { |
35 | | - inline_marks: Vec<DisplayMark>, |
36 | | - }, |
37 | | -} |
38 | | - |
39 | | -#[derive(Debug, Clone, PartialEq)] |
40 | | -pub struct DisplayTextFragment { |
41 | | - pub content: String, |
42 | | - pub style: DisplayTextStyle, |
43 | | -} |
44 | | - |
45 | | -#[derive(Debug, Clone, Copy, PartialEq)] |
46 | | -pub enum DisplayTextStyle { |
47 | | - Regular, |
48 | | - Emphasis, |
49 | | -} |
50 | | - |
51 | | -#[derive(Debug, Clone, PartialEq)] |
52 | | -pub enum DisplayAnnotationPart { |
53 | | - Singleline, |
54 | | - MultilineStart, |
55 | | - MultilineEnd, |
56 | | -} |
57 | | - |
58 | | -#[derive(Debug, Clone, PartialEq)] |
59 | | -pub struct DisplayMark { |
60 | | - pub mark_type: DisplayMarkType, |
61 | | - pub annotation_type: DisplayAnnotationType, |
62 | | -} |
63 | | - |
64 | | -#[derive(Debug, Clone, PartialEq)] |
65 | | -pub enum DisplayMarkType { |
66 | | - AnnotationThrough, |
67 | | - AnnotationStart, |
68 | | -} |
69 | | - |
70 | | -#[derive(Debug, Clone, PartialEq)] |
71 | | -pub enum DisplayAnnotationType { |
72 | | - Error, |
73 | | - Warning, |
74 | | - Info, |
75 | | - Note, |
76 | | - Help, |
77 | | -} |
78 | | - |
79 | | -#[derive(Debug, Clone, PartialEq)] |
80 | | -pub enum DisplayHeaderType { |
81 | | - Initial, |
82 | | - Continuation, |
83 | | -} |
84 | | - |
85 | | -// Formatting |
| 2 | +use super::*; |
86 | 3 |
|
87 | 4 | fn format_label(label: Option<&str>, style: Option<DisplayTextStyle>) -> Vec<DisplayTextFragment> { |
88 | 5 | let mut result = vec![]; |
|
0 commit comments