IdeDiagnostics: Builder SDK Reference

## IdeDiagnostics IdeDiagnostics |

## Functions

void | (*IdeDiagnosticsLineCallback) ()
IdeDiagnostics * | ide_diagnostics_new ()
IdeDiagnostics * | ide_diagnostics_new_from_array ()
void | ide_diagnostics_add ()
void | ide_diagnostics_take ()
void | ide_diagnostics_merge ()
guint | ide_diagnostics_get_n_errors ()
gboolean | ide_diagnostics_get_has_errors ()
guint | ide_diagnostics_get_n_warnings ()
gboolean | ide_diagnostics_get_has_warnings ()
void | ide_diagnostics_foreach_line_in_range ()
IdeDiagnostic * | ide_diagnostics_get_diagnostic_at_line ()
#define | ide_diagnostics_get_size()

## Properties

gboolean | has-errors | Read
gboolean | has-warnings | Read
guint | n-errors | Read
guint | n-warnings | Read

## Types and Values

#define | IDE_TYPE_DIAGNOSTICS
struct | IdeDiagnosticsClass
| IdeDiagnostics

## Object Hierarchy

        GObject
        ╰── IdeObject
            ╰── IdeDiagnostics

## Implemented Interfaces

IdeDiagnostics implements GListModel.

## Description

## Functions

### IdeDiagnosticsLineCallback ()

    void
    (*IdeDiagnosticsLineCallback) (guint line,
                                   IdeDiagnosticSeverity severity,
                                   gpointer user_data);

This function prototype is used to notify a caller of every line that has a diagnostic, and the most severe IdeDiagnosticSeverity for that line.

#### Parameters

line | the line number, starting from 0 |
severity | the severity of the diagnostic |
user_data | user data provided with callback |

Since: 3.32

### ide_diagnostics_new ()

    IdeDiagnostics *
    ide_diagnostics_new (void);

### ide_diagnostics_new_from_array ()

    IdeDiagnostics *
    ide_diagnostics_new_from_array (GPtrArray *array);

#### Parameters

array | optional array of diagnostics to add. | [nullable][element-type IdeDiagnostic]

#### Returns

an IdeDiagnostics.

[transfer full]

Since: 3.32

### ide_diagnostics_add ()

    void
    ide_diagnostics_add (IdeDiagnostics *self,
                         IdeDiagnostic *diagnostic);

### ide_diagnostics_take ()

    void
    ide_diagnostics_take (IdeDiagnostics *self,
                          IdeDiagnostic *diagnostic);

### ide_diagnostics_merge ()

    void
    ide_diagnostics_merge (IdeDiagnostics *self,
                           IdeDiagnostics *other);

### ide_diagnostics_get_n_errors ()

    guint
    ide_diagnostics_get_n_errors (IdeDiagnostics *self);

### ide_diagnostics_get_has_errors ()

    gboolean
    ide_diagnostics_get_has_errors (IdeDiagnostics *self);

### ide_diagnostics_get_n_warnings ()

    guint
    ide_diagnostics_get_n_warnings (IdeDiagnostics *self);

### ide_diagnostics_get_has_warnings ()

    gboolean
    ide_diagnostics_get_has_warnings (IdeDiagnostics *self);

### ide_diagnostics_foreach_line_in_range ()

    void
    ide_diagnostics_foreach_line_in_range (IdeDiagnostics *self,
                                           GFile *file,
                                           guint begin_line,
                                           guint end_line,
                                           IdeDiagnosticsLineCallback callback,
                                           gpointer user_data);

This function calls `callback` for every line with diagnostics between `begin_line` and `end_line` . This is useful when drawing information about diagnostics in an editor where a known number of lines are visible.

#### Parameters

self | an IdeDiagnostics |
file | a GFile |
begin_line | the starting line |
end_line | the ending line |
callback | a callback to execute for each matching line. | [scope call]
user_data | user data for `callback` |

Since: 3.32

### ide_diagnostics_get_diagnostic_at_line ()

    IdeDiagnostic *
    ide_diagnostics_get_diagnostic_at_line
                                   (IdeDiagnostics *self,
                                    GFile *file,
                                    guint line);

Locates an IdeDiagnostic in `file` at `line` .

#### Parameters

self | a IdeDiagnostics |
file | the target file |
line | a line number |

#### Returns

an IdeDiagnostic or `NULL`.

[transfer none][nullable]

Since: 3.32

### ide_diagnostics_get_size()

    #define ide_diagnostics_get_size(d) ((gsize)g_list_model_get_n_items(G_LIST_MODEL(d)))

## Types and Values

### IDE_TYPE_DIAGNOSTICS

    #define IDE_TYPE_DIAGNOSTICS (ide_diagnostics_get_type())

### struct IdeDiagnosticsClass

    struct IdeDiagnosticsClass {
      IdeObjectClass parent_class;
    };

### IdeDiagnostics

    typedef struct _IdeDiagnostics IdeDiagnostics;

## Property Details

### The `“has-errors”` property

      “has-errors”               gboolean

If there are any errors in the diagnostic set.

Owner: IdeDiagnostics

Flags: Read

Default value: FALSE

### The `“has-warnings”` property

      “has-warnings”             gboolean

If there are any warnings in the diagnostic set.

Owner: IdeDiagnostics

Flags: Read

Default value: FALSE

### The `“n-errors”` property

      “n-errors”                 guint

Number of errors in diagnostic set.

Owner: IdeDiagnostics

Flags: Read

Default value: 0

### The `“n-warnings”` property

      “n-warnings”               guint

Number of warnings in diagnostic set.

Owner: IdeDiagnostics

Flags: Read

Default value: 0