package grace
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A fancy diagnostics library that allows your compilers to exit with grace
Install
dune-project
Dependency
Authors
Maintainers
Sources
grace-0.3.0.tbz
sha256=6948979d6ffb5e596773baead81e9ceef36726d6956261bdd62abb2666a45bfc
sha512=db8b39cc9a77d919ab3123bb4047bb6c672c61db9fc6810951e267b2b113c4ac07266ef57188c6db0c02cb4d43d054204cd66ebc91648dbd1da1228022b0e67b
doc/src/grace.ansi_renderer/config.ml.html
Source file config.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178open! Import open Diagnostic module Style_sheet = struct type style = Fmt.style list let not_color : Fmt.style -> bool = function | `None | `Bold | `Faint | `Italic | `Underline | `Reverse -> true | _ -> false ;; let no_color_style = List.filter ~f:not_color type t = { header_bug : style ; header_error : style ; header_warning : style ; header_note : style ; header_help : style ; header_message : style ; primary_label_bug : style ; primary_label_error : style ; primary_label_warning : style ; primary_label_note : style ; primary_label_help : style ; secondary_label : style ; line_number : style ; source_border : style ; note_bullet : style } let map t ~f = { header_bug = f t.header_bug ; header_error = f t.header_error ; header_warning = f t.header_warning ; header_note = f t.header_note ; header_help = f t.header_help ; header_message = f t.header_message ; primary_label_bug = f t.primary_label_bug ; primary_label_error = f t.primary_label_error ; primary_label_warning = f t.primary_label_warning ; primary_label_note = f t.primary_label_note ; primary_label_help = f t.primary_label_help ; secondary_label = f t.secondary_label ; line_number = f t.line_number ; source_border = f t.source_border ; note_bullet = f t.note_bullet } ;; let no_color t = map t ~f:no_color_style let default = let header color = [ `Bold; `Fg (`Hi color) ] in let primary_label color = [ `Fg color ] in { header_bug = header `Red ; header_error = header `Red ; header_warning = header `Yellow ; header_note = header `Green ; header_help = header `Cyan ; header_message = [ `Bold ] ; primary_label_bug = primary_label `Red ; primary_label_error = primary_label `Red ; primary_label_warning = primary_label `Yellow ; primary_label_note = primary_label `Green ; primary_label_help = primary_label `Cyan ; secondary_label = [ `Fg `Cyan ] ; line_number = [ `Fg `Cyan ] ; source_border = [ `Fg `Cyan ] ; note_bullet = [ `Fg `Cyan ] } ;; let header config (severity : Severity.t) = match severity with | Bug -> config.header_bug | Error -> config.header_error | Warning -> config.header_warning | Note -> config.header_note | Help -> config.header_help ;; let label config (priority : Priority.t) (severity : Severity.t) = match priority, severity with | Primary, Bug -> config.primary_label_bug | Primary, Error -> config.primary_label_error | Primary, Warning -> config.primary_label_warning | Primary, Note -> config.primary_label_note | Primary, Help -> config.primary_label_help | Secondary, _ -> config.secondary_label ;; end module Chars = struct type t = { snippet_start : string ; source_border_left : string ; source_border_left_break : string ; note_bullet : string ; single_primary_caret : string ; single_secondary_caret : string ; multi_primary_caret_start : string ; multi_primary_caret_end : string ; multi_secondary_caret_start : string ; multi_secondary_caret_end : string ; multi_top_left : string ; multi_top : string ; multi_bottom_left : string ; multi_bottom : string ; multi_left : string ; pointer_left : string } let ascii = { snippet_start = "-->" ; source_border_left = "|" ; source_border_left_break = "." ; note_bullet = "=" ; single_primary_caret = "^" ; single_secondary_caret = "-" ; multi_primary_caret_start = "^" ; multi_primary_caret_end = "^" ; multi_secondary_caret_start = "\'" ; multi_secondary_caret_end = "\'" ; multi_top_left = "/" ; multi_top = "-" ; multi_bottom_left = "\\" ; multi_bottom = "-" ; multi_left = "|" ; pointer_left = "|" } ;; let unicode = { snippet_start = "┌─" ; source_border_left = "│" ; source_border_left_break = "·" ; note_bullet = "=" ; single_primary_caret = "^" ; single_secondary_caret = "-" ; multi_primary_caret_start = "^" ; multi_primary_caret_end = "^" ; multi_secondary_caret_start = "\'" ; multi_secondary_caret_end = "\'" ; multi_top_left = "╭" ; multi_top = "─" ; multi_bottom_left = "╰" ; multi_bottom = "─" ; multi_left = "│" ; pointer_left = "│" } ;; end type t = { chars : Chars.t ; styles : Style_sheet.t ; use_ansi : bool option } let no_color = match Sys.getenv "NO_COLOR" with | exception Not_found -> false | "" -> false | _ -> true ;; let style_renderer t = t.use_ansi |> Option.map (function | true -> `Ansi_tty | false -> `None) ;; let default = let styles = if no_color then Style_sheet.(no_color default) else Style_sheet.default in { chars = Chars.unicode; styles; use_ansi = None } ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>