equal
deleted
inserted
replaced
21 |
21 |
22 private def color_decorations(prefix: String, types: Set[Rendering.Color.Value], |
22 private def color_decorations(prefix: String, types: Set[Rendering.Color.Value], |
23 colors: List[Text.Info[Rendering.Color.Value]]): List[VSCode_Model.Decoration] = |
23 colors: List[Text.Info[Rendering.Color.Value]]): List[VSCode_Model.Decoration] = |
24 { |
24 { |
25 val color_ranges = |
25 val color_ranges = |
26 (Map.empty[Rendering.Color.Value, List[Text.Range]] /: colors) { |
26 colors.foldLeft(Map.empty[Rendering.Color.Value, List[Text.Range]]) { |
27 case (m, Text.Info(range, c)) => m + (c -> (range :: m.getOrElse(c, Nil))) |
27 case (m, Text.Info(range, c)) => m + (c -> (range :: m.getOrElse(c, Nil))) |
28 } |
28 } |
29 types.toList.map(c => |
29 types.toList.map(c => |
30 VSCode_Model.Decoration.ranges(prefix + c.toString, color_ranges.getOrElse(c, Nil).reverse)) |
30 VSCode_Model.Decoration.ranges(prefix + c.toString, color_ranges.getOrElse(c, Nil).reverse)) |
31 } |
31 } |
322 val iterator = |
322 val iterator = |
323 for { |
323 for { |
324 Text.Info(entry_range, (entry, model)) <- bibtex_entries_iterator() |
324 Text.Info(entry_range, (entry, model)) <- bibtex_entries_iterator() |
325 if entry == name |
325 if entry == name |
326 } yield Line.Node_Range(model.node_name.node, model.content.doc.range(entry_range)) |
326 } yield Line.Node_Range(model.node_name.node, model.content.doc.range(entry_range)) |
327 if (iterator.isEmpty) None else Some((links /: iterator)(_ :+ _)) |
327 if (iterator.isEmpty) None else Some(iterator.foldLeft(links)(_ :+ _)) |
328 |
328 |
329 case _ => None |
329 case _ => None |
330 }) match { case Text.Info(_, links) :: _ => links.reverse case _ => Nil } |
330 }) match { case Text.Info(_, links) :: _ => links.reverse case _ => Nil } |
331 } |
331 } |
332 } |
332 } |