Package software.amazon.smithy.syntax
Class Formatter
- java.lang.Object
-
- software.amazon.smithy.syntax.Formatter
-
public final class Formatter extends java.lang.Object
Formats valid Smithy IDL models.This formatter will by default sort use statements, remove unused use statements, and fix documentation comments that should be normal comments.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
format(TokenTree root)
Formats the given token tree, wrapping lines at 120 characters.static java.lang.String
format(TokenTree root, int maxWidth)
Formats the given token tree.
-
-
-
Method Detail
-
format
public static java.lang.String format(TokenTree root)
Formats the given token tree, wrapping lines at 120 characters.- Parameters:
root
- RootTreeType.IDL
tree node to format.- Returns:
- Returns the formatted model as a string.
- Throws:
ModelSyntaxException
- if the model contains errors.
-
format
public static java.lang.String format(TokenTree root, int maxWidth)
Formats the given token tree.- Parameters:
root
- RootTreeType.IDL
tree node to format.maxWidth
- Maximum line width.- Returns:
- Returns the formatted model as a string.
- Throws:
ModelSyntaxException
- if the model contains errors.
-
-