[gnome-builder/wip/chergert/completion] vala: condense documentation comments for completion window



commit 86aa5256b39512cc374130a022238d1087660aa8
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 5 14:46:13 2018 -0700

    vala: condense documentation comments for completion window

 .../vala-pack/ide-vala-completion-provider.vala    | 28 ++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/vala-pack/ide-vala-completion-provider.vala 
b/src/plugins/vala-pack/ide-vala-completion-provider.vala
index fad3ef628..adce4fd8c 100644
--- a/src/plugins/vala-pack/ide-vala-completion-provider.vala
+++ b/src/plugins/vala-pack/ide-vala-completion-provider.vala
@@ -109,12 +109,36 @@ namespace Ide
                        return null;
                }
 
+               string? condense (string input)
+               {
+                       var lines = input.split ("\n");
+
+                       foreach (var line in lines) {
+                               line = line.strip ();
+
+                               /* skip empty lines */
+                               if (line == "" || line == "*")
+                                       continue;
+
+                               /* skip past func_name: lines */
+                               if (line.has_suffix (":"))
+                                       continue;
+
+                               if (line.has_prefix ("*"))
+                                       return line.substring(1).strip();
+
+                               return line;
+                       }
+
+                       return null;
+               }
+
                public string? get_comment (Ide.CompletionProposal proposal)
                {
                        var comment = (proposal as ValaCompletionItem).symbol.comment;
 
-                       if (comment != null)
-                               return comment.content;
+                       if (comment != null && comment.content != null)
+                               return condense (comment.content);
 
                        return (proposal as ValaCompletionItem).symbol.get_full_name ();
                }


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