Class: Parser::Diagnostic

Inherits:
Object show all
Defined in:
sorbet/rbi/parser@3.3.8.0.rbi

Overview

source://parser//lib/parser/diagnostic.rb#31

Defined Under Namespace

Classes: Engine

Constant Summary collapse

LEVELS =

Collection of the available diagnostic levels.

source://parser//lib/parser/diagnostic.rb#37

Returns:

T.let(T.unsafe(nil), Array)

Instance Method Summary collapse

Constructor Details

#initialize(level, reason, arguments, location, highlights = T.unsafe(nil)) ⇒ Diagnostic

source://parser//lib/parser/diagnostic.rb#49

Parameters:



1720
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1720

def initialize(level, reason, arguments, location, highlights = T.unsafe(nil)); end

Instance Method Details

#argumentsSymbol

source://parser//lib/parser/diagnostic.rb#39

Returns:

  • (Symbol)

    extended arguments that describe the error

See Also:



1727
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1727

def arguments; end

#highlightsArray<Parser::Source::Range>

Supplementary error-related source ranges.

source://parser//lib/parser/diagnostic.rb#40



1735
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1735

def highlights; end

#levelSymbol

source://parser//lib/parser/diagnostic.rb#39

Returns:

  • (Symbol)

    diagnostic level

See Also:



1742
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1742

def level; end

#locationParser::Source::Range

Main error-related source range.

source://parser//lib/parser/diagnostic.rb#40



1750
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1750

def location; end

#messageString

source://parser//lib/parser/diagnostic.rb#69

Returns:

  • (String)

    the rendered message.



1756
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1756

def message; end

#reasonSymbol

source://parser//lib/parser/diagnostic.rb#39

Returns:

  • (Symbol)

    reason for error

See Also:



1763
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1763

def reason; end

#renderArray<String>

Renders the diagnostic message as a clang-like diagnostic.

source://parser//lib/parser/diagnostic.rb#86

Examples:

diagnostic.render # =>
# [
#   "(fragment:0):1:5: error: unexpected token $end",
#   "foo +",
#   "    ^"
# ]

Returns:



1778
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 1778

def render; end