Fixed: [Issue 147] Options in groups show syntax errors.
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ContainAllNames.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ContainAllNames.java
index 8d079e8..ae207bf 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ContainAllNames.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ContainAllNames.java
@@ -15,11 +15,11 @@
 /**
  * @author alruiz@google.com (Alex Ruiz)
  */
-public class ContainAllNames extends BaseMatcher<IEObjectDescriptions> {
+class ContainAllNames extends BaseMatcher<IEObjectDescriptions> {
 
   private final String[] expectedNames;
 
-  public static ContainAllNames containAll(String... names) {
+  static ContainAllNames containAll(String... names) {
     return new ContainAllNames(names);
   }
   
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/bugs/Issue131AddOptionsForService.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue131_AddOptionsForService_Test.java
similarity index 95%
rename from com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/bugs/Issue131AddOptionsForService.java
rename to com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue131_AddOptionsForService_Test.java
index 2ea0af1..dceff51 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/bugs/Issue131AddOptionsForService.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue131_AddOptionsForService_Test.java
@@ -6,7 +6,7 @@
  *
  * http://www.eclipse.org/legal/epl-v10.html
  */
-package com.google.eclipse.protobuf.bugs;
+package com.google.eclipse.protobuf.scoping;
 
 import static com.google.eclipse.protobuf.junit.core.Setups.integrationTestSetup;
 import static com.google.eclipse.protobuf.junit.core.XtextRule.createWith;
@@ -28,7 +28,7 @@
  * 
  * @author alruiz@google.com (Alex Ruiz)
  */
-public class Issue131AddOptionsForService {
+public class Issue131_AddOptionsForService_Test {
 
   private static EReference reference;
   
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue147_AddSupportForGroupOptions_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue147_AddSupportForGroupOptions_Test.java
new file mode 100644
index 0000000..99008d8
--- /dev/null
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue147_AddSupportForGroupOptions_Test.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
+ * Public License v1.0 which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package com.google.eclipse.protobuf.scoping;
+
+import static com.google.eclipse.protobuf.junit.core.Setups.integrationTestSetup;
+import static com.google.eclipse.protobuf.junit.core.XtextRule.createWith;
+import static com.google.eclipse.protobuf.scoping.ContainAllNames.containAll;
+import static com.google.eclipse.protobuf.scoping.ContainAllProperties.containAll;
+import static com.google.eclipse.protobuf.scoping.IEObjectDescriptions.descriptionsIn;
+import static com.google.eclipse.protobuf.scoping.OptionType.FIELD;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.xtext.scoping.IScope;
+import org.junit.*;
+
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.protobuf.*;
+
+/**
+ * Tests fix for <a href="http://code.google.com/p/protobuf-dt/issues/detail?id=147">Issue 147</a>.
+ * 
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class Issue147_AddSupportForGroupOptions_Test {
+
+  private static EReference reference;
+  
+  @BeforeClass public static void setUpOnce() {
+    reference = mock(EReference.class);
+  }
+  
+  @Rule public XtextRule xtext = createWith(integrationTestSetup());
+  
+  private ProtobufScopeProvider provider;
+  
+  @Before public void setUp() {
+    provider = xtext.getInstanceOf(ProtobufScopeProvider.class);
+  }
+
+  // message Person {
+  //   repeated group membership = 1 [deprecated = true] {
+  //     required int64 groupId = 2;
+  //   }
+  // }
+  @Test public void should_provide_Property_fields_for_native_option() {
+    NativeFieldOption option = xtext.find("deprecated", NativeFieldOption.class);
+    IScope scope = provider.scope_PropertyRef_property(option.getProperty(), reference);
+    Collection<Property> fieldOptions = descriptor().optionsOfType(FIELD);
+    assertThat(descriptionsIn(scope), containAll(fieldOptions));
+  }
+  
+  private ProtoDescriptor descriptor() {
+    ProtoDescriptorProvider descriptorProvider = xtext.getInstanceOf(ProtoDescriptorProvider.class);
+    return descriptorProvider.primaryDescriptor();
+  }
+  
+  // package com.google.proto;
+  // import 'google/protobuf/descriptor.proto';
+  //  
+  // extend google.protobuf.FieldOptions {
+  //   optional int32 code = 1000;
+  //   optional int32 info = 1001;
+  // }
+  //  
+  // message Person {
+  //   repeated group membership = 1 [(code) = 68] {
+  //     required int64 groupId = 2;
+  //   }
+  // }
+  @Test public void should_provide_Property_fields_for_custom_option() {
+    CustomFieldOption option = xtext.find("code", ")", CustomFieldOption.class);
+    IScope scope = provider.scope_PropertyRef_property(option.getProperty(), reference);
+    assertThat(descriptionsIn(scope), containAll("code", "proto.code", "google.proto.code", "com.google.proto.code", 
+                                                 ".com.google.proto.code",
+                                                 "info", "proto.info", "google.proto.info", "com.google.proto.info", 
+                                                 ".com.google.proto.info"));
+  }
+}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/OptionType.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/OptionType.java
index 65694d2..7396ff8 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/OptionType.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/OptionType.java
@@ -34,7 +34,7 @@
     OPTION_TYPES_BY_CONTAINER.put(Protobuf.class, FILE);
     OPTION_TYPES_BY_CONTAINER.put(Enum.class, ENUM);
     OPTION_TYPES_BY_CONTAINER.put(Message.class, MESSAGE);
-    OPTION_TYPES_BY_CONTAINER.put(Property.class, FIELD);
+    OPTION_TYPES_BY_CONTAINER.put(Field.class, FIELD);
     OPTION_TYPES_BY_CONTAINER.put(Service.class, SERVICE);
     OPTION_TYPES_BY_CONTAINER.put(Rpc.class, RPC);
   }
@@ -60,7 +60,7 @@
    * @return the type of the given option or {@code null} if a type cannot be found.
    */
   static OptionType typeOf(FieldOption option) {
-    return findTypeForContainer(option.eContainer());
+    return findOptionTypeForLevelOf(option.eContainer());
   }
 
   /**
@@ -69,10 +69,10 @@
    * @return the type of the given option or {@code null} if a type cannot be found.
    */
   static OptionType typeOf(Option option) {
-    return findTypeForContainer(option.eContainer());
+    return findOptionTypeForLevelOf(option.eContainer());
   }
 
-  static OptionType findTypeForContainer(EObject container) {
+  static OptionType findOptionTypeForLevelOf(EObject container) {
     for (Entry<Class<?>, OptionType> optionTypeByContainer : OPTION_TYPES_BY_CONTAINER.entrySet()) {
       if (optionTypeByContainer.getKey().isInstance(container)) {
         return optionTypeByContainer.getValue();
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptor.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptor.java
index 7b59dd6..d9bfab7 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptor.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptor.java
@@ -9,6 +9,7 @@
 package com.google.eclipse.protobuf.scoping;
 
 import static com.google.eclipse.protobuf.protobuf.ProtobufPackage.Literals.PROPERTY__TYPE;
+import static com.google.eclipse.protobuf.scoping.OptionType.findOptionTypeForLevelOf;
 import static com.google.eclipse.protobuf.util.Closeables.closeQuietly;
 import static com.google.eclipse.protobuf.util.Encodings.UTF_8;
 import static java.util.Collections.*;
@@ -140,7 +141,7 @@
   public Collection<Property> availableOptionsFor(EObject o) {
     EObject target = o;
     if (target instanceof NativeOption) target = target.eContainer();
-    OptionType type = OptionType.findTypeForContainer(target);
+    OptionType type = findOptionTypeForLevelOf(target);
     if (type == null) return emptyList();
     return optionsOfType(type);
   }