[vala/wip/ricotz/lsp: 7/13] langserver: parse OCEs better



commit 1268e1ffce3efcf0c51d5c5294a6c9c32b1e9264
Author: Princeton Ferro <princetonferro gmail com>
Date:   Thu Jan 9 09:50:44 2020 -0500

    langserver: parse OCEs better

 vala/valaobjectcreationexpression.vala | 11 +++++++++++
 vala/valaparser.vala                   |  4 +++-
 2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 575d50b37..175f126ba 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -55,6 +55,17 @@ public class Vala.ObjectCreationExpression : Expression {
 
        public bool struct_creation { get; set; }
 
+        /**
+         * For language servers, the number of completed arguments from the left.
+         */
+        public int initial_argument_count { get; set; }
+
+        /**
+         * For language servers, whether there is an extra comma at the end of the argument list.
+         */
+        public bool extra_comma { get; set; }
+
+
        private List<Expression> argument_list = new ArrayList<Expression> ();
 
        private List<MemberInitializer> object_initializer = new ArrayList<MemberInitializer> ();
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 7c89f87a2..e547927a5 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -573,7 +573,7 @@ public class Vala.Parser : CodeVisitor {
                                } catch (ParseError e) {
                                        if (context.keep_going) {
                                                extra_comma = true;
-                                               report_parse_error (e);
+                                               report_parse_error (e, false);
                                                // exit this loop, since language server uses
                                                // number of correctly-supplied arguments from
                                                // the left to determine which argument to complete
@@ -944,9 +944,11 @@ public class Vala.Parser : CodeVisitor {
                foreach (Expression arg in arg_list) {
                        expr.add_argument (arg);
                }
+                expr.initial_argument_count = arg_list.size;
                foreach (MemberInitializer initializer in init_list) {
                        expr.add_member_initializer (initializer);
                }
+                expr.extra_comma = extra_comma;
                return expr;
        }
 


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