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



144
145
146
147
148
149
150
# File 'lib/spoom/sorbet/lsp/structures.rb', line 144

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



155
156
157
158
159
160
# File 'lib/spoom/sorbet/lsp/structures.rb', line 155

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



163
164
165
# File 'lib/spoom/sorbet/lsp/structures.rb', line 163

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