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



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

def self.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



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

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

#to_sObject



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

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