[gnome-builder] libide/lsp: fix warning when using formatter
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/lsp: fix warning when using formatter
- Date: Tue, 27 Sep 2022 00:45:41 +0000 (UTC)
commit 650333bb3b7a9ab86048db353f97a8503fa95bf2
Author: Christian Hergert <chergert redhat com>
Date: Mon Sep 26 17:45:19 2022 -0700
libide/lsp: fix warning when using formatter
This handles the NULL-set case from jsonrpc-glib which is "mv" for the
return type, which is a container type (but not the one we want).
src/libide/lsp/ide-lsp-formatter.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/lsp/ide-lsp-formatter.c b/src/libide/lsp/ide-lsp-formatter.c
index f17bad12b..d86769cfe 100644
--- a/src/libide/lsp/ide-lsp-formatter.c
+++ b/src/libide/lsp/ide-lsp-formatter.c
@@ -168,9 +168,15 @@ ide_lsp_formatter_apply_changes (IdeLspFormatter *self,
g_assert (IDE_IS_LSP_FORMATTER (self));
g_assert (text_edits != NULL);
- if (!g_variant_is_container (text_edits))
+ /* We use "mv" to signify null/empty-set/nothing */
+ if (g_variant_is_of_type (text_edits, G_VARIANT_TYPE ("mv")))
+ IDE_EXIT;
+
+ /* We use "av" which is really "a<a{sv}>" */
+ if (!g_variant_is_of_type (text_edits, G_VARIANT_TYPE ("av")))
{
- g_warning ("variant is not a container, ignoring");
+ g_warning ("Unexpected result of type %s for text edits",
+ g_variant_get_type_string (text_edits));
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]