[gnome-builder] lsp: provide triggerKind context during completion



commit e18250d6e213c2d6453fc832bbb23c5b9592cc24
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 22 14:39:06 2019 -0800

    lsp: provide triggerKind context during completion

 src/libide/lsp/ide-lsp-completion-provider.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/libide/lsp/ide-lsp-completion-provider.c b/src/libide/lsp/ide-lsp-completion-provider.c
index 851318a97..a344bc84c 100644
--- a/src/libide/lsp/ide-lsp-completion-provider.c
+++ b/src/libide/lsp/ide-lsp-completion-provider.c
@@ -209,11 +209,13 @@ ide_lsp_completion_provider_populate_async (IdeCompletionProvider *provider,
 {
   IdeLspCompletionProvider *self = (IdeLspCompletionProvider *)provider;
   IdeLspCompletionProviderPrivate *priv = ide_lsp_completion_provider_get_instance_private (self);
+  IdeCompletionActivation activation;
   g_autoptr(IdeTask) task = NULL;
   g_autoptr(GVariant) params = NULL;
   g_autofree gchar *uri = NULL;
   GtkTextIter iter, end;
   GtkTextBuffer *buffer;
+  gint trigger_kind;
   gint line;
   gint column;
 
@@ -236,6 +238,13 @@ ide_lsp_completion_provider_populate_async (IdeCompletionProvider *provider,
 
   ide_completion_context_get_bounds (context, &iter, &end);
 
+  activation = ide_completion_context_get_activation (context);
+
+  if (activation == IDE_COMPLETION_TRIGGERED)
+    trigger_kind = 2;
+  else
+    trigger_kind = 1;
+
   g_clear_pointer (&priv->word, g_free);
   priv->word = ide_completion_context_get_word (context);
 
@@ -252,6 +261,9 @@ ide_lsp_completion_provider_populate_async (IdeCompletionProvider *provider,
     "position", "{",
       "line", JSONRPC_MESSAGE_PUT_INT32 (line),
       "character", JSONRPC_MESSAGE_PUT_INT32 (column),
+    "}",
+    "context", "{",
+      "triggerKind", JSONRPC_MESSAGE_PUT_INT32 (trigger_kind),
     "}"
   );
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]