Examples of IScope


Examples of org.eclipse.xtext.scoping.IScope

  // message Summary {
  //   repeated base.shared.Outer.Type type = 1;
  // }
  @Test public void should_include_package_intersection() {
    MessageField field = xtext.find("type", " =", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target((ComplexTypeLink) field.getType(), reference);
    assertThat(descriptionsIn(scope), contain("base.shared.Outer.Type", "proto.base.shared.Outer.Type",
                                              "google.proto.base.shared.Outer.Type",
                                              "com.google.proto.base.shared.Outer.Type"));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  //   optional google.protobuf.FieldDescriptorProto.Type type = 1;
  // }
  @Test public void should_see_types_from_descriptor_other_than_Messages() {
    MessageField field = xtext.find("type", MessageField.class);
    TypeLink type = field.getType();
    IScope scope = scopeProvider.scope_ComplexTypeLink_target((ComplexTypeLink) type, reference);
    assertThat(descriptionsIn(scope), contain("google.protobuf.FieldDescriptorProto.Type"));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  //
  // option (type).(active) = true;
  @Test public void should_provide_extend_message_fields_for_first_field_in_custom_option() {
    CustomOption option = xtext.find("type", ")", CustomOption.class);
    ExtensionOptionField codeOptionField = (ExtensionOptionField) option.getFields().get(0);
    IScope scope = scopeProvider.scope_OptionField_target(codeOptionField, reference);
    assertThat(descriptionsIn(scope), containAll("active", "com.google.proto.active", ".com.google.proto.active"));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  //   optional bool active = 1 [(type).(active) = true];
  // }
  @Test public void should_provide_message_fields_for_first_field_in_field_custom_option() {
    CustomFieldOption option = xtext.find("type", ")", CustomFieldOption.class);
    ExtensionOptionField codeOptionField = (ExtensionOptionField) option.getFields().get(0);
    IScope scope = scopeProvider.scope_OptionField_target(codeOptionField, reference);
    assertThat(descriptionsIn(scope), containAll("active", "com.google.proto.active", ".com.google.proto.active"));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  //   }
  // };
  @Test public void should_provide_sources_for_aggregate_field() {
    ValueField field = xtext.find("google.proto.test.fileopt", "]", ValueField.class);
    ExtensionFieldName name = (ExtensionFieldName) field.getName();
    IScope scope = scopeProvider.scope_FieldName_target(name, reference);
    assertThat(descriptionsIn(scope), containAll("google.proto.test.fileopt", ".google.proto.test.fileopt"));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  // message Person {
  //   optional Type type = 1 [default = ONE];
  // }
  @Test public void should_provide_Literals_for_default_value() {
    FieldOption option = xtext.find("default", FieldOption.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    Enum typeEnum = xtext.find("Type", " {", Enum.class);
    assertThat(descriptionsIn(scope), containAllLiteralsIn(typeEnum));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  // syntax = "proto2";
  //
  // option optimize_for = SPEED;
  @Test public void should_provide_Literals_for_native_option() {
    Option option = xtext.find("optimize_for", Option.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    Enum optimizeModeEnum = descriptorProvider.primaryDescriptor().enumByName("OptimizeMode");
    assertThat(descriptionsIn(scope), containAllLiteralsIn(optimizeModeEnum));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  // }
  //
  // option (type) = ONE;
  @Test public void should_provide_Literals_for_source_of_custom_option() {
    Option option = xtext.find("type", ")", Option.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    Enum typeEnum = xtext.find("Type", " {", Enum.class);
    assertThat(descriptionsIn(scope), containAllLiteralsIn(typeEnum));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  // }
  //
  // option (info).type = ONE;
  @Test public void should_provide_Literals_for_source_of_field_of_custom_option() {
    Option option = xtext.find("info", ")", Option.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    Enum typeEnum = xtext.find("Type", " {", Enum.class);
    assertThat(descriptionsIn(scope), containAllLiteralsIn(typeEnum));
  }
View Full Code Here

Examples of org.eclipse.xtext.scoping.IScope

  //  message Person {
  //    optional Type type = 1 [ctype = STRING];
  //  }
  @Test public void should_provide_Literals_for_source_of_native_field_option() {
    FieldOption option = xtext.find("ctype", FieldOption.class);
    IScope scope = scopeProvider.scope_LiteralLink_target(valueOf(option), reference);
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Enum cTypeEnum = descriptor.enumByName("CType");
    assertThat(descriptionsIn(scope), containAllLiteralsIn(cTypeEnum));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.