Class: Spoom::LSP::Position

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) -> Position



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

def from_json(json)
  Position.new(
    line: json["line"].to_i,
    char: json["character"].to_i,
  )
end

Instance Method Details

#accept_printer(printer) ⇒ Object

: (SymbolPrinter printer) -> void



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

def accept_printer(printer)
  printer.print_colored("#{line}:#{char}", Color::LIGHT_BLACK)
end

#to_sObject

: -> String



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

def to_s
  "#{line}:#{char}"
end