use of nl.ramsolutions.sw.magik.analysis.typing.types.MagikType in project magik-tools by StevenLooman.
the class MagikPreIndexer method handleDefinition.
private void handleDefinition(final MixinDefinition definition) {
final GlobalReference globalRef = definition.getGlobalReference();
this.ensurePackage(globalRef);
final MagikType magikType = new IntrinsicType(globalRef);
this.typeKeeper.addType(magikType);
LOGGER.debug("Indexed mixin: {}", magikType);
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.MagikType in project magik-tools by StevenLooman.
the class MagikPreIndexer method handleDefinition.
private void handleDefinition(final SlottedExemplarDefinition definition) {
final GlobalReference globalRef = definition.getGlobalReference();
this.ensurePackage(globalRef);
final MagikType magikType = new SlottedType(globalRef);
this.typeKeeper.addType(magikType);
LOGGER.debug("Indexed slotted exemplar: {}", magikType);
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.MagikType in project magik-tools by StevenLooman.
the class CompletionProviderTest method testMethodCompletionBare.
@Test
void testMethodCompletionBare() {
final String code = "" + "_method a.b\n" + " 1.\n" + "_endmethod";
final ITypeKeeper typeKeeper = new TypeKeeper();
final MagikType integerType = (MagikType) typeKeeper.getType(GlobalReference.of("sw:integer"));
integerType.addMethod(EnumSet.noneOf(Method.Modifier.class), null, "find_me()", Collections.emptyList(), null, ExpressionResult.UNDEFINED);
// On '.'.
final Position position = new Position(1, 6);
final List<CompletionItem> completions = this.getCompletions(code, typeKeeper, position);
assertThat(completions).hasSize(1);
final CompletionItem item = completions.get(0);
assertThat(item.getKind()).isEqualTo(CompletionItemKind.Method);
assertThat(item.getInsertText()).isEqualTo("find_me()");
assertThat(item.getLabel()).isEqualTo("find_me()");
assertThat(item.getDetail()).isEqualTo("sw:integer");
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.MagikType in project magik-tools by StevenLooman.
the class CompletionProviderTest method testMethodCompletionSelf.
@Test
void testMethodCompletionSelf() {
final String code = "" + "_method a.b\n" + " _self.\n" + "_endmethod";
final ITypeKeeper typeKeeper = new TypeKeeper();
final MagikType aType = new SlottedType(GlobalReference.of("user:a"));
typeKeeper.addType(aType);
aType.addMethod(EnumSet.noneOf(Method.Modifier.class), null, "find_me()", Collections.emptyList(), null, ExpressionResult.UNDEFINED);
// On '.'.
final Position position = new Position(1, 10);
final List<CompletionItem> completions = this.getCompletions(code, typeKeeper, position);
assertThat(completions).hasSize(1);
final CompletionItem item = completions.get(0);
assertThat(item.getKind()).isEqualTo(CompletionItemKind.Method);
assertThat(item.getInsertText()).isEqualTo("find_me()");
assertThat(item.getLabel()).isEqualTo("find_me()");
assertThat(item.getDetail()).isEqualTo("user:a");
}
use of nl.ramsolutions.sw.magik.analysis.typing.types.MagikType in project magik-tools by StevenLooman.
the class CompletionProviderTest method testMethodCompletionExisting.
@Test
void testMethodCompletionExisting() {
final String code = "" + "_method a.b\n" + " 1.fi\n" + "_endmethod";
final ITypeKeeper typeKeeper = new TypeKeeper();
final MagikType integerType = (MagikType) typeKeeper.getType(GlobalReference.of("sw:integer"));
integerType.addMethod(EnumSet.noneOf(Method.Modifier.class), null, "find_me()", Collections.emptyList(), null, ExpressionResult.UNDEFINED);
// On 'i'.
final Position position = new Position(1, 8);
final List<CompletionItem> completions = this.getCompletions(code, typeKeeper, position);
assertThat(completions).hasSize(1);
final CompletionItem item = completions.get(0);
assertThat(item.getKind()).isEqualTo(CompletionItemKind.Method);
assertThat(item.getInsertText()).isEqualTo("find_me()");
assertThat(item.getLabel()).isEqualTo("find_me()");
assertThat(item.getDetail()).isEqualTo("sw:integer");
}
Aggregations