pub trait SyntaxNodeFormat {
// Required methods
fn force_no_space_before(&self, db: &dyn SyntaxGroup) -> bool;
fn force_no_space_after(&self, db: &dyn SyntaxGroup) -> bool;
fn allow_newline_after(&self, db: &dyn SyntaxGroup) -> bool;
fn allowed_empty_between(&self, db: &dyn SyntaxGroup) -> usize;
fn get_wrapping_break_line_point_properties(
&self,
db: &dyn SyntaxGroup,
) -> BreakLinePointsPositions;
fn get_internal_break_line_point_properties(
&self,
db: &dyn SyntaxGroup,
config: &FormatterConfig,
) -> BreakLinePointsPositions;
fn get_protected_zone_precedence(
&self,
db: &dyn SyntaxGroup,
) -> Option<usize>;
fn should_skip_terminal(&self, db: &dyn SyntaxGroup) -> bool;
fn as_sort_kind(&self, db: &dyn SyntaxGroup) -> SortKind;
}
Required Methods§
Sourcefn force_no_space_before(&self, db: &dyn SyntaxGroup) -> bool
fn force_no_space_before(&self, db: &dyn SyntaxGroup) -> bool
Returns true if a token should never have a space before it.
Sourcefn force_no_space_after(&self, db: &dyn SyntaxGroup) -> bool
fn force_no_space_after(&self, db: &dyn SyntaxGroup) -> bool
Returns true if a token should never have a space after it.
Sourcefn allow_newline_after(&self, db: &dyn SyntaxGroup) -> bool
fn allow_newline_after(&self, db: &dyn SyntaxGroup) -> bool
Returns true if the line is allowed to break after the node. Only applicable for terminal nodes.
Sourcefn allowed_empty_between(&self, db: &dyn SyntaxGroup) -> usize
fn allowed_empty_between(&self, db: &dyn SyntaxGroup) -> usize
Returns the number of allowed empty lines between two consecutive children of this node.
Sourcefn get_wrapping_break_line_point_properties(
&self,
db: &dyn SyntaxGroup,
) -> BreakLinePointsPositions
fn get_wrapping_break_line_point_properties( &self, db: &dyn SyntaxGroup, ) -> BreakLinePointsPositions
Returns the break point properties before and after a specific node if a break point should exist, otherwise returns None.
Sourcefn get_internal_break_line_point_properties(
&self,
db: &dyn SyntaxGroup,
config: &FormatterConfig,
) -> BreakLinePointsPositions
fn get_internal_break_line_point_properties( &self, db: &dyn SyntaxGroup, config: &FormatterConfig, ) -> BreakLinePointsPositions
Returns the breaking position between the children of a syntax node.
Sourcefn get_protected_zone_precedence(&self, db: &dyn SyntaxGroup) -> Option<usize>
fn get_protected_zone_precedence(&self, db: &dyn SyntaxGroup) -> Option<usize>
If self is a protected zone, returns its precedence (highest precedence == lowest number). Otherwise, returns None.
fn should_skip_terminal(&self, db: &dyn SyntaxGroup) -> bool
Sourcefn as_sort_kind(&self, db: &dyn SyntaxGroup) -> SortKind
fn as_sort_kind(&self, db: &dyn SyntaxGroup) -> SortKind
Returns the sorting kind of the syntax node. This method will be used to sections in the syntax tree.