mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
Render ellipses in a different color
This commit is contained in:
parent
d9a582e447
commit
92f94a00b4
@ -3701,7 +3701,9 @@ mod report_text {
|
||||
if fields_ommitted == 0 {
|
||||
alloc.text("{}")
|
||||
} else {
|
||||
alloc.text("{ … }")
|
||||
alloc
|
||||
.text("{ ")
|
||||
.append(alloc.ellipsis().append(alloc.text(" }")))
|
||||
}
|
||||
.append(ext_doc)
|
||||
} else if entries.len() == 1 && fields_ommitted == 0 {
|
||||
@ -3715,7 +3717,7 @@ mod report_text {
|
||||
alloc.reflow("}")
|
||||
} else {
|
||||
alloc.vcat([
|
||||
alloc.text("…").indent(super::RECORD_FIELD_INDENT),
|
||||
alloc.ellipsis().indent(super::RECORD_FIELD_INDENT),
|
||||
alloc.reflow("}"),
|
||||
])
|
||||
};
|
||||
|
@ -183,6 +183,7 @@ pub struct Palette {
|
||||
pub primary: &'static str,
|
||||
pub code_block: &'static str,
|
||||
pub keyword: &'static str,
|
||||
pub ellipsis: &'static str,
|
||||
pub variable: &'static str,
|
||||
pub type_variable: &'static str,
|
||||
pub structure: &'static str,
|
||||
@ -209,6 +210,7 @@ const fn default_palette_from_style_codes(codes: StyleCodes) -> Palette {
|
||||
primary: codes.white,
|
||||
code_block: codes.white,
|
||||
keyword: codes.green,
|
||||
ellipsis: codes.green,
|
||||
variable: codes.blue,
|
||||
type_variable: codes.yellow,
|
||||
structure: codes.green,
|
||||
@ -359,6 +361,10 @@ impl<'a> RocDocAllocator<'a> {
|
||||
self.text(string).annotate(Annotation::Keyword)
|
||||
}
|
||||
|
||||
pub fn ellipsis(&'a self) -> DocBuilder<'a, Self, Annotation> {
|
||||
self.text("…").annotate(Annotation::Ellipsis)
|
||||
}
|
||||
|
||||
pub fn parser_suggestion(&'a self, string: &'a str) -> DocBuilder<'a, Self, Annotation> {
|
||||
self.text(string).annotate(Annotation::ParserSuggestion)
|
||||
}
|
||||
@ -811,6 +817,7 @@ pub enum Annotation {
|
||||
Emphasized,
|
||||
Url,
|
||||
Keyword,
|
||||
Ellipsis,
|
||||
Tag,
|
||||
RecordField,
|
||||
TypeVariable,
|
||||
@ -1009,6 +1016,9 @@ where
|
||||
Keyword => {
|
||||
self.write_str(self.palette.keyword)?;
|
||||
}
|
||||
Ellipsis => {
|
||||
self.write_str(self.palette.ellipsis)?;
|
||||
}
|
||||
GutterBar => {
|
||||
self.write_str(self.palette.gutter_bar)?;
|
||||
}
|
||||
@ -1049,8 +1059,8 @@ where
|
||||
None => {}
|
||||
Some(annotation) => match annotation {
|
||||
Emphasized | Url | TypeVariable | Alias | Symbol | BinOp | Error | GutterBar
|
||||
| Typo | TypoSuggestion | ParserSuggestion | Structure | CodeBlock | PlainText
|
||||
| LineNumber | Tip | Module | Header | Keyword => {
|
||||
| Ellipsis | Typo | TypoSuggestion | ParserSuggestion | Structure | CodeBlock
|
||||
| PlainText | LineNumber | Tip | Module | Header | Keyword => {
|
||||
self.write_str(self.palette.reset)?;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user