Class: Spoom::LSP::SignatureHelp

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



141
142
143
144
145
146
147
# File 'lib/spoom/sorbet/lsp/structures.rb', line 141

def from_json(json)
  SignatureHelp.new(
    label: json["label"],
    doc: json["documentation"],
    params: json["parameters"],
  )
end

Instance Method Details

#accept_printer(printer) ⇒ Object

: (SymbolPrinter printer) -> void



152
153
154
155
156
157
# File 'lib/spoom/sorbet/lsp/structures.rb', line 152

def accept_printer(printer)
  printer.print(label)
  printer.print("(")
  printer.print(params.map { |l| "#{l["label"]}: #{l["documentation"]}" }.join(", "))
  printer.print(")")
end

#to_sObject

: -> String



160
161
162
# File 'lib/spoom/sorbet/lsp/structures.rb', line 160

def to_s
  "#{label}(#{params})."
end