Allow repeated fields within option values.
Change-Id: I2ba5c813e12b2f004bfcbe07a30605d5796b1442
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java
index b575932..9bed2d8 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java
@@ -704,10 +704,11 @@
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
}
- @Override public void completeSimpleValueField_Value(EObject model, Assignment assignment,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- if (model instanceof SimpleValueField) {
- SimpleValueField field = (SimpleValueField) model;
+ @Override
+ public void complete_SimpleValueLink(EObject model, RuleCall ruleCall, ContentAssistContext context,
+ ICompletionProposalAcceptor acceptor) {
+ SimpleValueField field = extractElementFromContext(context, SimpleValueField.class);
+ if (field != null) {
FieldName name = field.getName();
if (name != null) {
IndexedElement target = name.getTarget();
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
index fe0b46f..7b82eb2 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
@@ -219,20 +219,24 @@
// { foo: 1, bar: 2 }
ComplexValueCurlyBracket:
- ->'{' {ComplexValueCurlyBracket} (fields+=ValueField (',')?)* '}';
+ '{' {ComplexValueCurlyBracket} (fields+=ValueField (',')?)* '}';
// < foo: 1, bar: 2 >
ComplexValueAngleBracket:
- ->'<' {ComplexValueAngleBracket} (fields+=ValueField (',')?)* '>';
+ '<' {ComplexValueAngleBracket} (fields+=ValueField (',')?)* '>';
ValueField:
- SimpleValueField | ComplexValueField;
+ ->SimpleValueField | ComplexValueField;
SimpleValueField:
- name=FieldName ':' value=SimpleValueLink ';'?;
+ name=FieldName ':'
+ (values+=SimpleValueLink | '[' values+=SimpleValueLink (',' values+=SimpleValueLink)* ','? ']')
+ ';'?;
ComplexValueField:
- name=FieldName ':'? values=ComplexValue ';'?;
+ name=FieldName ':'?
+ (values+=ComplexValue | '[' values+=ComplexValue (',' values+=ComplexValue)* ','? ']')
+ ';'?;
FieldName:
NormalFieldName | ExtensionFieldName;