[vala/wip/ricotz/lsp: 5/13] langserver: improve signature help
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz/lsp: 5/13] langserver: improve signature help
- Date: Thu, 9 Jan 2020 17:53:11 +0000 (UTC)
commit cf7d606f62252e265f5c8f2cd5de955a0ee45222
Author: Princeton Ferro <princetonferro gmail com>
Date: Thu Jan 9 09:48:07 2020 -0500
langserver: improve signature help
vala/valamethodcall.vala | 5 +++++
vala/valaparser.vala | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 95cc41a42..f8b1578b2 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -53,6 +53,11 @@ public class Vala.MethodCall : Expression {
*/
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 Expression _call;
private List<Expression> argument_list = new ArrayList<Expression> ();
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 79aa98713..a0704b047 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -563,14 +563,16 @@ public class Vala.Parser : CodeVisitor {
return type;
}
- List<Expression> parse_argument_list () throws ParseError {
+ List<Expression> parse_argument_list (out bool extra_comma) throws ParseError {
var list = new ArrayList<Expression> ();
+ extra_comma = false;
if (current () != TokenType.CLOSE_PARENS) {
do {
try {
list.add (parse_argument ());
} catch (ParseError e) {
if (context.keep_going) {
+ extra_comma = true;
report_parse_error (e);
// exit this loop, since language server uses
// number of correctly-supplied arguments from
@@ -803,7 +805,8 @@ public class Vala.Parser : CodeVisitor {
Expression parse_method_call (SourceLocation begin, Expression inner) throws ParseError {
expect (TokenType.OPEN_PARENS);
- var arg_list = parse_argument_list ();
+ bool extra_comma;
+ var arg_list = parse_argument_list (out extra_comma);
if (context.keep_going) {
if (!accept (TokenType.CLOSE_PARENS)) {
report_parse_error (new ParseError.SYNTAX ("expected %s".printf
(TokenType.CLOSE_PARENS.to_string ())), false);
@@ -835,6 +838,7 @@ public class Vala.Parser : CodeVisitor {
expr.add_argument (arg);
}
expr.initial_argument_count = arg_list.size;
+ expr.extra_comma = extra_comma;
return expr;
}
}
@@ -923,7 +927,8 @@ public class Vala.Parser : CodeVisitor {
Expression parse_object_creation_expression (SourceLocation begin, MemberAccess member) throws
ParseError {
member.creation_member = true;
- var arg_list = parse_argument_list ();
+ bool extra_comma;
+ var arg_list = parse_argument_list (out extra_comma);
expect (TokenType.CLOSE_PARENS);
var src = get_src (begin);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]