Commit b76fec5b authored by Christian Hergert's avatar Christian Hergert
Browse files

diagnostics: update diagnostics after successful build

After we complete a successful build, request that diagnostics be re-run
for the open buffers. This helps when changing things in dependent files
and "building" to test.
parent 75a73658
......@@ -24,6 +24,7 @@
#include "ide-context.h"
#include "ide-debug.h"
#include "buffers/ide-buffer.h"
#include "buffers/ide-buffer-manager.h"
#include "buildsystem/ide-build-manager.h"
#include "buildsystem/ide-build-pipeline.h"
......@@ -31,6 +32,7 @@
#include "buildsystem/ide-configuration-manager.h"
#include "buildsystem/ide-configuration.h"
#include "diagnostics/ide-diagnostic.h"
#include "diagnostics/ide-diagnostics-manager.h"
#include "runtimes/ide-runtime.h"
#include "runtimes/ide-runtime-manager.h"
......@@ -520,10 +522,33 @@ static void
ide_build_manager_real_build_finished (IdeBuildManager *self,
IdeBuildPipeline *pipeline)
IdeDiagnosticsManager *diagnostics;
IdeBufferManager *bufmgr;
IdeContext *context;
guint n_items;
g_assert (IDE_IS_BUILD_MANAGER (self));
g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
ide_build_manager_stop_timer (self);
* We had a successful build, so lets notify the build manager to reload
* dianostics on loaded buffers so the user doesn't have to make a change
* to force the update.
context = ide_object_get_context (IDE_OBJECT (self));
diagnostics = ide_context_get_diagnostics_manager (context);
bufmgr = ide_context_get_buffer_manager (context);
n_items = g_list_model_get_n_items (G_LIST_MODEL (bufmgr));
for (guint i = 0; i < n_items; i++)
g_autoptr(IdeBuffer) buffer = g_list_model_get_item (G_LIST_MODEL (bufmgr), i);
ide_diagnostics_manager_rediagnose (diagnostics, buffer);
static void
......@@ -1278,3 +1278,30 @@ ide_diagnostics_manager_get_sequence_for_file (IdeDiagnosticsManager *self,
return 0;
* ide_diagnostics_manager_rediagnose:
* @self: an #IdeDiagnosticsManager
* @buffer: an #IdeBuffer
* Requests that the diagnostics be reloaded for @buffer.
* You may want to call this if you changed something that a buffer depends on,
* and want to seamlessly update its diagnostics with that updated information.
* Internally, this is the same as @buffer emitting the #IdeBuffer::changed
* signal.
* Since: 3.28
ide_diagnostics_manager_rediagnose (IdeDiagnosticsManager *self,
IdeBuffer *buffer)
g_return_if_fail (IDE_IS_DIAGNOSTICS_MANAGER (self));
g_return_if_fail (IDE_IS_BUFFER (buffer));
g_return_if_fail (ide_buffer_get_context (buffer) ==
ide_object_get_context (IDE_OBJECT (self)));
ide_diagnostics_manager_buffer_changed (self, buffer);
......@@ -42,5 +42,8 @@ IDE_AVAILABLE_IN_ALL
void ide_diagnostics_manager_update_group_by_file (IdeDiagnosticsManager *self,
IdeBuffer *buffer,
GFile *new_file);
void ide_diagnostics_manager_rediagnose (IdeDiagnosticsManager *self,
IdeBuffer *buffer);
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