struct Savi::Source::Pos

Defined in:

savi/source.cr

Constant Summary

NONE = new(Source.none, 0, 0, 0, 0, 0, 0)

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(source : Savi::Source, start : Int32, finish : Int32, line_start : Int32, line_finish : Int32, row : Int32, col : Int32) #

[View source]

Class Method Detail

def self.from_lsp_position(source, position : LSP::Data::Position) #

[View source]
def self.from_lsp_range(source, range : LSP::Data::Range) #

[View source]
def self.index_range(source : Source, new_start : Int32, new_finish : Int32) #

[View source]
def self.none #

[View source]
def self.point(source : Source, row : Int32, col : Int32) #

[View source]
def self.point(source : Source, offset : Int32) #

[View source]

Instance Method Detail

def apply_edits(edits : Array(Tuple(Source::Pos, String))) #

Apply a list of edits to the source content within the current position, ignoring any edits that fall outside the range of this position. A new source position is returned, pointing to the same region within the a new source that holds the edited content.


[View source]
def col : Int32 #

[View source]
def col=(col : Int32) #

[View source]
def contains?(other : Source::Pos | Nil) #

[View source]
def contains_on_first_line?(other : Source::Pos | Nil) #

[View source]
def contains_on_last_line?(other : Source::Pos | Nil) #

[View source]
def content #

[View source]
def content_match_as_pos(pattern, match_index = 0) #

[View source]
def end_point_as_pos #

[View source]
def finish : Int32 #

[View source]
def finish=(finish : Int32) #

[View source]
def from_start_until_start_of(other_pos : Source::Pos) #

[View source]
def get_finish_row_indent #

[View source]
def get_indent #

[View source]
def get_prior_row_indent #

[View source]
def inspect(io) #

Override inspect to avoid verbosely printing Source#content every time.


[View source]
def line_finish : Int32 #

[View source]
def line_finish=(line_finish : Int32) #

[View source]
def line_start : Int32 #

[View source]
def line_start=(line_start : Int32) #

[View source]
def next_byte?(offset = 0) #

[View source]
def next_line_start_as_pos #

[View source]
def post_match_as_pos(pattern, match_index = 0) #

[View source]
def pre_match_as_pos(pattern, match_index = 0) #

[View source]
def precedes_on_same_line?(other : Source::Pos | Nil) #

[View source]
def row : Int32 #

[View source]
def row=(row : Int32) #

[View source]
def show #

[View source]
def single_line? #

[View source]
def size #

[View source]
def source : Source #

[View source]
def source=(source : Source) #

[View source]
def span(others : Enumerable(Source::Pos)) #

[View source]
def start : Int32 #

[View source]
def start=(start : Int32) #

[View source]
def subset(trim_left, trim_right) #

[View source]
def to_lsp_location #

[View source]
def to_lsp_range #

[View source]
def whole_containing_lines_as_pos #

[View source]