Commit 51c606fa authored by Christian Hergert's avatar Christian Hergert
Browse files

langserv-client: add ::published-diagnostics signal

This can be used by diagnostic providers to invalidate their diagnostics
when appropriate.
parent e13ce8a4
......@@ -68,6 +68,7 @@ enum {
};
enum {
PUBLISHED_DIAGNOSTICS,
NOTIFICATION,
SUPPORTS_LANGUAGE,
N_SIGNALS
......@@ -564,6 +565,7 @@ ide_langserv_client_text_document_publish_diagnostics (IdeLangservClient *self,
{
g_autoptr(IdeFile) ifile = NULL;
g_autoptr(GFile) file = NULL;
g_autoptr(IdeDiagnostics) diagnostics = NULL;
IDE_TRACE_MSG ("Diagnostics received for %s", uri);
......@@ -572,10 +574,13 @@ ide_langserv_client_text_document_publish_diagnostics (IdeLangservClient *self,
"file", file,
"context", ide_object_get_context (IDE_OBJECT (self)),
NULL);
diagnostics = ide_langserv_client_translate_diagnostics (self, ifile, json_diagnostics);
g_signal_emit (self, signals [PUBLISHED_DIAGNOSTICS], 0, file, diagnostics);
g_hash_table_insert (priv->diagnostics_by_file,
g_steal_pointer (&file),
ide_langserv_client_translate_diagnostics (self, ifile, json_diagnostics));
g_steal_pointer (&diagnostics));
}
IDE_EXIT;
......@@ -745,6 +750,18 @@ ide_langserv_client_class_init (IdeLangservClientClass *klass)
G_TYPE_BOOLEAN,
1,
G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
signals [PUBLISHED_DIAGNOSTICS] =
g_signal_new ("published-diagnostics",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IdeLangservClientClass, published_diagnostics),
NULL, NULL, NULL,
G_TYPE_NONE,
2,
G_TYPE_FILE,
IDE_TYPE_DIAGNOSTICS);
}
static void
......
......@@ -38,6 +38,9 @@ struct _IdeLangservClientClass
JsonNode *params);
gboolean (*supports_language) (IdeLangservClient *self,
const gchar *language_id);
void (*published_diagnostics) (IdeLangservClient *self,
GFile *file,
IdeDiagnostics *diagnostics);
gpointer _reserved1;
gpointer _reserved2;
......
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