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,
    ) -> 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, ) -> 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§