Search in sources :

Example 1 with RModule

use of org.jetbrains.plugins.ruby.ruby.lang.psi.controlStructures.modules.RModule in project intellij-plugins by JetBrains.

the class RubyMotionSymbolProvider method getSpecificSymbol.

@Nullable
@Override
protected Symbol getSpecificSymbol(PsiElement element, RContainer context) {
    if (context instanceof RClass || context instanceof RModule) {
        final boolean isObject = CoreTypes.Object.equals(context.getFQN().getFullPath());
        final RubyMotionSymbol symbol = isObject ? new RubyMotionSymbol((RFile) context.getContainingFile()) : null;
        final Symbol nsObject = SymbolUtil.findSymbol(element.getProject(), Type.CLASS, getParentName(context), element);
        final List<Symbol> includes = isObject ? Collections.singletonList(symbol) : Collections.emptyList();
        return new MotionEnabledClassModuleSymbol(context, includes, Collections.emptyList(), Collections.singletonList(nsObject));
    }
    return null;
}
Also used : RModule(org.jetbrains.plugins.ruby.ruby.lang.psi.controlStructures.modules.RModule) RClass(org.jetbrains.plugins.ruby.ruby.lang.psi.controlStructures.classes.RClass) Symbol(org.jetbrains.plugins.ruby.ruby.codeInsight.symbols.structure.Symbol) RFile(org.jetbrains.plugins.ruby.ruby.lang.psi.RFile) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Nullable (org.jetbrains.annotations.Nullable)1 Symbol (org.jetbrains.plugins.ruby.ruby.codeInsight.symbols.structure.Symbol)1 RFile (org.jetbrains.plugins.ruby.ruby.lang.psi.RFile)1 RClass (org.jetbrains.plugins.ruby.ruby.lang.psi.controlStructures.classes.RClass)1 RModule (org.jetbrains.plugins.ruby.ruby.lang.psi.controlStructures.modules.RModule)1