Skip to content

Commit

Permalink
fix(Tty): move the optional argument "marker"
Browse files Browse the repository at this point in the history
  • Loading branch information
favonia committed Oct 31, 2024
1 parent 940b474 commit 566cbe9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/tty/Tty.ml
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ end

module Make (Message : Minimum_signatures.Message) =
struct
let display ?(output=Stdlib.stdout) ?use_ansi ?use_color ?(show_backtrace=true) ?(marker=default_marker)
?(line_breaks=`Traditional) ?(block_splitting_threshold=5) ?(tab_size=8) ?(debug=false) d =
let display ?(output=Stdlib.stdout) ?use_ansi ?use_color ?(show_backtrace=true)
?(line_breaks=`Traditional) ?(block_splitting_threshold=5)
?(marker=default_marker) ?(tab_size=8) ?(debug=false) d =
let d = if show_backtrace then d else {d with Diagnostic.backtrace = Emp} in
let d = Diagnostic.map Message.short_code d in
let ansi = Ansi.Test.guess ?use_ansi ?use_color output in
Expand Down
4 changes: 2 additions & 2 deletions src/tty/Tty.mli
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ module Make (Message : Minimum_signatures.Message) : sig
@param use_ansi Whether to use ANSI escape sequences, overriding auto-detection. ANSI escape sequences are used for coloring and styling the output. By default, auto-detection checks if the [output] is a TTY and if the environment variable [TERM] is set to a non-empty value other than [dumb].
@param use_color Whether to use colors when ANSI escape sequences are used, overriding auto-detection. By default, auto-detection will disable colors if ANSI escape sequences are not used or if the environment variable [NO_COLOR] is set to a non-empty value. Note that even when colors are disabled, the handler may still use bold, faint, and underline styles for highlighting if ANSI escape sequences are used. It is an error to explicitly set [use_color] to [true] and [use_ansi] to [false].
@param show_backtrace Whether the backtrace should be shown. The default is [true].
@param marker A function that displays marks as strings. It takes the final values of [use_ansi] and [use_color], the target message the mark belongs to, and whether the mark indicates the start or end of a range or the location of a point. See {!type:marker} for more details. The default value is {!val:default_marker}.
@param line_breaks The set of character sequences that are recognized as (hard) line breaks. The [`Unicode] set contains all Unicode character sequences in {{:https://www.unicode.org/versions/Unicode15.0.0/ch05.pdf#G41643}Unicode 15.0.0 Table 5-1.} The [`Traditional] set only contains [U+000A (LF)], [U+000D (CR)], and [U+000D U+000A (CRLF)] as line breaks. The default is the [`Traditional] set.
@param block_splitting_threshold The maximum number of consecutive, non-highlighted lines allowed in a block. The function will try to minimize the number of blocks, as long as no block has too many consecutive, non-highlighted lines. A higher threshold will lead to fewer blocks. When the threshold is zero, it means no block can contain any non-highlighted line. The default value is [5].
@param marker A function that displays marks as strings. It takes the final values of [use_ansi] and [use_color], the target message the mark belongs to, and whether the mark indicates the start or end of a range or the location of a point. See {!type:marker} for more details. The default value is {!val:default_marker}.
@param tab_size The number of spaces that should be used to replace a horizontal tab. Note that a horizontal tab is always expanded to the same number of spaces. The result should still be visually appealing as long as horizontal tabs are only used at the beginning of lines. The default value is [8].
@param debug Whether to enable the debug mode that performs expensive extra checking. The default is [false].
Expand All @@ -62,5 +62,5 @@ module Make (Message : Minimum_signatures.Message) : sig
@before 0.4.0 The optional parameter [marker] was not present, and angle quotation marks were not used even when ANSI escape sequences are not used.
@see <https://no-color.org/> for the [NO_COLOR] specification
*)
val display : ?output:out_channel -> ?use_ansi:bool -> ?use_color:bool -> ?show_backtrace:bool -> ?marker:marker -> ?line_breaks:[`Unicode | `Traditional] -> ?block_splitting_threshold:int -> ?tab_size:int -> ?debug:bool -> Message.t Diagnostic.t -> unit
val display : ?output:out_channel -> ?use_ansi:bool -> ?use_color:bool -> ?show_backtrace:bool -> ?line_breaks:[`Unicode | `Traditional] -> ?block_splitting_threshold:int -> ?marker:marker -> ?tab_size:int -> ?debug:bool -> Message.t Diagnostic.t -> unit
end

0 comments on commit 566cbe9

Please sign in to comment.