[gnome-builder] clang: ignore triggers in string/comment contexts



commit daced64f7e216aad996017a8cc1ccb0600d2aa99
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 8 21:52:07 2018 -0700

    clang: ignore triggers in string/comment contexts

 src/plugins/clang/ide-clang-completion-provider.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/plugins/clang/ide-clang-completion-provider.c 
b/src/plugins/clang/ide-clang-completion-provider.c
index 65d404abd..160d97ae9 100644
--- a/src/plugins/clang/ide-clang-completion-provider.c
+++ b/src/plugins/clang/ide-clang-completion-provider.c
@@ -42,6 +42,12 @@ ide_clang_completion_provider_is_trigger (IdeCompletionProvider *provider,
                                           const GtkTextIter     *iter,
                                           gunichar               ch)
 {
+  GtkTextBuffer *buffer = gtk_text_iter_get_buffer (iter);
+
+  if (gtk_source_buffer_iter_has_context_class (GTK_SOURCE_BUFFER (buffer), iter, "comment") ||
+      gtk_source_buffer_iter_has_context_class (GTK_SOURCE_BUFFER (buffer), iter, "string"))
+    return FALSE;
+
   if (ch == '.' || ch == '(')
     return TRUE;
 


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