class TypeProf::Diagnostic

常量

SEVERITY
TAG

属性

msg[R]
severity[R]

公共类方法

new(node, meth, msg) 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/diagnostic.rb, line 3
def initialize(node, meth, msg)
  @node = node
  @meth = meth
  @msg = msg
  @severity = :error # TODO: keyword argument
  @tags = nil # TODO: keyword argument
end

公共实例方法

code_range() 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/diagnostic.rb, line 17
def code_range
  @node.send(@meth)
end
reuse(new_node) 点击切换源代码
# File typeprof-0.30.1/lib/typeprof/diagnostic.rb, line 11
def reuse(new_node)
  @node = new_node
end
to_lsp() 点击切换源代码
# File typeprof-0.30.1/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] = @tags.map {|tag| TAG[tag] } if @tags
  json
end