In progress: [Issue 111] Extensions and complete enum literal support
for custom options.
Fixed scoping for enums in field notations.
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 ca69dd0..f391141 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
@@ -182,12 +182,12 @@
'}';
ValueField:
- SimpleFieldNotation | ComplexFieldNotation;
+ SimpleValueField | ComplexValueField;
-SimpleFieldNotation:
+SimpleValueField:
name=FieldName ':' value=SimpleValueLink;
-ComplexFieldNotation:
+ComplexValueField:
name=FieldName ':'? values=ComplexValue;
FieldName:
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java
index 2269594..dd22fc3 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java
@@ -55,16 +55,15 @@
CustomFieldOption option = (CustomFieldOption) container;
source = fieldOptions.sourceOf(option);
}
- if (container instanceof ComplexFieldNotation) {
- ComplexFieldNotation complex = (ComplexFieldNotation) container;
- return sourceOf(complex);
+ if (container instanceof ComplexValueField) {
+ return sourceOf((ComplexValueField) container);
}
}
return ((source instanceof MessageField) ? (MessageField) source : null);
}
- private MessageField sourceOf(ComplexFieldNotation n) {
- FieldName name = n.getName();
+ private MessageField sourceOf(ComplexValueField field) {
+ FieldName name = field.getName();
return (name == null) ? null : name.getTarget();
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
index 60460a0..0450f8b 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
@@ -103,6 +103,10 @@
CustomFieldOption option = (CustomFieldOption) container;
container = fieldOptions.sourceOf(option);
}
+ if (container instanceof SimpleValueField) {
+ SimpleValueField field = (SimpleValueField) container;
+ container = field.getName().getTarget();
+ }
if (container instanceof MessageField) {
anEnum = modelFinder.enumTypeOf((MessageField) container);
}