Formatting

dotty.tools.dotc.printing.Formatting
object Formatting

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Formatting.type

Members list

Type members

Classlikes

opaque object ShownDef

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
ShownDef.type

General purpose string formatter, with the following features:

General purpose string formatter, with the following features:

  1. Invokes the show extension method on the interpolated arguments.
  2. Sequences can be formatted using the desired separator between two % signs, eg i"myList = (${myList}%, %)"
  3. Safe handling of multi-line margins. Left margins are stripped on the parts of the string context before inserting the arguments. That way, we guard against accidentally treating an interpolated value as a margin.

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def hl(s: String)(using Context): String

Explicit syntax highlighting

Explicit syntax highlighting

Attributes

def hlAsKeyword(str: String)(using Context): String

Explicitly highlight a string with the same formatting as used for keywords

Explicitly highlight a string with the same formatting as used for keywords

Attributes

def typeDiff(found: Type, expected: Type)(using Context): (String, String)

This method will produce a colored type diff from the given arguments. The idea is to do this for known cases that are useful and then fall back on regular syntax highlighting for the cases which are unhandled.

This method will produce a colored type diff from the given arguments. The idea is to do this for known cases that are useful and then fall back on regular syntax highlighting for the cases which are unhandled.

Please not that if used in combination with disambiguateTypes the correct Context for printing should also be passed when calling the method.

Attributes

Returns

the (found, expected, changePercentage) with coloring to highlight the difference

Exports

Defined exports

final val Show: Show.type
Exported from ShownDef
final type Show = Show
Exported from ShownDef$
final val Shown: Shown.type
Exported from ShownDef
final type Shown = Shown
Exported from ShownDef$