IdeDiagnostic: Builder SDK Reference

## IdeDiagnostic IdeDiagnostic |

## Functions

IdeDiagnostic * | ide_diagnostic_new ()
IdeDiagnostic * | ide_diagnostic_new_from_variant ()
guint | ide_diagnostic_hash ()
IdeLocation * | ide_diagnostic_get_location ()
const gchar * | ide_diagnostic_get_text ()
IdeDiagnosticSeverity | ide_diagnostic_get_severity ()
GFile * | ide_diagnostic_get_file ()
gchar * | ide_diagnostic_get_text_for_display ()
const gchar * | ide_diagnostic_severity_to_string ()
guint | ide_diagnostic_get_n_ranges ()
IdeRange * | ide_diagnostic_get_range ()
guint | ide_diagnostic_get_n_fixits ()
IdeTextEdit * | ide_diagnostic_get_fixit ()
void | ide_diagnostic_add_range ()
void | ide_diagnostic_take_range ()
void | ide_diagnostic_add_fixit ()
void | ide_diagnostic_take_fixit ()
gboolean | ide_diagnostic_compare ()
GVariant * | ide_diagnostic_to_variant ()

## Properties

gchar * | display-text | Read
IdeLocation * | location | Read / Write / Construct Only
IdeDiagnosticSeverity | severity | Read / Write / Construct Only
gchar * | text | Read / Write / Construct Only

## Types and Values

#define | IDE_TYPE_DIAGNOSTIC
enum | IdeDiagnosticSeverity
struct | IdeDiagnosticClass
| IdeDiagnostic

## Object Hierarchy

        GEnum
        ╰── IdeDiagnosticSeverity
        GObject
        ╰── IdeObject
            ╰── IdeDiagnostic

## Description

## Functions

### ide_diagnostic_new ()

    IdeDiagnostic *
    ide_diagnostic_new (IdeDiagnosticSeverity severity,
                        const gchar *message,
                        IdeLocation *location);

### 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 IdeDiagnostic or `NULL`.

[nullable][transfer full]

Since: 3.32

### ide_diagnostic_hash ()

    guint
    ide_diagnostic_hash (IdeDiagnostic *self);

### ide_diagnostic_get_location ()

    IdeLocation *
    ide_diagnostic_get_location (IdeDiagnostic *self);

Gets the location of the diagnostic.

See also: `ide_diagnostic_get_range()`.

#### Parameters

self | a IdeDiagnostic |

#### Returns

an IdeLocation or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_diagnostic_get_text ()

    const gchar *
    ide_diagnostic_get_text (IdeDiagnostic *self);

### ide_diagnostic_get_severity ()

    IdeDiagnosticSeverity
    ide_diagnostic_get_severity (IdeDiagnostic *self);

### ide_diagnostic_get_file ()

    GFile *
    ide_diagnostic_get_file (IdeDiagnostic *self);

Gets the file containing the diagnostic, if any.

#### Parameters

self | a IdeDiagnostic |

#### Returns

an IdeLocation or `NULL`.

[transfer none][nullable]

Since: 3.32

### 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.

#### Parameters

self | an IdeDiagnostic |

#### Returns

string containing the text formatted for display.

[transfer full]

Since: 3.32

### ide_diagnostic_severity_to_string ()

    const gchar *
    ide_diagnostic_severity_to_string (IdeDiagnosticSeverity severity);

Returns a string suitable to represent the diagnsotic severity.

#### Parameters

severity | a IdeDiagnosticSeverity |

#### Returns

a string

Since: 3.32

### ide_diagnostic_get_n_ranges ()

    guint
    ide_diagnostic_get_n_ranges (IdeDiagnostic *self);

### ide_diagnostic_get_range ()

    IdeRange *
    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_n_ranges()`.

#### Returns

An IdeRange.

[transfer none][nullable]

Since: 3.32

### ide_diagnostic_get_n_fixits ()

    guint
    ide_diagnostic_get_n_fixits (IdeDiagnostic *self);

### ide_diagnostic_get_fixit ()

    IdeTextEdit *
    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_n_fixits()`.

#### Parameters

self | an IdeDiagnostic. |
index | The index of the fixit. |

#### Returns

An IdeTextEdit.

[transfer none][nullable]

Since: 3.32

### ide_diagnostic_add_range ()

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

Adds a source range to the diagnostic.

#### Parameters

self | a IdeDiagnostic |
range | an IdeRange |

Since: 3.32

### ide_diagnostic_take_range ()

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

Adds a source range to the diagnostic, but does not increment the reference count of `range` .

#### Parameters

self | a IdeDiagnostic |
range | an IdeRange. | [transfer full]

Since: 3.32

### ide_diagnostic_add_fixit ()

    void
    ide_diagnostic_add_fixit (IdeDiagnostic *self,
                              IdeTextEdit *fixit);

Adds a source fixit to the diagnostic.

#### Parameters

self | a IdeDiagnostic |
fixit | an IdeTextEdit |

Since: 3.32

### ide_diagnostic_take_fixit ()

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

Adds a source fixit to the diagnostic, but does not increment the reference count of `fixit` .

#### Parameters

self | a IdeDiagnostic |
fixit | an IdeTextEdit. | [transfer full]

Since: 3.32

### ide_diagnostic_compare ()

    gboolean
    ide_diagnostic_compare (IdeDiagnostic *a,
                            IdeDiagnostic *b);

### ide_diagnostic_to_variant ()

    GVariant *
    ide_diagnostic_to_variant (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.32

## Types and Values

### IDE_TYPE_DIAGNOSTIC

    #define IDE_TYPE_DIAGNOSTIC (ide_diagnostic_get_type())

### enum IdeDiagnosticSeverity

#### Members

IDE_DIAGNOSTIC_IGNORED |  |
IDE_DIAGNOSTIC_NOTE |  |
IDE_DIAGNOSTIC_DEPRECATED |  |
IDE_DIAGNOSTIC_WARNING |  |
IDE_DIAGNOSTIC_ERROR |  |
IDE_DIAGNOSTIC_FATAL |  |

### struct IdeDiagnosticClass

    struct IdeDiagnosticClass {
      IdeObjectClass parent_class;
    };

### IdeDiagnostic

    typedef struct _IdeDiagnostic IdeDiagnostic;

## Property Details

### The `“display-text”` property

      “display-text”             gchar *

The text formatted for display.

Owner: IdeDiagnostic

Flags: Read

Default value: NULL

### The `“location”` property

      “location”                 IdeLocation *

The location of the diagnostic.

Owner: IdeDiagnostic

Flags: Read / Write / Construct Only

### The `“severity”` property

      “severity”                 IdeDiagnosticSeverity

The severity of the diagnostic.

Owner: IdeDiagnostic

Flags: Read / Write / Construct Only

Default value: IDE_DIAGNOSTIC_IGNORED

### The `“text”` property

      “text”                     gchar *

The text of the diagnostic.

Owner: IdeDiagnostic

Flags: Read / Write / Construct Only

Default value: NULL