mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Extract pretty from the extension.
This commit is contained in:
parent
d3b27cfba4
commit
2ef4ca02a1
@ -118,18 +118,18 @@ func fits(w: Int, _ x: Doc) -> Bool {
|
||||
}
|
||||
}
|
||||
|
||||
func pretty(w: Int, _ doc: DOC) -> String {
|
||||
return best(w, 0, doc).description
|
||||
}
|
||||
|
||||
|
||||
public protocol CustomDocConvertible: CustomStringConvertible {
|
||||
var doc: DOC { get }
|
||||
}
|
||||
|
||||
extension CustomDocConvertible {
|
||||
private func pretty(w: Int) -> String {
|
||||
return best(w, 0, doc).description
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return pretty(70)
|
||||
return pretty(70, doc)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user