[gnome-builder] IdeDiagnostic: set the location from range when unset
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] IdeDiagnostic: set the location from range when unset
- Date: Tue, 28 Feb 2017 21:52:22 +0000 (UTC)
commit 4b2bf5a2e6dbc28c0c5fd0d692323be2d3185886
Author: Giovanni Campagna <gcampagn cs stanford edu>
Date: Tue Feb 28 00:15:12 2017 -0800
IdeDiagnostic: set the location from range when unset
The gnome code assistance plugin creates an IdeDiagnostic object
with no location, and then sets one or more IdeSourceRange's on it.
We can assume that the first source range corresponds to where the
problem is, and set the location based on it. Without a location,
the diagnostic will be dropped on the floor, which is not nice.
https://bugzilla.gnome.org/show_bug.cgi?id=779359
libide/diagnostics/ide-diagnostic.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libide/diagnostics/ide-diagnostic.c b/libide/diagnostics/ide-diagnostic.c
index e35ed2b..ef9297f 100644
--- a/libide/diagnostics/ide-diagnostic.c
+++ b/libide/diagnostics/ide-diagnostic.c
@@ -268,6 +268,9 @@ ide_diagnostic_take_range (IdeDiagnostic *self,
self->ranges = g_ptr_array_new_with_free_func ((GDestroyNotify)ide_source_range_unref);
g_ptr_array_add (self->ranges, range);
+
+ if (self->location == NULL)
+ self->location = ide_source_location_ref (ide_source_range_get_begin (range));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]