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



127
128
129
130
131
132
133
# File 'lib/spoom/sorbet/lsp/structures.rb', line 127

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

Instance Method Details

#accept_printer(printer) ⇒ Object



136
137
138
139
140
141
# File 'lib/spoom/sorbet/lsp/structures.rb', line 136

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

#to_sObject



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

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