Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
72,800
boolean (Object element, @Nullable PsiElement context) { if (element instanceof PsiPackage) { return ((PsiDirectoryContainer)element).getDirectories(myScope).length > 0; } else if (element instanceof PsiElement) { PsiFile psiFile = ((PsiElement)element).getContainingFile(); if (psiFile != null) { VirtualFile file = psi...
isAcceptable
72,801
boolean (Class<?> hintClass) { return true; }
isClassAcceptable
72,802
boolean (Object element, @Nullable PsiElement context) { return !(element instanceof PsiField) || !GenericsHighlightUtil.isRestrictedStaticEnumField((PsiField)element, myEnumClass); }
isAcceptable
72,803
boolean (Class<?> hintClass) { return true; }
isClassAcceptable
72,804
CompletionResultSet (final CompletionParameters parameters, CompletionResultSet result) { PsiElement position = parameters.getPosition(); ExpectedTypeInfo[] expectedTypes = getExpectedTypesWithDfa(parameters, position); CompletionType type = parameters.getCompletionType(); boolean smart = type == CompletionType.SMART; ...
addJavaSorting
72,805
LookupElementWeigher (PsiElement position) { Object2IntMap<PsiMethod> previousChainCalls = new Object2IntOpenHashMap<>(); if (position.getParent() instanceof PsiReferenceExpression ref) { PsiMethodCallExpression qualifier = getCallQualifier(ref); PsiClass qualifierClass = qualifier == null ? null : PsiUtil.resolveClass...
dispreferPreviousChainCalls
72,806
Boolean (@NotNull LookupElement element, @NotNull WeighingContext context) { PsiElement psi = element.getPsiElement(); return psi instanceof PsiMethod && previousChainCalls.getInt(psi) == 1; }
weigh
72,807
PsiMethodCallExpression (PsiReferenceExpression ref) { return ObjectUtils.tryCast(ref.getQualifier(), PsiMethodCallExpression.class); }
getCallQualifier
72,808
LookupElementWeigher (CompletionParameters parameters, final ExpectedTypeInfo[] expectedInfos) { final PsiElement position = parameters.getPosition(); final PsiMethodCallExpression expression = PsiTreeUtil.getParentOfType(position, PsiMethodCallExpression.class, true, PsiClass.class); final PsiReferenceExpression refer...
recursion
72,809
LookupElementWeigher (PsiElement position, final ExpectedTypeInfo[] infos) { if (PsiTreeUtil.getParentOfType(position, PsiDocComment.class) != null) { return null; } if (position.getParent() instanceof PsiReferenceExpression refExpr) { final PsiElement qualifier = refExpr.getQualifier(); if (qualifier == null) { return...
preferStatics
72,810
Integer (@NotNull LookupElement element) { JavaConstructorCallElement call = element.as(JavaConstructorCallElement.class); Object o = call != null ? call.getConstructedClass() : element.getObject(); if (o instanceof PsiKeyword) return -3; if (!(o instanceof PsiMember) || element.getUserData(JavaGenerateMemberCompletion...
weigh
72,811
ExpectedTypeMatching (LookupElement item, ExpectedTypeInfo[] expectedInfos, @Nullable String expectedMemberName, @NotNull PsiElement position) { PsiType itemType = JavaCompletionUtil.getLookupElementType(item); if (itemType != null) { PsiUtil.ensureValidType(itemType); for (final ExpectedTypeInfo expectedInfo : expecte...
getExpectedTypeMatching
72,812
ExpectedTypeMatching (@Nullable String expectedMemberName, @Nullable PsiType itemType) { if (expectedMemberName != null) { PsiClass itemClass = PsiUtil.resolveClassInClassTypeOnly(itemType); if (itemClass != null) { if (itemClass.findMethodsByName(expectedMemberName, true).length > 0 || itemClass.findFieldByName(expect...
preferByMemberName
72,813
boolean (ExpectedTypeInfo[] expectedInfos) { boolean hasNonVoid = false; for (ExpectedTypeInfo info : expectedInfos) { if (!PsiTypes.voidType().equals(info.getType())) { hasNonVoid = true; } } return hasNonVoid; }
hasNonVoid
72,814
int (final String name, ExpectedTypeInfo[] expectedInfos) { int res = 0; if (name != null && expectedInfos != null) { final List<String> words = NameUtil.nameToWordsLowerCase(name); final List<String> wordsNoDigits = NameUtil.nameToWordsLowerCase(truncDigits(name)); int max1 = calcMatch(words, 0, expectedInfos); max1 =...
getNameEndMatchingDegree
72,815
String (String name) { int count = name.length() - 1; while (count >= 0) { char c = name.charAt(count); if (!Character.isDigit(c)) break; count--; } return name.substring(0, count + 1); }
truncDigits
72,816
int (final List<String> words, int max, ExpectedTypeInfo[] myExpectedInfos) { for (ExpectedTypeInfo myExpectedInfo : myExpectedInfos) { String expectedName = ((ExpectedTypeInfoImpl)myExpectedInfo).getExpectedName(); if (expectedName == null) continue; max = calcMatch(expectedName, words, max); max = calcMatch(truncDigi...
calcMatch
72,817
int (final String expectedName, final List<String> words, int max) { if (expectedName == null) return max; String[] expectedWords = NameUtil.nameToWords(expectedName); int limit = Math.min(words.size(), expectedWords.length); for (int i = 0; i < limit; i++) { String word = words.get(words.size() - i - 1); String expect...
calcMatch
72,818
MyResult (@NotNull LookupElement item) { final Object object = item.getObject(); if (object instanceof PsiClass) { if (object instanceof PsiTypeParameter) return MyResult.typeParameter; if (myTypeParameter != null && object.equals(PsiUtil.resolveClassInType(TypeConversionUtil.typeParameterErasure(myTypeParameter)))) { ...
weigh
72,819
boolean (@NotNull LookupElement item, @Nullable PsiType itemType) { if (JavaCompletionUtil.SUPER_METHOD_PARAMETERS.get(item) != null) { return true; } if (itemType == null || itemType.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) { return false; } return ContainerUtil.exists(myExpectedTypes, info -> box(info.getType...
isExactlyExpected
72,820
boolean (@NotNull LookupElement item) { JavaMethodCallElement call = item.as(JavaMethodCallElement.CLASS_CONDITION_KEY); if (call != null && !call.getInferenceSubstitutor().equals(PsiSubstitutor.EMPTY)) { PsiType callType = TypeConversionUtil.erasure(call.getSubstitutor().substitute(call.getObject().getReturnType())); ...
returnsUnboundType
72,821
boolean (PsiType callType, ExpectedTypeInfo info) { PsiType expectedType = TypeConversionUtil.erasure(info.getType()); return expectedType != null && TypeConversionUtil.isAssignable(expectedType, callType); }
canBeExpected
72,822
PsiType (PsiType expectedType) { PsiClassType boxed = expectedType instanceof PsiPrimitiveType ? ((PsiPrimitiveType)expectedType).getBoxedType(myParameters.getPosition()) : null; return boxed != null ? boxed : expectedType; }
box
72,823
PsiType (PsiType type) { if (type instanceof PsiClassType) { final PsiClass psiClass = ((PsiClassType)type).resolve(); if (psiClass != null && CommonClassNames.JAVA_LANG_CLASS.equals(psiClass.getQualifiedName())) { PsiClassType erased = (PsiClassType)GenericsUtil.eliminateWildcards(type); PsiType[] parameters = erased....
removeClassWildcard
72,824
Integer (@NotNull LookupElement element) { final Object object = element.getObject(); return object instanceof PsiMethod && !FunctionalExpressionCompletionProvider.isFunExprItem(element) && isTooGeneric(element, (PsiMethod)object) ? 1 : 0; }
weigh
72,825
Integer (@NotNull LookupElement element) { TypedLookupItem item = element.as(TypedLookupItem.class); return item != null && element.getObject() instanceof PsiMethod && PsiTypes.voidType().equals(item.getType()) ? 1 : 0; }
weigh
72,826
boolean (@NotNull LookupElement element, PsiMethod method) { PsiType type = method.getReturnType(); JavaMethodCallElement callItem = element.as(JavaMethodCallElement.CLASS_CONDITION_KEY); if (callItem != null) { type = callItem.getSubstitutor().substitute(type); } if (type instanceof PsiClassType) { PsiClass target = (...
isTooGeneric
72,827
Integer (@NotNull LookupElement element) { final PsiTypeLookupItem lookupItem = element.as(PsiTypeLookupItem.CLASS_CONDITION_KEY); if (lookupItem != null) { return lookupItem.getBracketsCount() * 10 + (lookupItem.isAddArrayInitializer() ? 1 : 0); } return 0; }
weigh
72,828
String (PsiElement position) { if (position.getParent() instanceof PsiJavaCodeReferenceElement) { PsiElement grand = position.getParent().getParent(); if (grand instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)grand).getQualifier() == position.getParent()) { return ((PsiJavaCodeReferenceElement)g...
calcExpectedMemberNameByParentCall
72,829
ExpectedTypeMatching (@NotNull LookupElement item) { if (item.getObject() instanceof PsiClass && !myConstructorPossible) { PsiType itemType = JavaCompletionUtil.getLookupElementType(item); if (itemType != null) { for (PsiType expectedClass : myExpectedClasses) { if (expectedClass.isAssignableFrom(itemType)) { return Ex...
weigh
72,830
Integer (@NotNull LookupElement element) { final String name = getLookupObjectName(element.getObject()); return -getNameEndMatchingDegree(name, myExpectedTypes); }
weigh
72,831
Integer (@NotNull LookupElement element) { final Object object = element.getObject(); final String name = getLookupObjectName(object); if (name != null) { int max = 0; final List<String> wordsNoDigits = NameUtil.nameToWordsLowerCase(truncDigits(name)); for (ExpectedTypeInfo myExpectedInfo : myExpectedTypes) { String ex...
weigh
72,832
Integer (@NotNull LookupElement element) { final Object object = element.getObject(); final String name = getLookupObjectName(object); if (name != null && getNameEndMatchingDegree(name, myExpectedTypes) != 0) { return NameUtil.nameToWords(name).length - 1000; } return 0; }
weigh
72,833
Boolean (@NotNull LookupElement element) { Object object = element.getObject(); if (object instanceof PsiMethod method && element.getUserData(JavaCompletionUtil.FORCE_SHOW_SIGNATURE_ATTR) == null) { PsiClass containingClass = method.getContainingClass(); if (!method.isVarArgs() && containingClass != null && ContainerUt...
weigh
72,834
boolean (PsiMethod original, PsiMethod candidate) { return candidate.hasModifierProperty(PsiModifier.STATIC) == original.hasModifierProperty(PsiModifier.STATIC) && candidate.isVarArgs() && candidate.getParameterList().getParametersCount() == 1 && PsiResolveHelper.getInstance(candidate.getProject()).isAccessible(candida...
isPurelyVarargOverload
72,835
Classifier<LookupElement> (Classifier<LookupElement> next) { return new LiftShorterItemsClassifier("liftShorterClasses", next, new LiftShorterItemsClassifier.LiftingCondition() { @Override public boolean shouldLift(LookupElement shorterElement, LookupElement longerElement) { Object object = shorterElement.getObject(); ...
createClassifier
72,836
boolean (LookupElement shorterElement, LookupElement longerElement) { Object object = shorterElement.getObject(); if (object instanceof PsiClass psiClass && longerElement.getObject() instanceof PsiClass) { PsiFile file = psiClass.getContainingFile(); if (file != null) { VirtualFile vFile = file.getOriginalFile().getVir...
shouldLift
72,837
boolean (PsiFile file) { return file instanceof JavaCodeFragment && !(file instanceof PsiExpressionCodeFragment || file instanceof PsiJavaCodeReferenceCodeFragment || file instanceof PsiTypeCodeFragment); }
isStatementCodeFragment
72,838
boolean (@NotNull PsiElement element) { PsiElement prev = prevSignificantLeaf(element); if (prev == null) { PsiFile file = element.getContainingFile(); return !(file instanceof PsiCodeFragment) || isStatementCodeFragment(file); } if (psiElement().inside(psiAnnotation()).accepts(prev)) return false; if (prev instanceof ...
isEndOfBlock
72,839
PsiElement (PsiElement position) { return FilterPositionUtil.searchNonSpaceNonCommentBack(position); }
prevSignificantLeaf
72,840
void (LookupElement element) { if (myKeywordMatcher.isStartMatch(element.getLookupString())) { myResults.add(element); } }
addKeyword
72,841
boolean (PsiElement position) { PsiElement prev = PsiTreeUtil.prevVisibleLeaf(position); PsiModifierList modifierList = PsiTreeUtil.getParentOfType(prev, PsiModifierList.class); if (modifierList != null) { if (PsiTreeUtil.isAncestor(modifierList, position, false)) { return false; } PsiElement parent = modifierList.getP...
isInsideParameterList
72,842
TailType (PsiElement position) { PsiElement scope = position; while (true) { if (scope instanceof PsiFile || scope instanceof PsiClassInitializer) { return TailTypes.noneType(); } if (scope instanceof PsiMethod method) { if (method.isConstructor() || PsiTypes.voidType().equals(method.getReturnType())) { return TailType...
getReturnTail
72,843
void () { if (psiElement() .withText("}
addStatementKeywords
72,844
LookupElement () { TailType returnTail = getReturnTail(myPosition); LookupElement ret = createKeyword(PsiKeyword.RETURN); if (returnTail != TailTypes.noneType()) { ret = new OverridableSpace(ret, returnTail); } return ret; }
createReturnKeyword
72,845
void () { if (!HighlightingFeature.PATTERNS_IN_SWITCH.isAvailable(myPosition)) return; PsiCaseLabelElementList labels = PsiTreeUtil.getParentOfType(myPosition, PsiCaseLabelElementList.class); if (labels == null || labels.getElementCount() != 2 || !(labels.getElements()[0] instanceof PsiLiteralExpression literalExpressi...
addCaseAfterNullDefault
72,846
boolean () { if (PsiTreeUtil.getNonStrictParentOfType(myPosition, PsiLiteralExpression.class, PsiComment.class) != null) { return false; } if (psiElement().afterLeaf("::").accepts(myPosition)) { return false; } return true; }
canAddKeywords
72,847
void () { if (!HighlightingFeature.PATTERN_GUARDS_AND_RECORD_PATTERNS.isAvailable(myPosition)) { return; } PsiElement element = PsiTreeUtil.skipWhitespacesAndCommentsForward(myPrevLeaf); if (element instanceof PsiErrorElement) { return; } element = PsiTreeUtil.skipWhitespacesAndCommentsBackward(PsiTreeUtil.prevLeaf(myP...
addWhen
72,848
void (@NotNull PsiSwitchLabeledRuleStatement rule) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.THROW), TailTypes.insertSpaceType())); addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeyword.ASSERT), TailTypes.insertSpaceType()))); addKeyword(wrapRuleIntoBlock(new OverridableSpace(creat...
addSwitchRuleKeywords
72,849
LookupElement (LookupElement element) { return new LookupElementDecorator<>(element) { @Override public void handleInsert(@NotNull InsertionContext context) { PsiStatement statement = PsiTreeUtil.getParentOfType(context.getFile().findElementAt(context.getStartOffset()), PsiStatement.class); boolean isAfterArrow = false...
wrapRuleIntoBlock
72,850
void (@NotNull InsertionContext context) { PsiStatement statement = PsiTreeUtil.getParentOfType(context.getFile().findElementAt(context.getStartOffset()), PsiStatement.class); boolean isAfterArrow = false; if (statement != null) { if (statement.getParent() instanceof PsiCodeBlock) { PsiElement prevLeaf = PsiTreeUtil.pr...
handleInsert
72,851
PsiSwitchLabeledRuleStatement (PsiElement position) { PsiElement parent = position.getParent(); return parent.getParent() instanceof PsiExpressionStatement stmt && stmt.getParent() instanceof PsiSwitchLabeledRuleStatement rule ? rule : null; }
findEnclosingSwitchRule
72,852
void () { if (!isInsideCaseLabel()) return; final PsiSwitchBlock switchBlock = PsiTreeUtil.getParentOfType(myPosition, PsiSwitchBlock.class, false, PsiMember.class); if (switchBlock == null) return; final PsiType selectorType = getSelectorType(switchBlock); if (selectorType instanceof PsiPrimitiveType) return; addKeywo...
addCaseNullToSwitch
72,853
boolean () { if (!HighlightingFeature.PATTERNS_IN_SWITCH.isAvailable(myPosition)) return false; return psiElement().withSuperParent(2, PsiCaseLabelElementList.class).accepts(myPosition); }
isInsideCaseLabel
72,854
void () { if (isVarAllowed()) { addKeyword(createKeyword(PsiKeyword.VAR)); } }
addVar
72,855
boolean () { if (HighlightingFeature.VAR_LAMBDA_PARAMETER.isAvailable(myPosition) && isLambdaParameterType()) { return true; } if (!HighlightingFeature.LVTI.isAvailable(myPosition)) return false; if (isAtCatchOrResourceVariableStart(myPosition) && PsiTreeUtil.getParentOfType(myPosition, PsiCatchSection.class) == null) ...
isVarAllowed
72,856
boolean () { PsiElement position = myParameters.getOriginalPosition(); PsiParameterList paramList = PsiTreeUtil.getParentOfType(position, PsiParameterList.class); if (paramList != null && paramList.getParent() instanceof PsiLambdaExpression) { PsiParameter param = PsiTreeUtil.getParentOfType(position, PsiParameter.clas...
isLambdaParameterType
72,857
void () { if (psiElement().withText(")").withParents(PsiParameterList.class, PsiMethod.class).accepts(myPrevLeaf)) { assert myPrevLeaf != null; if (myPrevLeaf.getParent().getParent() instanceof PsiAnnotationMethod) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.DEFAULT), TailTypes.humbleSpaceBeforeWordType(...
addMethodHeaderKeywords
72,858
void () { PsiSwitchBlock switchBlock = getSwitchFromLabelPosition(myPosition); if (switchBlock == null) return; if (SwitchUtils.findDefaultElement(switchBlock) != null) { return; } addKeyword(new OverridableSpace(createKeyword(PsiKeyword.CASE), TailTypes.insertSpaceType())); final OverridableSpace defaultCaseRule = new...
addCaseDefault
72,859
void () { if (!HighlightingFeature.PATTERNS_IN_SWITCH.isAvailable(myPosition)) return; PsiSwitchBlock switchBlock = getSwitchFromLabelPosition(myPosition); if (switchBlock == null) return; final PsiType selectorType = getSelectorType(switchBlock); if (selectorType == null || selectorType instanceof PsiPrimitiveType) re...
addPatternMatchingInSwitchCases
72,860
Set<String> (@Nullable PsiSwitchBlock block, PsiElement position) { HashSet<String> labels = new HashSet<>(); if (block == null) { return labels; } PsiCodeBlock body = block.getBody(); if (body == null) { return labels; } int offset = position.getTextRange().getStartOffset(); for (PsiStatement statement : body.getState...
getSwitchCoveredLabels
72,861
void (@NotNull PsiType type, Set<String> containedLabels) { final PsiResolveHelper resolver = JavaPsiFacade.getInstance(myPosition.getProject()).getResolveHelper(); PsiClass aClass = resolver.resolveReferencedClass(type.getCanonicalText(), null); if (aClass == null) { aClass = PsiUtil.resolveClassInClassTypeOnly(type);...
addSealedHierarchyCases
72,862
LookupElement (@NotNull String caseRuleName, TailType tailType, @Nullable PsiSwitchBlock switchBlock) { final String prefix = "case "; final LookupElement lookupElement = LookupElementBuilder .create(prefix + caseRuleName) .bold() .withPresentableText(prefix) .withTailText(caseRuleName) .withLookupString(caseRuleName);...
createCaseRule
72,863
PsiSwitchBlock (PsiElement position) { PsiStatement statement = PsiTreeUtil.getParentOfType(position, PsiStatement.class, false, PsiMember.class); if (statement == null || statement.getTextRange().getStartOffset() != position.getTextRange().getStartOffset()) { return null; } if (!(statement instanceof PsiSwitchLabelSta...
getSwitchFromLabelPosition
72,864
LookupElement (@NotNull LookupElement decorator, @Nullable PsiSwitchBlock switchBlock) { if (switchBlock == null) { return decorator; } PsiCodeBlock body = switchBlock.getBody(); if (body == null) { return decorator; } PsiStatement[] statements = body.getStatements(); if (statements.length == 0) { return decorator; } i...
prioritizeForRule
72,865
void () { if (SUPER_OR_THIS_PATTERN.accepts(myPosition)) { final boolean afterDot = AFTER_DOT.accepts(myPosition); final boolean insideQualifierClass = isInsideQualifierClass(); final boolean insideInheritorClass = HighlightingFeature.EXTENSION_METHODS.isAvailable(myPosition) && isInsideInheritorClass(); if (!afterDot ...
addThisSuper
72,866
boolean (InsertionContext context, LookupElement item) { return hasParams; }
placeCaretInsideParentheses
72,867
void (@NotNull InsertionContext context, @NotNull LookupElement item) { super.handleInsert(context, item); TailType.insertChar(context.getEditor(), context.getTailOffset(), ';'); }
handleInsert
72,868
void (boolean statementPosition) { if (isExpressionPosition(myPosition)) { PsiElement parent = myPosition.getParent(); PsiElement grandParent = parent == null ? null : parent.getParent(); boolean allowExprKeywords = !(grandParent instanceof PsiExpressionStatement) && !(grandParent instanceof PsiUnaryExpression); if (Ps...
addExpressionKeywords
72,869
boolean () { if (myPosition.getParent() instanceof PsiReferenceExpression) { PsiExpression qualifier = ((PsiReferenceExpression)myPosition.getParent()).getQualifierExpression(); PsiClass qualifierClass = PsiUtil.resolveClassInClassTypeOnly(qualifier == null ? null : qualifier.getType()); return qualifierClass != null &...
isQualifiedNewContext
72,870
boolean (PsiClass outer, PsiClass inner) { PsiMethod[] constructors = inner.getConstructors(); return !inner.hasModifierProperty(PsiModifier.STATIC) && PsiUtil.isAccessible(inner, myPosition, outer) && (constructors.length == 0 || ContainerUtil.exists(constructors, c -> PsiUtil.isAccessible(c, myPosition, outer))); }
canBeCreatedInQualifiedNew
72,871
void () { PsiFile file = myPosition.getContainingFile(); assert file != null; if (!(file instanceof PsiExpressionCodeFragment) && !(file instanceof PsiJavaCodeReferenceCodeFragment) && !(file instanceof PsiTypeCodeFragment)) { if (myPrevLeaf == null) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.PACKAGE), ...
addFileHeaderKeywords
72,872
void () { if (isInstanceofPlace(myPosition)) { addKeyword(LookupElementDecorator.withInsertHandler( createKeyword(PsiKeyword.INSTANCEOF), (context, item) -> { TailType tailType = TailTypes.humbleSpaceBeforeWordType(); if (tailType.isApplicable(context)) { tailType.processTail(context.getEditor(), context.getTailOffset(...
addInstanceof
72,873
void () { if (isSuitableForClass(myPosition)) { for (String s : ModifierChooser.getKeywords(myPosition)) { addKeyword(new OverridableSpace(createKeyword(s), TailTypes.humbleSpaceBeforeWordType())); } if (psiElement().insideStarting(psiElement(PsiLocalVariable.class, PsiExpressionStatement.class)).accepts(myPosition)) {...
addClassKeywords
72,874
LookupElement (String keyword, String className) { LookupElement element; PsiElement nextElement = PsiTreeUtil.skipWhitespacesAndCommentsForward(PsiTreeUtil.nextLeaf(myPosition)); IElementType nextToken; if (nextElement instanceof PsiJavaToken) { nextToken = ((PsiJavaToken)nextElement).getTokenType(); } else { if (next...
createTypeDeclaration
72,875
String () { if (myPrevLeaf == null) return null; if (!myPrevLeaf.textMatches(PsiKeyword.PUBLIC) || !(myPrevLeaf.getParent() instanceof PsiModifierList)) return null; if (nextIsIdentifier(myPosition)) return null; PsiJavaFile file = getFileForDeclaration(myPrevLeaf); if (file == null) return null; String name = file.get...
recommendClassName
72,876
boolean (@NotNull PsiElement position) { PsiElement nextLeaf = PsiTreeUtil.nextLeaf(position); if (nextLeaf == null) return false; PsiElement parent = nextLeaf.getParent(); if (!(parent instanceof PsiJavaCodeReferenceElement)) return false; PsiElement grandParent = parent.getParent(); if (!(grandParent instanceof PsiTy...
nextIsIdentifier
72,877
PsiJavaFile (@NotNull PsiElement elementBeforeName) { PsiElement parent = elementBeforeName.getParent(); if (parent == null) return null; PsiElement grandParent = parent.getParent(); if (grandParent == null) return null; if (grandParent instanceof PsiJavaFile f) { return f; } PsiElement grandGrandParent = grandParent.g...
getFileForDeclaration
72,878
void () { if (isAfterTypeDot(myPosition)) { addKeyword(createKeyword(PsiKeyword.CLASS)); } }
addClassLiteral
72,879
void () { if (myPrevLeaf == null || !(myPrevLeaf instanceof PsiIdentifier || myPrevLeaf.textMatches(">") || myPrevLeaf.textMatches(")"))) { return; } PsiClass psiClass = null; PsiElement prevParent = myPrevLeaf.getParent(); if (myPrevLeaf instanceof PsiIdentifier && prevParent instanceof PsiClass) { psiClass = (PsiClas...
addExtendsImplements
72,880
boolean (CompletionParameters parameters) { for (ExpectedTypeInfo info : JavaSmartCompletionContributor.getExpectedTypes(parameters)) { PsiType type = info.getType(); if (type instanceof PsiClassType || PsiTypes.booleanType().equals(type)) return true; } return false; }
mayExpectBoolean
72,881
boolean (PsiElement position) { if (psiElement().insideStarting(psiElement(PsiClassObjectAccessExpression.class)).accepts(position)) return true; PsiElement parent = position.getParent(); if (!(parent instanceof PsiReferenceExpression) || ((PsiReferenceExpression)parent).isQualified() || JavaCompletionContributor.IN_SW...
isExpressionPosition
72,882
boolean (PsiElement position) { PsiElement prev = PsiTreeUtil.prevVisibleLeaf(position); if (prev == null) return false; PsiElement expr = PsiTreeUtil.getParentOfType(prev, PsiExpression.class); if (expr != null && expr.getTextRange().getEndOffset() == prev.getTextRange().getEndOffset() && PsiTreeUtil.getParentOfType(e...
isInstanceofPlace
72,883
boolean (PsiElement position) { if (psiElement().afterLeaf("@").accepts(position) || PsiTreeUtil.getNonStrictParentOfType(position, PsiLiteralExpression.class, PsiComment.class, PsiExpressionCodeFragment.class) != null) { return false; } PsiElement prev = prevSignificantLeaf(position); if (prev == null) { return true; ...
isSuitableForClass
72,884
boolean (PsiElement element) { return psiElement().withParent( psiReferenceExpression().withFirstChild( psiElement(PsiClassObjectAccessExpression.class).withLastChild( not(psiElement().withText(PsiKeyword.CLASS))))).accepts(element); }
isAfterPrimitiveOrArrayType
72,885
boolean (PsiElement position) { if (isInsideParameterList(position) || position.getContainingFile() instanceof PsiJavaCodeReferenceCodeFragment) { return false; } return psiElement().afterLeaf(psiElement().withText(".").afterLeaf(CLASS_REFERENCE)).accepts(position) || isAfterPrimitiveOrArrayType(position); }
isAfterTypeDot
72,886
void (Consumer<? super LookupElement> result, PsiElement position, JavaCompletionSession session) { if (AFTER_DOT.accepts(position) || psiElement().inside(psiAnnotation()).accepts(position) && !expectsClassLiteral(position)) { return; } boolean afterNew = JavaSmartCompletionContributor.AFTER_NEW.accepts(position) && !p...
addPrimitiveTypes
72,887
boolean (PsiElement position) { PsiElement parent = position.getParent(); if (parent instanceof PsiJavaCodeReferenceElement && parent.getParent() instanceof PsiTypeElement && parent.getParent().getParent() instanceof PsiDeclarationStatement) { return true; } return START_FOR.accepts(position) || isInsideParameterList(p...
isVariableTypePosition
72,888
boolean (@NotNull PsiElement position) { if (psiElement().afterLeaf("@", ".").accepts(position)) return false; PsiElement parent = position.getParent(); if (parent instanceof PsiJavaCodeReferenceElement && parent.getParent() instanceof PsiTypeElement) { PsiElement typeHolder = psiApi().parents(parent.getParent()).skipW...
isDeclarationStart
72,889
boolean (PsiElement position) { return ContainerUtil.find(JavaSmartCompletionContributor.getExpectedTypes(position, false), info -> InheritanceUtil.isInheritor(info.getType(), CommonClassNames.JAVA_LANG_CLASS)) != null; }
expectsClassLiteral
72,890
boolean (PsiElement position) { PsiElement type = PsiTreeUtil.getParentOfType(position, PsiTypeElement.class); if (type != null && type.getTextRange().getStartOffset() == position.getTextRange().getStartOffset()) { PsiElement parent = type.getParent(); if (parent instanceof PsiVariable) parent = parent.getParent(); ret...
isAtCatchOrResourceVariableStart
72,891
void () { PsiLoopStatement loop = PsiTreeUtil.getParentOfType(myPosition, PsiLoopStatement.class, true, PsiLambdaExpression.class, PsiMember.class); LookupElement br = createKeyword(PsiKeyword.BREAK); LookupElement cont = createKeyword(PsiKeyword.CONTINUE); TailType tailType; if (psiElement().insideSequence(true, psiEl...
addBreakContinue
72,892
boolean (PsiElement position) { if (psiElement() .withSuperParent(2, PsiConditionalExpression.class) .andNot(psiElement().insideStarting(psiElement(PsiConditionalExpression.class))) .accepts(position)) { return false; } if (isEndOfBlock(position) && PsiTreeUtil.getParentOfType(position, PsiCodeBlock.class, true, PsiMem...
isStatementPosition
72,893
boolean (PsiElement position) { PsiStatement statement = PsiTreeUtil.getParentOfType(position, PsiStatement.class); if (statement == null) return false; return statement instanceof PsiForStatement || statement.getParent() instanceof PsiForStatement && statement != ((PsiForStatement)statement.getParent()).getBody(); }
isForLoopMachinery
72,894
LookupElement (String keyword) { return BasicExpressionCompletionContributor.createKeywordLookupItem(myPosition, keyword); }
createKeyword
72,895
boolean () { if (myPosition.getParent() instanceof PsiJavaCodeReferenceElement) { final PsiElement qualifier = ((PsiJavaCodeReferenceElement)myPosition.getParent()).getQualifier(); if (qualifier instanceof PsiJavaCodeReferenceElement) { final PsiElement qualifierClass = ((PsiJavaCodeReferenceElement)qualifier).resolve(...
isInsideQualifierClass
72,896
boolean () { if (myPosition.getParent() instanceof PsiJavaCodeReferenceElement) { final PsiElement qualifier = ((PsiJavaCodeReferenceElement)myPosition.getParent()).getQualifier(); if (qualifier instanceof PsiJavaCodeReferenceElement) { final PsiElement qualifierClass = ((PsiJavaCodeReferenceElement)qualifier).resolve(...
isInsideInheritorClass
72,897
boolean (PsiMethod method) { final PsiClass psiClass = method.getContainingClass(); if (psiClass == null) { return false; } final PsiClass superClass = psiClass.getSuperClass(); if (superClass != null) { for (final PsiMethod psiMethod : superClass.getConstructors()) { final PsiResolveHelper resolveHelper = JavaPsiFacad...
superConstructorHasParameters
72,898
void () { PsiElement context = PsiTreeUtil.skipParentsOfType(myPosition.getParent(), PsiErrorElement.class, PsiJavaCodeReferenceElement.class, PsiTypeElement.class); PsiElement prevElement = PsiTreeUtil.skipWhitespacesAndCommentsBackward(myPosition.getParent()); if (context instanceof PsiJavaFile && !(prevElement insta...
addModuleKeywords
72,899
TailType (InsertionContext context) { return context.shouldAddCompletionChar() ? TailTypes.noneType() : myTail; }
computeTailType