cairo_lang_formatter::formatter_impl

Trait SyntaxNodeFormat

Source
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§

Source

fn force_no_space_before(&self, db: &dyn SyntaxGroup) -> bool

Returns true if a token should never have a space before it.

Source

fn force_no_space_after(&self, db: &dyn SyntaxGroup) -> bool

Returns true if a token should never have a space after it.

Source

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.

Source

fn allowed_empty_between(&self, db: &dyn SyntaxGroup) -> usize

Returns the number of allowed empty lines between two consecutive children of this node.

Source

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.

Source

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.

Source

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.

Source

fn should_skip_terminal(&self, db: &dyn SyntaxGroup) -> bool

Source

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.

Implementations on Foreign Types§

Source§

impl SyntaxNodeFormat for SyntaxNode

Implementors§