ide-diagnostic

ide-diagnostic

Functions

Types and Values

Object Hierarchy

    GEnum
    ╰── IdeDiagnosticSeverity

Description

Functions

ide_diagnostic_get_location ()

IdeSourceLocation *
ide_diagnostic_get_location (IdeDiagnostic *self);

Gets the location of a diagnostic.

Parameters

self

An IdeDiagnostic.

 

Returns

Gets the location of a diagnostic.

[transfer none]


ide_diagnostic_get_file ()

GFile *
ide_diagnostic_get_file (IdeDiagnostic *self);

This is a helper to simplify the process of determining what file the diagnostic is within. It is equivalent to getting the source location and looking at the file.

Returns

a GFile or NULL.

[nullable][transfer none]


ide_diagnostic_get_num_fixits ()

guint
ide_diagnostic_get_num_fixits (IdeDiagnostic *self);

ide_diagnostic_get_fixit ()

IdeFixit *
ide_diagnostic_get_fixit (IdeDiagnostic *self,
                          guint index);

Gets the fixit denoted by index . This value should be less than the value returned from ide_diagnostic_get_num_fixits().

Parameters

self

an IdeDiagnostic.

 

index

The index of the fixit.

 

Returns

An IdeFixit.

[transfer none]


ide_diagnostic_get_num_ranges ()

guint
ide_diagnostic_get_num_ranges (IdeDiagnostic *self);

ide_diagnostic_get_range ()

IdeSourceRange *
ide_diagnostic_get_range (IdeDiagnostic *self,
                          guint index);

Retrieves the range found at index . It is a programming error to call this function with a value greater or equal to ide_diagnostic_get_num_ranges().

Returns

An IdeSourceRange.

[transfer none][nullable]


ide_diagnostic_get_severity ()

IdeDiagnosticSeverity
ide_diagnostic_get_severity (IdeDiagnostic *self);

ide_diagnostic_get_text ()

const gchar *
ide_diagnostic_get_text (IdeDiagnostic *self);

ide_diagnostic_get_text_for_display ()

gchar *
ide_diagnostic_get_text_for_display (IdeDiagnostic *self);

This creates a new string that is formatted using the diagnostics line number, column, severity, and message text in the format "line:column: severity: message".

This can be convenient when wanting to quickly display a diagnostic such as in a tooltip.

Returns

string containing the text formatted for display.

[transfer full]


ide_diagnostic_ref ()

IdeDiagnostic *
ide_diagnostic_ref (IdeDiagnostic *self);

ide_diagnostic_unref ()

void
ide_diagnostic_unref (IdeDiagnostic *self);

ide_diagnostic_new ()

IdeDiagnostic *
ide_diagnostic_new (IdeDiagnosticSeverity severity,
                    const gchar *text,
                    IdeSourceLocation *location);

Creates a new diagnostic.

If you want to set a range for the diagnostic, see ide_diagnostic_add_range() or ide_diagnostic_take_range().

Parameters

severity

the severity of the diagnostic

 

text

the diagnostic message text

 

location

the location of the diagnostic.

[nullable]

Returns

An IdeDiagnostic.

[transfer full]


ide_diagnostic_new_from_variant ()

IdeDiagnostic *
ide_diagnostic_new_from_variant (GVariant *variant);

Creates a new GVariant using the data contained in variant .

If variant is NULL or Upon failure, NULL is returned.

Parameters

variant

a GVariant or NULL.

[nullable]

Returns

a GVariant or NULL.

[nullable][transfer full]

Since: 3.30


ide_diagnostic_add_range ()

void
ide_diagnostic_add_range (IdeDiagnostic *self,
                          IdeSourceRange *range);

Adds the range to the diagnostic. This allows diagnostic tools to highlight the errored text appropriately.

Parameters

self

An IdeDiagnostic.

 

range

An IdeSourceRange.

 

ide_diagnostic_take_fixit ()

void
ide_diagnostic_take_fixit (IdeDiagnostic *self,
                           IdeFixit *fixit);

Adds the suggested fixit to the diagnostic while transfering ownership of fixit to self .

Parameters

self

an IdeDiagnostic.

 

fixit

An IdeFixit.

[transfer full]

ide_diagnostic_take_range ()

void
ide_diagnostic_take_range (IdeDiagnostic *self,
                           IdeSourceRange *range);

Steals the ownership of range and adds to the diagnostic.

This saves multiple atomic references of range which could be expensive if you are doing lots of diagnostics.

Parameters

self

an IdeDiagnostic.

 

range

An IdeSourceRange.

[transfer full]

ide_diagnostic_compare ()

gint
ide_diagnostic_compare (const IdeDiagnostic *a,
                        const IdeDiagnostic *b);

ide_diagnostic_hash ()

guint
ide_diagnostic_hash (IdeDiagnostic *self);

ide_diagnostic_to_variant ()

GVariant *
ide_diagnostic_to_variant (const IdeDiagnostic *self);

Creates a GVariant to represent the diagnostic. This can be useful when working in subprocesses to serialize the diagnostic.

This function will never return a floating variant.

Parameters

self

a IdeDiagnostic

 

Returns

a GVariant.

[transfer full]

Since: 3.30


ide_diagnostic_severity_to_string ()

const gchar *
ide_diagnostic_severity_to_string (IdeDiagnosticSeverity severity);

Types and Values

enum IdeDiagnosticSeverity

Members

IDE_DIAGNOSTIC_IGNORED

   

IDE_DIAGNOSTIC_NOTE

   

IDE_DIAGNOSTIC_DEPRECATED

   

IDE_DIAGNOSTIC_WARNING

   

IDE_DIAGNOSTIC_ERROR

   

IDE_DIAGNOSTIC_FATAL