Class: Spoom::LSP::Diagnostic

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



175
176
177
178
179
180
181
182
# File 'lib/spoom/sorbet/lsp/structures.rb', line 175

def from_json(json)
  Diagnostic.new(
    range: Range.from_json(json["range"]),
    code: json["code"].to_i,
    message: json["message"],
    information: json["relatedInformation"],
  )
end

Instance Method Details

#accept_printer(printer) ⇒ Object

: (SymbolPrinter printer) -> void



187
188
189
# File 'lib/spoom/sorbet/lsp/structures.rb', line 187

def accept_printer(printer)
  printer.print(to_s)
end

#to_sObject

: -> String



192
193
194
# File 'lib/spoom/sorbet/lsp/structures.rb', line 192

def to_s
  "Error: #{message} (#{code})."
end