Commit 7dab847f authored by Günther Wagner's avatar Günther Wagner Committed by Christian Hergert

editor: show multiple diagnostics in hover provider

parent 8bbc2dc1
Pipeline #192906 failed with stage
in 60 minutes
...@@ -62,21 +62,29 @@ gbp_editor_hover_provider_hover_async (IdeHoverProvider *provider, ...@@ -62,21 +62,29 @@ gbp_editor_hover_provider_hover_async (IdeHoverProvider *provider,
GFile *file = ide_buffer_get_file (IDE_BUFFER (buffer)); GFile *file = ide_buffer_get_file (IDE_BUFFER (buffer));
guint line = gtk_text_iter_get_line (iter); guint line = gtk_text_iter_get_line (iter);
IdeDiagnostics *diagnostics; IdeDiagnostics *diagnostics;
IdeDiagnostic *diag; g_autoptr(GPtrArray) line_diags = NULL;
if ((diagnostics = ide_buffer_get_diagnostics (IDE_BUFFER (buffer))) && diagnostics = ide_buffer_get_diagnostics (IDE_BUFFER (buffer));
(diag = ide_diagnostics_get_diagnostic_at_line (diagnostics, file, line))) line_diags = ide_diagnostics_get_diagnostics_at_line (diagnostics, file, line);
IDE_PTR_ARRAY_SET_FREE_FUNC (line_diags, g_object_unref);
if (diagnostics && line_diags)
{ {
g_autoptr(IdeMarkedContent) content = NULL; for (guint i = 0; i < line_diags->len; i++)
g_autofree gchar *text = ide_diagnostic_get_text_for_display (diag); {
IdeDiagnostic *diag = g_ptr_array_index (line_diags, i);
content = ide_marked_content_new_from_data (text, g_autoptr(IdeMarkedContent) content = NULL;
strlen (text), g_autofree gchar *text = ide_diagnostic_get_text_for_display (diag);
IDE_MARKED_KIND_PLAINTEXT);
ide_hover_context_add_content (context, content = ide_marked_content_new_from_data (text,
DIAGNOSTICS_HOVER_PRIORITY, strlen (text),
_("Diagnostics"), IDE_MARKED_KIND_PLAINTEXT);
content); ide_hover_context_add_content (context,
DIAGNOSTICS_HOVER_PRIORITY,
_("Diagnostics"),
content);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment