Class: Spoom::LSP::Hover

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
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



30
31
32
33
34
35
# File 'lib/spoom/sorbet/lsp/structures.rb', line 30

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



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

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

#to_sObject



45
46
47
# File 'lib/spoom/sorbet/lsp/structures.rb', line 45

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