Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
73,100
void (@NotNull PrefixMatcher matcher, @NotNull Consumer<? super LookupElement> consumer) { GlobalSearchScope scope = myPosition.getResolveScope(); Collection<String> memberNames = JavaStaticMemberNameIndex.getInstance().getAllKeys(myProject); for (String memberName : matcher.sortMatching(memberNames)) { Set<PsiClass> c...
processStaticMethodsGlobally
73,101
void (@NotNull Consumer<? super LookupElement> consumer, PsiMember member, Set<PsiClass> classesToSkip) { if (isStaticallyImportable(member)) { PsiClass containingClass = member.getContainingClass(); assert containingClass != null : member.getName() + "; " + member + "; " + member.getClass(); if (JavaCompletionUtil.isS...
processStaticMember
73,102
boolean (PsiMember member) { return true; }
additionalFilter
73,103
LookupElement (@NotNull PsiMethod method, @NotNull PsiClass containingClass, boolean shouldImport) { List<PsiMethod> overloads = ContainerUtil.findAll(containingClass.findMethodsByName(method.getName(), true), this::isStaticallyImportable); assert !overloads.isEmpty(); if (overloads.size() == 1) { assert method == over...
createItemWithOverloads
73,104
void (boolean shouldImport) { if (!myHintShown && !shouldImport) { String shortcut = KeymapUtil.getFirstKeyboardShortcutText(IdeActions.ACTION_SHOW_INTENTION_ACTIONS); if (StringUtil.isNotEmpty(shortcut)) { CompletionService.getCompletionService().setAdvertisementText( JavaBundle.message("to.import.a.method.statically....
showHint
73,105
void (@NotNull Condition<? super String> nameCondition, @NotNull PairConsumer<? super PsiMember, ? super PsiClass> consumer) { for (PsiClass psiClass : myStaticImportedClasses) { for (PsiMethod method : psiClass.getAllMethods()) { if (nameCondition.value(method.getName())) { if (isStaticallyImportable(method)) { consum...
processMembersOfRegisteredClasses
73,106
boolean (@NotNull PsiMember member) { return member.hasModifierProperty(PsiModifier.STATIC) && isAccessible(member) && !isExcluded(member); }
isStaticallyImportable
73,107
boolean (@NotNull PsiMember method) { String name = PsiUtil.getMemberQualifiedName(method); return name != null && JavaProjectCodeInsightSettings.getSettings(method.getProject()).isExcluded(name); }
isExcluded
73,108
PsiElement () { return myPosition; }
getPosition
73,109
boolean (@NotNull PsiMember member) { return myResolveHelper.isAccessible(member, myPosition, null); }
isAccessible
73,110
void (@NotNull InsertionContext context) { FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_ASLIST); int startOffset = context.getStartOffset() - qualifierText.length(); final Project project = element.getProject(); final String callSpace = getSpace( CodeStyle.getLangu...
handleInsert
73,111
String (PsiType itemType, PsiType expectedType) { String methodName = "asList"; PsiType componentType = PsiUtil.extractIterableTypeParameter(expectedType, true); if (componentType == null) { methodName = "stream"; componentType = getStreamComponentType(expectedType); PsiPrimitiveType unboxedType = PsiPrimitiveType.getU...
getArraysConversionMethod
73,112
PsiType (PsiType expectedType) { return PsiUtil.substituteTypeParameter(expectedType, CommonClassNames.JAVA_UTIL_STREAM_BASE_STREAM, 0, true); }
getStreamComponentType
73,113
boolean (Object element, @Nullable PsiElement context) { return element != myExcluded; }
isAcceptable
73,114
boolean (Class hintClass) { return true; }
isClassAcceptable
73,115
boolean (@NotNull PsiElement element, ProcessingContext context) { PsiElement e = element.getParent(); while ((e = e.getNextSibling()) != null) { if (e instanceof PsiExpression && !(e instanceof PsiEmptyExpressionImpl)) return false; } return true; }
accepts
73,116
LookupElement (final PsiMethod takeParametersFrom, PsiElement call, PsiMethod invoked) { PsiParameter[] parameters = takeParametersFrom.getParameterList().getParameters(); String lookupString = StringUtil.join(parameters, PsiNamedElement::getName, ", "); IconManager iconManager = IconManager.getInstance(); int w = icon...
createParametersLookupElement
73,117
void (@NotNull InsertionContext context, @NotNull LookupElement item) { context.commitDocument(); int startOffset = context.getTailOffset(); PsiExpressionList exprList = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), startOffset - 1, PsiExpressionList.class, false); PsiElement rParen = exprList == null ? nul...
handleInsert
73,118
PsiMethod (PsiMethod place, PsiMethod invoked, PsiSubstitutor substitutor) { if (PsiSuperMethodUtil.isSuperMethod(place, invoked)) { return place; } Map<String, PsiType> requiredNames = new HashMap<>(); final PsiParameter[] parameters = place.getParameterList().getParameters(); final PsiParameter[] callParams = invoked...
getMethodToTakeParametersFrom
73,119
boolean (PsiElement position) { if (!JavaCompletionContributor.isInJavaContext(position) || !JavaSmartCompletionContributor.AFTER_NEW.accepts(position)) { return false; } PsiNewExpression newExpression = PsiTreeUtil.getParentOfType(position, PsiNewExpression.class); return newExpression != null && newExpression.getPare...
shouldAddArrayInitializer
73,120
void (PsiElement identifierCopy, ExpectedTypeInfo[] infos, final Consumer<? super LookupElement> consumer) { for (final PsiType type : ExpectedTypesGetter.extractTypes(infos, true)) { if (type instanceof PsiArrayType) { consumer.consume(createNewArrayItem(identifierCopy, type)); if (shouldAddArrayInitializer(identifier...
addArrayTypes
73,121
PsiTypeLookupItem (PsiElement context, PsiType type) { return PsiTypeLookupItem.createLookupItem(TypeConversionUtil.erasure(GenericsUtil.getVariableTypeByExpressionType(type)), context).setShowPackage(); }
createNewArrayItem
73,122
List<PsiClassType> (ExpectedTypeInfo[] infos) { final List<PsiClassType> expectedClassTypes = new SmartList<>(); for (PsiType type : ExpectedTypesGetter.extractTypes(infos, true)) { if (type instanceof PsiClassType classType && classType.resolve() != null) { expectedClassTypes.add(classType); } } return expectedClassTy...
extractClassTypes
73,123
LookupElement (final PsiType type, final CompletionParameters parameters) { if (!JavaCompletionUtil.hasAccessibleConstructor(type, parameters.getPosition())) return null; final PsiClass psiClass = PsiUtil.resolveClassInType(type); if (psiClass == null || psiClass.getName() == null) return null; PsiElement position = pa...
addExpectedType
73,124
boolean (PsiType @NotNull [] types, PsiElement position) { final PsiNewExpression newExpression = PsiTreeUtil.getParentOfType(position, PsiNewExpression.class, false); if (!PsiUtil.isLanguageLevel8OrHigher(position)) { return newExpression != null && PsiTypesUtil.getExpectedTypeByParent(newExpression) != null; } final ...
areInferredTypesApplicable
73,125
void (final CompletionParameters parameters, Collection<? extends PsiClassType> expectedClassTypes, final PrefixMatcher matcher, final Consumer<? super PsiType> consumer) { final PsiElement context = parameters.getPosition(); GlobalSearchScope scope = context.getResolveScope(); expectedClassTypes = ContainerUtil.mapNot...
processInheritors
73,126
boolean (PsiFile contextFile, PsiElement context, Collection<? extends PsiClassType> expectedClassTypes, Consumer<? super PsiType> consumer) { for (final PsiClassType type : expectedClassTypes) { consumer.consume(type); final PsiClassType.ClassResolveResult baseResult = JavaCompletionUtil.originalize(type).resolveGener...
processMostProbableInheritors
73,127
ThreeState (@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) { if (psiElement().inside(PsiDocTag.class).accepts(contextElement)) { if (hasKnownReference(psiFile, offset - 1)) { return ThreeState.NO; } if (PlatformPatterns.psiElement(JavaDocTokenType.DOC_TAG_NAME).accepts(contextElement)) { retu...
shouldSkipAutopopup
73,128
boolean (final PsiFile file, final int offset) { PsiReference reference = file.findReferenceAt(offset); return reference instanceof PsiMultiReference ? ContainerUtil.exists(((PsiMultiReference)reference).getReferences(), JavadocCompletionConfidence::isKnownReference) : isKnownReference(reference); }
hasKnownReference
73,129
boolean (@Nullable PsiReference reference) { return reference instanceof PsiJavaReference || reference != null && reference.getElement() instanceof PsiDocParamRef; }
isKnownReference
73,130
boolean (@NotNull PsiElement position) { return JavaPsiConstructorUtil.isConstructorCall(PsiTreeUtil.getParentOfType(position, PsiMethodCallExpression.class)) && !JavaKeywordCompletion.AFTER_DOT.accepts(position); }
isInsideConstructorCall
73,131
boolean (PsiField field) { field = CompletionUtil.getOriginalOrSelf(field); for(ImplicitUsageProvider provider: ImplicitUsageProvider.EP_NAME.getExtensionList()) { if (provider.isImplicitWrite(field)) { return true; } } return false; }
isInitializedImplicitly
73,132
Set<PsiField> (PsiElement element) { PsiReferenceExpression ref = PsiTreeUtil.getNonStrictParentOfType(element, PsiReferenceExpression.class); if (ref == null) return Collections.emptySet(); final PsiStatement statement = PsiTreeUtil.getParentOfType(element, PsiStatement.class); //noinspection SSBasedInspection final P...
getNonInitializedFields
73,133
void (@NotNull PsiAssignmentExpression expression) { PsiExpression lExpression = expression.getLExpression(); if (lExpression instanceof PsiReferenceExpression && ExpressionUtil.isEffectivelyUnqualified((PsiReferenceExpression)lExpression)) { PsiElement target = ((PsiReferenceExpression)lExpression).resolve(); if (targ...
visitAssignmentExpression
73,134
void (@NotNull PsiMethodCallExpression expression) { if (expression.getTextRange().getStartOffset() < statement.getTextRange().getStartOffset()) { final PsiReferenceExpression methodExpression = expression.getMethodExpression(); if (methodExpression.textMatches(PsiKeyword.THIS)) { fields.clear(); } } super.visitMethodC...
visitMethodCallExpression
73,135
boolean (boolean allowNonFinalFields, PsiClass placeClass, PsiField field) { if (field.hasModifierProperty(PsiModifier.STATIC)) return true; if (field.getContainingClass() == placeClass) { if (isInitializedBeforeConstructor(field, placeClass) || isInitializedImplicitly(field)) { return true; } } return allowNonFinalFie...
seemsInitialized
73,136
boolean (PsiField field, PsiClass containingClass) { if (field.getInitializer() != null) return true; return ContainerUtil.exists(containingClass.getInitializers(), i -> !i.hasModifierProperty(PsiModifier.STATIC) && VariableAccessUtils.variableIsAssigned(field, i, false)); }
isInitializedBeforeConstructor
73,137
boolean (Object element, @Nullable PsiElement context) { PsiMethod method = MethodParameterInfoHandler.tryGetMethodFromCandidate(element); if (method != null) { element = method; } if (element instanceof PsiField) { return !myNonInitializedFields.contains(element); } if (element instanceof PsiMethod && myInsideConstruc...
isAcceptable
73,138
boolean (Class hintClass) { return true; }
isClassAcceptable
73,139
PsiType () { final Template template = getTemplate(); String text = template.getTemplateText(); StringBuilder resultingText = new StringBuilder(text); int segmentsCount = template.getSegmentsCount(); for (int j = segmentsCount - 1; j >= 0; j--) { if (template.getSegmentName(j).equals(TemplateImpl.END)) { continue; } re...
getType
73,140
ElementFilter (PsiElement element, boolean allowRecursion) { //throw foo if (psiElement().withParent(psiElement(PsiReferenceExpression.class).withParent(PsiThrowStatement.class)).accepts(element)) { return TrueFilter.INSTANCE; } if (psiElement().inside(StandardPatterns.or(psiElement(PsiAnnotationParameterList.class), J...
getReferenceFilter
73,141
boolean (Object element, @Nullable PsiElement context) { return element != foreach.getIterationParameter(); }
isAcceptable
73,142
boolean (Class hintClass) { return true; }
isClassAcceptable
73,143
List<LookupElement> (List<LookupElement> allRefSuggestions, Set<ExpectedTypeInfo> infos) { List<LookupElement> result = new ArrayList<>(); for (LookupElement item : allRefSuggestions) { if (matchesExpectedType(item, infos)) { if (item instanceof JavaMethodCallElement) { checkTooGeneric((JavaMethodCallElement)item); } r...
smartCompleteReference
73,144
boolean (LookupElement item, Set<ExpectedTypeInfo> infos) { return ContainerUtil.exists(infos, info -> matchesExpectedType(item, info.getType())); }
matchesExpectedType
73,145
boolean (LookupElement item, PsiType type) { Object object = item.getObject(); if (object instanceof PsiClass) return false; if (PsiTypes.voidType().equals(type)) return object instanceof PsiMethod; PsiType itemType = JavaCompletionUtil.getLookupElementType(item); return itemType != null && type.isAssignableFrom(itemTy...
matchesExpectedType
73,146
Set<LookupElement> (PsiElement element, PsiJavaCodeReferenceElement reference, ElementFilter filter, PsiType expectedType, CompletionParameters parameters) { final Set<PsiField> used = parameters.getInvocationCount() < 2 ? findConstantsUsedInSwitch(element) : Collections.emptySet(); final Set<LookupElement> elements = ...
completeFinalReference
73,147
boolean (Object o, PsiElement context) { if (o instanceof CandidateInfo info) { final PsiElement member = info.getElement(); if (expectedType.equals(PsiTypes.voidType())) { return member instanceof PsiMethod; } if (member instanceof PsiEnumConstant && used.contains(CompletionUtil.getOriginalOrSelf(member))) { return fa...
isAcceptable
73,148
boolean (Class hintClass) { return true; }
isClassAcceptable
73,149
void (JavaMethodCallElement item) { if (JavaCompletionSorting.isTooGeneric(item, item.getObject())) { item.setAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE); } }
checkTooGeneric
73,150
Set<PsiField> (@Nullable PsiElement position) { return JavaCompletionContributor.IN_SWITCH_LABEL.accepts(position) ? findConstantsUsedInSwitch(Objects.requireNonNull(PsiTreeUtil.getParentOfType(position, PsiSwitchBlock.class))) : Collections.emptySet(); }
findConstantsUsedInSwitch
73,151
Set<PsiField> (@NotNull PsiSwitchBlock sw) { final PsiCodeBlock body = sw.getBody(); if (body == null) return Collections.emptySet(); Set<PsiField> used = new LinkedHashSet<>(); for (PsiStatement statement : body.getStatements()) { if (statement instanceof PsiSwitchLabelStatementBase) { final PsiCaseLabelElementList la...
findConstantsUsedInSwitch
73,152
PsiExpression (String text, PsiElement element) { return JavaPsiFacade.getElementFactory(element.getProject()).createExpressionFromText(text, element); }
createExpression
73,153
String (@Nullable final PsiElement qualifier) { return qualifier == null ? "" : qualifier.getText() + "."; }
getQualifierText
73,154
PsiReferenceExpression (PsiElement place, @NotNull PsiType qualifierType, LookupElement qualifierItem) { return createMockReference(place, qualifierType, qualifierItem, "."); }
createMockReference
73,155
PsiReferenceExpression (PsiElement place, @NotNull PsiType qualifierType, LookupElement qualifierItem, String separator) { PsiElementFactory factory = JavaPsiFacade.getElementFactory(place.getProject()); if (qualifierItem.getObject() instanceof PsiClass) { final String qname = ((PsiClass)qualifierItem.getObject()).getQ...
createMockReference
73,156
String (boolean needSpace) { return needSpace ? " " : ""; }
getSpace
73,157
void (@NotNull final CompletionParameters parameters, @NotNull final ProcessingContext context, @NotNull CompletionResultSet result) { final PsiElement position = parameters.getPosition(); boolean isArg = PsiJavaPatterns.psiElement().afterLeaf("(").accepts(position); PsiDocTag tag = PsiTreeUtil.getParentOfType(position...
addCompletions
73,158
void (@NotNull final CompletionParameters parameters, @NotNull final ProcessingContext context, @NotNull final CompletionResultSet result) { final PsiElement element = parameters.getPosition(); final Set<PsiClass> throwsSet = new HashSet<>(); final PsiMethod method = PsiTreeUtil.getContextOfType(element, PsiMethod.clas...
addCompletions
73,159
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiSnippetAttributeList list = ObjectUtils.tryCast(parameters.getPosition().getParent().getParent(), PsiSnippetAttributeList.class); if (list == null) return; for (String attribute : ATTRIBUTES) { ...
addCompletions
73,160
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiSnippetAttributeValue value = (PsiSnippetAttributeValue)parameters.getPosition(); PsiSnippetAttribute attribute = ObjectUtils.tryCast(value.getParent(), PsiSnippetAttribute.class); if (attribute...
addCompletions
73,161
void (@NotNull CompletionResultSet result, String id, boolean alreadyQuoted) { if (!alreadyQuoted && !StringUtil.isJavaIdentifier(id)) { result.addElement(LookupElementBuilder.create('"' + id + '"').withLookupStrings(List.of(id))); } else { result.addElement(LookupElementBuilder.create(id)); } }
addAttributeValue
73,162
List<LookupElement> (PsiElement position, PsiJavaReference ref) { JavaCompletionProcessor processor = new JavaCompletionProcessor(position, TrueFilter.INSTANCE, JavaCompletionProcessor.Options.CHECK_NOTHING, Conditions.alwaysTrue()); ref.processVariants(processor); return ContainerUtil.map(processor.getResults(), (comp...
completeJavadocReference
73,163
LookupElement (final Object element) { if (element instanceof PsiMethod) { return new JavaMethodCallElement((PsiMethod)element) { @Override public void handleInsert(@NotNull InsertionContext context) { new MethodSignatureInsertHandler().handleInsert(context, this); } }; } if (element instanceof PsiClass) { JavaPsiClass...
createReferenceLookupItem
73,164
void (@NotNull InsertionContext context) { new MethodSignatureInsertHandler().handleInsert(context, this); }
handleInsert
73,165
PsiParameter (PsiElement tag) { if (tag instanceof PsiDocTag && "param".equals(((PsiDocTag)tag).getName())) { PsiDocTagValue value = ((PsiDocTag)tag).getValueElement(); if (value instanceof PsiDocParamRef) { final PsiReference psiReference = value.getReference(); PsiElement target = psiReference != null ? psiReference....
getDocTagParam
73,166
void (@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet result) { PsiElement position = parameters.getPosition(); if (position instanceof PsiDocToken && ((PsiDocToken)position).getTokenType() == JavaDocTokenType.DOC_TAG_VALUE_TOKEN) { PsiElement parent = position.getParent(); if (parent...
fillCompletionVariants
73,167
void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result, @NotNull PsiElement position, boolean forceInlineTag) { TextRange rangeBefore = new TextRange(position.getTextRange().getStartOffset(), parameters.getOffset()); boolean hasOpeningBrace = rangeBefore.isEmpty() && position.getPrevSibling...
suggestTags
73,168
void (@NotNull CompletionResultSet result, PsiElement position) { PsiElement parent = position.getParent(); if (parent instanceof PsiInlineDocTag && !"code".equals(((PsiInlineDocTag)parent).getName())) { return; } if (!result.getPrefixMatcher().getPrefix().isEmpty()) { for (String keyword : ContainerUtil.ar("null", "tr...
suggestCodeLiterals
73,169
LookupElementBuilder (LookupElementBuilder element) { String tagText = "{@code " + element.getLookupString() + "}"; return element.withPresentableText(tagText).withInsertHandler( (context, item) -> context.getDocument().replaceString(context.getStartOffset(), context.getTailOffset(), tagText)); }
wrapIntoCodeTag
73,170
void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result, PsiElement position) { PrefixMatcher matcher = result.getPrefixMatcher(); int prefixStart = parameters.getOffset() - matcher.getPrefix().length() - position.getTextRange().getStartOffset(); String text = position.getText(); if (prefixS...
suggestLinkWrappingVariants
73,171
int (CharSequence text, int sharpOffset) { int offset = sharpOffset; while (offset > 0 && isQualifiedNamePart(text.charAt(offset - 1))) { offset--; } return offset; }
findClassNameStart
73,172
boolean (char c) { return c == '.' || Character.isJavaIdentifierPart(c); }
isQualifiedNamePart
73,173
void (CompletionResultSet result, PsiElement position, final PsiParameter param) { final Set<String> descriptions = new HashSet<>(); position.getContainingFile().accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { PsiParameter param1 = getDocTagParam(elemen...
suggestSimilarParameterDescriptions
73,174
void (@NotNull PsiElement element) { PsiParameter param1 = getDocTagParam(element); if (param1 != null && param1 != param && Objects.equals(param1.getName(), param.getName()) && Comparing.equal(param1.getType(), param.getType())) { StringBuilder sb = new StringBuilder(); for (PsiElement psiElement : ((PsiDocTag)element...
visitElement
73,175
void (@NotNull final CompletionParameters parameters, @NotNull final ProcessingContext context, @NotNull final CompletionResultSet result) { final PsiElement position = parameters.getPosition(); final boolean isInline = position.getContext() instanceof PsiInlineDocTag; final List<String> ret = getTags(position, isInlin...
addCompletions
73,176
List<String> (PsiElement position, boolean isInline) { final PsiDocComment comment = PsiTreeUtil.getParentOfType(position, PsiDocComment.class); assert comment != null; JavadocTagInfo[] infos = getTagInfos(position, comment); final List<String> ret = new ArrayList<>(); for (JavadocTagInfo info : infos) { String tagName...
getTags
73,177
boolean (final List<? super String> result, PsiDocComment comment, String tagName) { if ("author".equals(tagName)) { result.add(tagName + " " + SystemProperties.getUserName()); return true; } if ("param".equals(tagName)) { List<PsiNamedElement> parameters = getParametersToSuggest(comment); for (PsiNamedElement paramete...
addSpecialTags
73,178
List<PsiNamedElement> (PsiDocComment comment) { List<PsiNamedElement> allParams = PsiDocParamRef.getAllParameters(comment); PsiDocTag[] tags = comment.getTags(); return ContainerUtil.filter(allParams, param -> !MissingJavadocInspection.hasTagForParameter(tags, param)); }
getParametersToSuggest
73,179
String (PsiNamedElement param) { String name = param.getName(); return param instanceof PsiTypeParameter ? "<" + name + ">" : name; }
nameForParamTag
73,180
void (@NotNull InsertionContext context, @NotNull LookupElement item) { String lookupString = item.getLookupString(); String tagName = lookupString.startsWith("@") ? lookupString.substring(1) : lookupString.startsWith("{@") ? lookupString.substring(2, lookupString.length() - 1) : lookupString; boolean hasParameter = IN...
handleInsert
73,181
void (@NotNull InsertionContext context, @NotNull JavaMethodCallElement item) { PsiDocumentManager.getInstance(context.getProject()).commitDocument(context.getEditor().getDocument()); final Editor editor = context.getEditor(); final PsiMethod method = item.getObject(); Document document = editor.getDocument(); final Ch...
handleInsert
73,182
void (@NotNull InsertionContext context, Editor editor, Document document, Project project, RangeMarker paramListMarker) { PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document); int tail = editor.getCaretModel().getOffset(); if (paramListMarker.isValid() && tail >= paramListMarker.ge...
startParameterListTemplate
73,183
void (final Project project, final Editor editor, InsertionContext context, int offset) { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); final PsiElement element = context.getFile().findElementAt(offset); final PsiDocComment docComment = PsiTreeUtil.getParentOfType(element, PsiDocComment....
shortenReferences
73,184
void (@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet resultSet) { resultSet.runRemainingContributors(parameters, r -> { if (!(r.getLookupElement().getPsiElement() instanceof PsiJShellSyntheticElement)) { resultSet.passResult(r); } }); }
fillCompletionVariants
73,185
Collection<LookupElement> (@NotNull PsiFile file, int invocationCount, @NotNull String prefix) { PsiClassOwner jvmFile = ObjectUtils.tryCast(file, PsiClassOwner.class); if (jvmFile == null) return Collections.emptyList(); List<LookupElement> result = new ArrayList<>(); for (PsiClass aClass : jvmFile.getClasses()) { Str...
getLookupElements
73,186
void (List<LookupElement> result, PsiClass aClass) { for (PsiMember[] members : new PsiMember[][] {aClass.getMethods(), aClass.getFields(), aClass.getInnerClasses()}) { for (PsiMember member : members) { if (!member.isPhysical()) continue; String memberName = member.getName(); if (memberName == null) continue; Icon ico...
processSyntheticClass
73,187
void (int invocationCount, List<LookupElement> result, PsiClass aClass, String infix, String memberPrefix, String rest) { for (PsiMember[] members : new PsiMember[][] {aClass.getMethods(), aClass.getFields(), aClass.getInnerClasses()}) { for (PsiMember member : members) { if (!member.isPhysical()) continue; String memb...
processClassBody
73,188
String (String currentPrefix, String className) { if (!currentPrefix.startsWith(className)) return null; for (String infix : new String[]{".", "#", "::"}) { if (currentPrefix.startsWith(infix, className.length())) { return infix; } } return null; }
getInfix
73,189
void (@NotNull final InsertionContext context, @NotNull final JavaPsiClassReferenceElement item) { int offset = context.getTailOffset() - 1; final PsiFile file = context.getFile(); PsiImportStatementBase importStatement = PsiTreeUtil.findElementOfClassAtOffset(file, offset, PsiImportStatementBase.class, false); if (imp...
handleInsert
73,190
void (InsertionContext context, int refEnd) { PsiTypeElement typeElem = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), refEnd, PsiTypeElement.class, false); if (typeElem != null) { int typeEnd = typeElem.getTextRange().getEndOffset(); context.getDocument().insertString(typeEnd, ">"); context.getEditor().getC...
wrapFollowingTypeInGenerics
73,191
void (InsertionContext context) { context.commitDocument(); PsiJavaCodeReferenceElement ref = findJavaReference(context.getFile(), context.getTailOffset() - 1); if (ref != null) { while (ref.getParent() instanceof PsiJavaCodeReferenceElement) ref = (PsiJavaCodeReferenceElement)ref.getParent(); context.getDocument().del...
overwriteTopmostReference
73,192
boolean (@NotNull JavaPsiClassReferenceElement item, @NotNull PsiFile file) { JavaCodeStyleSettings javaSettings = getInstance(file); return switch (javaSettings.CLASS_NAMES_IN_JAVADOC) { case FULLY_QUALIFY_NAMES_ALWAYS -> true; case FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED -> file instanceof PsiJavaFile javaFile && item.ge...
shouldInsertFqnInJavadoc
73,193
boolean (PsiElement position) { final PsiJavaCodeReferenceElement ref = PsiTreeUtil.getParentOfType(position, PsiJavaCodeReferenceElement.class); if (ref == null) { return false; } final PsiReferenceParameterList parameterList = ref.getParameterList(); if (parameterList != null && parameterList.getTextLength() > 0) { r...
shouldInsertParentheses
73,194
boolean (PsiExpression expr) { return ContainerUtil.exists(ExpectedTypesProvider.getExpectedTypes(expr, true), info -> { if (info.getType() instanceof PsiArrayType) { PsiMethod method = info.getCalledMethod(); return method == null || !method.isVarArgs() || !(expr.getParent() instanceof PsiExpressionList) || MethodCall...
isArrayTypeExpected
73,195
boolean (InsertionContext context, LookupElement item) { final Object obj = item.getObject(); if (!(obj instanceof PsiClass) || !((PsiClass)obj).isAnnotationType()) return false; PsiElement leaf = context.getFile().findElementAt(context.getStartOffset()); PsiAnnotation anno = PsiTreeUtil.getParentOfType(leaf, PsiAnnota...
insertingAnnotation
73,196
boolean (PsiClass annoClass) { for (PsiMethod m : annoClass.getMethods()) { if (!PsiUtil.isAnnotationMethod(m)) continue; if (((PsiAnnotationMethod)m).getDefaultValue() == null) return true; } return false; }
shouldHaveAnnotationParameters
73,197
void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { PsiTryStatement tryStatement = PsiTreeUtil.getParentOfType(parameters.getPosition(), PsiTryStatement.class); final PsiCodeBlock tryBlock = tryStatement == null ? null : tryStatement.getTryBlock(); if (tryBlock == null) return; final ...
addCompletions
73,198
int (@NotNull PsiClass superClass, @NotNull PsiClass subClass) { int numberOfHops = 0; while (true) { if (subClass.equals(superClass)) return numberOfHops; PsiClass next = subClass.getSuperClass(); if (next == null) return -1; numberOfHops++; subClass = next; } }
getNumberOfHops
73,199
LookupElement (PsiCodeBlock tryBlock, PsiClassType type) { return TailTypeDecorator.withTail(PsiTypeLookupItem.createLookupItem(type, tryBlock), TailTypes.humbleSpaceBeforeWordType()); }
createCatchTypeVariant