Skip to main content

TextAdapter

Trait TextAdapter 

Source
pub trait TextAdapter {
    // Required methods
    fn pos_to_lsp_pos(&self, pos: &Pos) -> Option<Position>;
    fn lsp_pos_to_pos(&self, lsp_pos: &Position) -> Option<Pos>;
    fn range_to_lsp_range(&self, range: &Range<Pos>) -> Option<Range>;
    fn lsp_range_to_range(&self, lsp_range: &Range) -> Option<Range<Pos>>;
    fn change_to_lsp_change(
        &self,
        change: TextChange,
    ) -> Option<TextDocumentContentChangeEvent>;
    fn lsp_change_to_change(
        &self,
        lsp_change: TextDocumentContentChangeEvent,
    ) -> Option<TextChange>;
}
Expand description

Defines operations to convert between native text types and lsp_types. The trait is automatically derived for any type that implements TextMap.

Most operations return an Option where None signals that the conversion wasn’t successful.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§