Class: Spoom::LSP::Hover

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



27
28
29
30
31
32
# File 'lib/spoom/sorbet/lsp/structures.rb', line 27

def from_json(json)
  Hover.new(
    contents: json["contents"]["value"],
    range: json["range"] ? Range.from_json(json["range"]) : nil,
  )
end

Instance Method Details

#accept_printer(printer) ⇒ Object

: (SymbolPrinter printer) -> void



37
38
39
40
# File 'lib/spoom/sorbet/lsp/structures.rb', line 37

def accept_printer(printer)
  printer.print("#{contents}\n")
  printer.print_object(range) if range
end

#to_sObject

: -> String



43
44
45
# File 'lib/spoom/sorbet/lsp/structures.rb', line 43

def to_s
  "#{contents} (#{range})."
end