private boolean processStructType(@NotNull GoScopeProcessor fieldProcessor, @Nullable GoType type) { return !(type instanceof GoStructType && !type.processDeclarations(fieldProcessor, ResolveState.initial(), null, myElement)); }
public boolean processResolveVariants(@NotNull BallerinaScopeProcessor processor) { return processor.execute(myElement, ResolveState.initial()); } }
public boolean processResolveVariants(@NotNull BallerinaScopeProcessor processor) { return processor.execute(myElement, ResolveState.initial()); } }
public static boolean treeWalkUp(@Nullable PsiElement place, @NotNull PsiScopeProcessor processor) { PsiElement lastParent = null; PsiElement run = place; while (run != null) { if (place != run && !run.processDeclarations(processor, ResolveState.initial(), lastParent, place)) return false; lastParent = run; run = run.getParent(); } return true; }
private boolean processAllDefinitions(@NotNull GoScopeProcessor processor) { Collection<GoLabelDefinition> defs = getLabelDefinitions(); for (GoLabelDefinition def : defs) { if (!processor.execute(def, ResolveState.initial())) { return false; } } return true; }
@Nullable public static List<ResolveResult> resolveResultList(@NotNull String name, boolean incompleteCode, @NotNull PsiElement entrance) { List<ResolveResult> resolveResultList; if (name.equals(IGNORED)) { resolveResultList = Collections.<ResolveResult>singletonList(new PsiElementResolveResult(entrance)); } else { resolveResultList = resolveResultList(name, incompleteCode, entrance, ResolveState.initial()); } return resolveResultList; }
private static boolean processParameters(@NotNull GoScopeProcessorBase processor, @NotNull GoParameters parameters) { for (GoParameterDeclaration declaration : parameters.getParameterDeclarationList()) { if (!processNamedElements(processor, ResolveState.initial(), declaration.getParamDefinitionList(), true)) return false; } return true; }
public boolean processResolveVariants(@NotNull BallerinaScopeProcessor processor) { BallerinaTypeDefinition ballerinaTypeDefinition = PsiTreeUtil.getParentOfType(myElement, BallerinaTypeDefinition.class); if (ballerinaTypeDefinition == null) { return true; } return processor.execute(ballerinaTypeDefinition, ResolveState.initial()); } }
@NotNull public static ResolveState createContextOnElement(@NotNull PsiElement element) { return ResolveState.initial().put(CONTEXT, SmartPointerManager.getInstance(element.getProject()).createSmartPsiElementPointer(element)); }
@Override public boolean processResolveVariants(@NotNull GoScopeProcessor processor) { GoVarProcessor p = processor instanceof GoVarProcessor ? (GoVarProcessor)processor : new GoVarProcessor(myElement, processor.isCompletion()) { @Override public boolean execute(@NotNull PsiElement e, @NotNull ResolveState state) { return super.execute(e, state) && processor.execute(e, state); } }; if (myPotentialStopBlock != null) { myPotentialStopBlock.processDeclarations(p, ResolveState.initial(), PsiTreeUtil.getParentOfType(myElement, GoStatement.class), myElement); return true; } return false; } }
public boolean processResolveVariants(@NotNull GoScopeProcessor processor) { PsiFile file = myElement.getContainingFile(); if (!(file instanceof GoFile)) return false; ResolveState state = ResolveState.initial(); GoTypeReferenceExpression qualifier = myElement.getQualifier(); if (qualifier != null) { return processQualifierExpression((GoFile)file, qualifier, processor, state); } return processUnqualifiedResolve((GoFile)file, processor, state, true); }
private static boolean processDefinitionsForBreakReference(@NotNull GoBreakStatement breakStatement, @NotNull GoScopeProcessor processor) { PsiElement breakStatementOwner = GoPsiImplUtil.getBreakStatementOwner(breakStatement); while (breakStatementOwner != null) { PsiElement parent = breakStatementOwner.getParent(); if (parent instanceof GoLabeledStatement) { if (!processor.execute(((GoLabeledStatement)parent).getLabelDefinition(), ResolveState.initial())) { return false; } } breakStatementOwner = GoPsiImplUtil.getBreakStatementOwner(breakStatementOwner); } return true; } }
private boolean processReceiver(@NotNull GoScopeProcessor processor, @NotNull ResolveState state, boolean localResolve) { GoScopeProcessorBase delegate = createDelegate(processor); GoMethodDeclaration method = PsiTreeUtil.getParentOfType(myElement, GoMethodDeclaration.class); GoReceiver receiver = method != null ? method.getReceiver() : null; if (receiver == null) return true; receiver.processDeclarations(delegate, ResolveState.initial(), null, myElement); return processNamedElements(processor, state, delegate.getVariants(), localResolve); }
@NotNull public static List<LookupElement> lookupElementList(@NotNull PsiElement entrance) { Variants variants = new Variants(); PsiTreeUtil.treeWalkUp( variants, entrance, entrance.getContainingFile(), ResolveState.initial().put(ENTRANCE, entrance) ); Collection<LookupElement> lookupElementCollection = variants.getLookupElementCollection(); List<LookupElement> lookupElementList; if (lookupElementCollection != null) { lookupElementList = new ArrayList<LookupElement>(lookupElementCollection); } else { lookupElementList = Collections.emptyList(); } return lookupElementList; }
public boolean processResolveVariants(@NotNull BallerinaScopeProcessorBase processor) { PsiFile containingFile = myElement.getContainingFile(); if (!(containingFile instanceof BallerinaFile)) { return false; } // Get suggestions from current file. This is needed sometimes because without the dummy identifier inserted // by the IDEA, the file might not generate the PSI tree correctly. if (!processor.execute(containingFile, ResolveState.initial())) { return false; } PsiFile originalFile = containingFile.getOriginalFile(); // Get suggestions from current file. if (!processor.execute(originalFile, ResolveState.initial())) { return false; } // Recursively find definitions in the project starting from the current directory. recursivelyFind(processor, originalFile.getContainingDirectory(), originalFile); return true; }
private void processObjectFunctions(@NotNull PsiElement scopeElement) { BallerinaTypeDefinition ballerinaTypeDefinition = PsiTreeUtil.getParentOfType(scopeElement, BallerinaTypeDefinition.class); if (ballerinaTypeDefinition != null) { BallerinaObjectFunctionProcessor ballerinaObjectFunctionProcessor = new BallerinaObjectFunctionProcessor(myResult, myElement, isCompletion()); ballerinaObjectFunctionProcessor.execute(ballerinaTypeDefinition, ResolveState.initial()); PsiElement result = ballerinaObjectFunctionProcessor.getResult(); if (!isCompletion() && result != null) { add(result); } } }
private boolean processTypeDefinition(@NotNull BallerinaTypeDefinition ballerinaTypeDefinition) { // BallerinaObjectFieldProcessor ballerinaFieldProcessor = // new BallerinaObjectFieldProcessor(myResult, myElement, isCompletion()); // ballerinaFieldProcessor.execute(ballerinaTypeDefinition, ResolveState.initial()); // PsiElement result = ballerinaFieldProcessor.getResult(); // if (!isCompletion() && result != null) { // add(result); // return false; // } // Todo - Remove duplication in BallerinaFieldProcessor BallerinaObjectFunctionProcessor ballerinaObjectFunctionProcessor = new BallerinaObjectFunctionProcessor(myResult, myElement, isCompletion()); ballerinaObjectFunctionProcessor.execute(ballerinaTypeDefinition, ResolveState.initial()); PsiElement result = ballerinaObjectFunctionProcessor.getResult(); if (!isCompletion() && result != null) { add(result); return false; } return true; }
private boolean processTypeDefinition(@NotNull BallerinaTypeDefinition ballerinaTypeDefinition) { BallerinaObjectFieldProcessor ballerinaFieldProcessor = new BallerinaObjectFieldProcessor(myResult, myElement, isCompletion()); ballerinaFieldProcessor.execute(ballerinaTypeDefinition, ResolveState.initial()); PsiElement result = ballerinaFieldProcessor.getResult(); if (!isCompletion() && result != null) { add(result); return false; } // Note - This is needed for code completion. // Todo - Remove duplication in BallerinaInvocationProcessor BallerinaObjectFunctionProcessor ballerinaObjectFunctionProcessor = new BallerinaObjectFunctionProcessor(myResult, myElement, isCompletion()); ballerinaObjectFunctionProcessor.execute(ballerinaTypeDefinition, ResolveState.initial()); result = ballerinaObjectFunctionProcessor.getResult(); if (!isCompletion() && result != null) { add(result); return false; } return true; }
public boolean processResolveVariants(@NotNull BallerinaScopeProcessor processor) { BallerinaFunctionDefinition ballerinaFunctionDefinition = PsiTreeUtil.getParentOfType(myElement, BallerinaFunctionDefinition.class); if (ballerinaFunctionDefinition == null) { return true; } BallerinaAttachedObject attachedObject = ballerinaFunctionDefinition.getAttachedObject(); if (attachedObject == null) { return true; } PsiElement identifier = attachedObject.getIdentifier(); PsiReference reference = identifier.getReference(); if (reference == null) { return true; } PsiElement resolvedElement = reference.resolve(); if (resolvedElement == null) { return true; } // Get suggestions from current file. return processor.execute(resolvedElement.getParent(), ResolveState.initial()); } }
type.processDeclarations(delegate, ResolveState.initial(), null, myElement); List<GoTypeReferenceExpression> interfaceRefs = ContainerUtil.newArrayList(); List<GoTypeReferenceExpression> structRefs = ContainerUtil.newArrayList();