Class: Parser::Diagnostic

Inherits:
Object show all
Defined in:
sorbet/rbi/parser@3.3.7.4.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:

[View source]

1714
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 1714

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:

[View source]

1721
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 1721

def arguments; end

#highlightsArray<Parser::Source::Range>

Supplementary error-related source ranges.

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

[View source]

1729
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 1729

def highlights; end

#levelSymbol

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

Returns:

  • (Symbol)

    diagnostic level

See Also:

[View source]

1736
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 1736

def level; end

#locationParser::Source::Range

Main error-related source range.

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

[View source]

1744
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 1744

def location; end

#messageString

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

Returns:

  • (String)

    the rendered message.

[View source]

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

def message; end

#reasonSymbol

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

Returns:

  • (Symbol)

    reason for error

See Also:

[View source]

1757
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 1757

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:

[View source]

1772
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 1772

def render; end