Class: Spoom::LSP::SignatureHelp

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



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

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

Instance Method Details

#accept_printer(printer) ⇒ Object



165
166
167
168
169
170
# File 'lib/spoom/sorbet/lsp/structures.rb', line 165

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

#to_sObject



173
174
175
# File 'lib/spoom/sorbet/lsp/structures.rb', line 173

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