Class: Spoom::LSP::Range

Inherits:
T::Struct
  • Object
show all
Includes:
PrintableSymbol
Defined in:
lib/spoom/sorbet/lsp/structures.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_json(json) ⇒ Object

: (Hash[untyped, untyped] json) -> Range



52
53
54
55
56
57
# File 'lib/spoom/sorbet/lsp/structures.rb', line 52

def from_json(json)
  Range.new(
    start: Position.from_json(json["start"]),
    end: Position.from_json(json["end"]),
  )
end

Instance Method Details

#accept_printer(printer) ⇒ Object

: (SymbolPrinter printer) -> void



62
63
64
65
66
# File 'lib/spoom/sorbet/lsp/structures.rb', line 62

def accept_printer(printer)
  printer.print_object(start)
  printer.print_colored("-", Color::LIGHT_BLACK)
  printer.print_object(self.end)
end

#to_sObject

: -> String



69
70
71
# File 'lib/spoom/sorbet/lsp/structures.rb', line 69

def to_s
  "#{start}-#{self.end}"
end