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



24
25
26
27
28
29
# File 'lib/spoom/sorbet/lsp/structures.rb', line 24

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



34
35
36
37
# File 'lib/spoom/sorbet/lsp/structures.rb', line 34

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

#to_sObject

: -> String



40
41
42
# File 'lib/spoom/sorbet/lsp/structures.rb', line 40

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