Skip to main content

PointExt

Trait PointExt 

Source
pub trait PointExt {
    // Required methods
    fn advance(self, delta: Point) -> Self;
    fn position(&self, document: &Document) -> Position;
}

Required Methods§

Source

fn advance(self, delta: Point) -> Self

Source

fn position(&self, document: &Document) -> Position

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PointExt for Point

Source§

fn advance(self, delta: Point) -> Self

Returns a new point shifted by delta, resetting the column when the delta moves to a different row.

Source§

fn position(&self, document: &Document) -> Position

Tree-sitter points use a zero-based row plus UTF-8 byte offset column, while the LSP expects UTF-16 code-unit offsets.

We take the document line for the point’s row, convert the byte column into a char index, and then into a UTF-16 offset to produce an lsp::Position.

Implementors§