Class: TypeProf::Diagnostic
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/typeprof/diagnostic.rb |
Constant Summary
-
SEVERITY =
# File 'lib/typeprof/diagnostic.rb', line 21{ error: 1, warning: 2, info: 3, hint: 4 }
-
TAG =
# File 'lib/typeprof/diagnostic.rb', line 22{ unnecessary: 1, deprecated: 2 }
Class Method Summary
- .new(node, meth, msg) ⇒ Diagnostic constructor
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(node, meth, msg) ⇒ Diagnostic
Instance Attribute Details
#msg (readonly)
[ GitHub ]# File 'lib/typeprof/diagnostic.rb', line 15
attr_reader :msg, :severity
#severity (readonly)
[ GitHub ]# File 'lib/typeprof/diagnostic.rb', line 15
attr_reader :msg, :severity
Instance Method Details
#code_range
[ GitHub ]# File 'lib/typeprof/diagnostic.rb', line 17
def code_range @node.send(@meth) end
#reuse(new_node)
[ GitHub ]# File 'lib/typeprof/diagnostic.rb', line 11
def reuse(new_node) @node = new_node end
#to_lsp
[ GitHub ]# File 'lib/typeprof/diagnostic.rb', line 24
def to_lsp json = { range: code_range.to_lsp, source: "TypeProf", message: @msg, } json[:severity] = SEVERITY[@severity] if @severity json[: ] = @tags.map {|tag| TAG[tag] } if @tags json end