Class: Spoom::LSP::Diagnostic
- Inherits:
-
Object
- Object
- Spoom::LSP::Diagnostic
- Includes:
- PrintableSymbol
- Defined in:
- lib/spoom/sorbet/lsp/structures.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
: Integer.
-
#information ⇒ Object
readonly
: Object.
-
#message ⇒ Object
readonly
: String.
-
#range ⇒ Object
readonly
: LSP::Range.
Class Method Summary collapse
-
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Diagnostic.
Instance Method Summary collapse
-
#accept_printer(printer) ⇒ Object
: (SymbolPrinter printer) -> void.
-
#initialize(range:, code:, message:, information:) ⇒ Diagnostic
constructor
: (range: LSP::Range, code: Integer, message: String, information: Object) -> void.
-
#to_s ⇒ Object
: -> String.
Constructor Details
#initialize(range:, code:, message:, information:) ⇒ Diagnostic
: (range: LSP::Range, code: Integer, message: String, information: Object) -> void
231 232 233 234 235 236 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 231 def initialize(range:, code:, message:, information:) @range = range @code = code = @information = information end |
Instance Attribute Details
#code ⇒ Object (readonly)
: Integer
222 223 224 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 222 def code @code end |
#information ⇒ Object (readonly)
: Object
228 229 230 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 228 def information @information end |
#message ⇒ Object (readonly)
: String
225 226 227 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 225 def end |
#range ⇒ Object (readonly)
: LSP::Range
219 220 221 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 219 def range @range end |
Class Method Details
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Diagnostic
240 241 242 243 244 245 246 247 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 240 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
252 253 254 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 252 def accept_printer(printer) printer.print(to_s) end |
#to_s ⇒ Object
: -> String
257 258 259 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 257 def to_s "Error: #{message} (#{code})." end |