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