Package org.eclipse.xtext.scoping

Examples of org.eclipse.xtext.scoping.IScope


  // message Contact {
  //   optional test.proto.Type type = 1;
  // }
  @Test public void should_provide_public_imported_Types_with_more_than_one_level() {
    MessageField field = xtext.find("type", " =", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target(typeOf(field), reference);
    assertThat(descriptionsIn(scope), containAll("test.proto.Type", ".test.proto.Type",
                                                 "test.proto.Address", ".test.proto.Address",
                                                 "Contact", "proto.Contact", "google.proto.Contact",
                                                 "com.google.proto.Contact", ".com.google.proto.Contact"));
  }
View Full Code Here


  //   code: 68
  // };
  @Test public void should_provide_sources_for_aggregate_field() {
    ValueField field = xtext.find("code", ":", ValueField.class);
    NormalFieldName name = (NormalFieldName) field.getName();
    IScope scope = scopeProvider.scope_FieldName_target(name, reference);
    Message message = xtext.find("Type", " {", Message.class);
    assertThat(descriptionsIn(scope), containAllFieldsIn(message));
  }
View Full Code Here

  //   name { value: 'Address' }
  // };
  @Test public void should_provide_sources_for_nested_field_notation_in_option() {
    ValueField field = xtext.find("value", ":", ValueField.class);
    NormalFieldName name = (NormalFieldName) field.getName();
    IScope scope = scopeProvider.scope_FieldName_target(name, reference);
    Message message = xtext.find("Names", " {", Message.class);
    assertThat(descriptionsIn(scope), containAllFieldsIn(message));
  }
View Full Code Here

  //   optional int target = 1 [(type) = { code: 68 }];
  // }
  @Test public void should_provide_sources_for_field_notation_in_field_option() {
    ValueField field = xtext.find("code", ":", ValueField.class);
    NormalFieldName name = (NormalFieldName) field.getName();
    IScope scope = scopeProvider.scope_FieldName_target(name, reference);
    Message message = xtext.find("Type", " {", Message.class);
    assertThat(descriptionsIn(scope), containAllFieldsIn(message));
  }
View Full Code Here

  //   optional int target = 1 [(type) = { name: { value: 'Address' } }];
  // }
  @Test public void should_provide_sources_for_nested_field_notation_in_field_option() {
    ValueField field = xtext.find("value", ":", ValueField.class);
    NormalFieldName name = (NormalFieldName) field.getName();
    IScope scope = scopeProvider.scope_FieldName_target(name, reference);
    Message message = xtext.find("Names", " {", Message.class);
    assertThat(descriptionsIn(scope), containAllFieldsIn(message));
  }
View Full Code Here

  // syntax = "proto2";
  //
  // option optimize_for = SPEED;
  @Test public void should_provide_sources_for_native_option() {
    Option option = xtext.find("optimize_for", Option.class);
    IScope scope = scopeProvider.scope_OptionSource_target(option.getSource(), reference);
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Collection<MessageField> optionSources = descriptor.optionsOfType(FILE);
    assertThat(descriptionsIn(scope), containAll(optionSources));
  }
View Full Code Here

  // message Person {
  //   optional Type type = 1 [ctype = STRING];
  // }
  @Test public void should_provide_sources_for_native_field_option() {
    NativeFieldOption option = xtext.find("ctype", NativeFieldOption.class);
    IScope scope = scopeProvider.scope_OptionSource_target(option.getSource(), reference);
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Collection<MessageField> optionSources = descriptor.optionsOfType(FIELD);
    assertThat(descriptionsIn(scope), containAll(optionSources));
  }
View Full Code Here

  // }
  //
  // option (code) = 68;
  @Test public void should_provide_sources_for_custom_option() {
    Option option = xtext.find("code", ")", Option.class);
    IScope scope = scopeProvider.scope_OptionSource_target(option.getSource(), 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"));
  }
View Full Code Here

  // import 'custom-options.proto';
  //
  // option (test.proto.code) = 68;
  @Test public void should_provide_imported_sources_for_custom_option() {
    Option option = xtext.find("code", ")", Option.class);
    IScope scope = scopeProvider.scope_OptionSource_target(option.getSource(), reference);
    assertThat(descriptionsIn(scope), containAll("test.proto.code", ".test.proto.code",
                                                 "test.proto.info", ".test.proto.info"));
  }
View Full Code Here

  // import 'custom-options.proto';
  //
  // option (code) = 68;
  @Test public void should_provide_imported_sources_for_custom_option_with_equal_package() {
    Option option = xtext.find("code", ")", Option.class);
    IScope scope = scopeProvider.scope_OptionSource_target(option.getSource(), 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"));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.scoping.IScope

Copyright © 2018 www.massapicom. 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.