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