Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
51,600
boolean () { return false; }
isCommentInContext
51,601
boolean (@NotNull PsiElement element) { return true; }
isInContext
51,602
boolean () { return true; }
isCommentInContext
51,603
boolean (@NotNull PsiElement element) { PsiElement e = element; while (e != null) { if (e instanceof KtModifierList) { // skip property/function/class or object which is owner of modifier list e = e.getParent(); if (e != null) { e = e.getParent(); } continue; } if (e instanceof KtProperty || e instanceof KtNamedFunctio...
isInContext
51,604
boolean (@NotNull PsiElement element) { KtObjectDeclaration objectDeclaration = getParentClassOrObject(element, KtObjectDeclaration.class); return objectDeclaration != null && !objectDeclaration.isObjectLiteral(); }
isInContext
51,605
boolean (@NotNull PsiElement element) { return getParentClassOrObject(element, KtClassOrObject.class) != null; }
isInContext
51,606
boolean (@NotNull PsiElement element) { PsiElement parentStatement = PsiTreeUtil.findFirstParent(element, e -> e instanceof KtExpression && KtPsiUtil.isStatementContainer(e.getParent())); if (parentStatement == null) return false; // We are in the leftmost position in parentStatement return element.getTextOffset() == p...
isInContext
51,607
boolean (@NotNull PsiElement element) { return element.getParent() instanceof KtExpression && !(element.getParent() instanceof KtConstantExpression) && !(element.getParent().getParent() instanceof KtDotQualifiedExpression) && !(element.getParent() instanceof KtParameter); }
isInContext
51,608
boolean (@NotNull PsiElement element) { return false; }
isInContext
51,609
boolean () { return true; }
isCommentInContext
51,610
String[] () { return new String[]{"liveTemplates/Kotlin"}; }
getDefaultLiveTemplateFiles
51,611
String[] () { return new String[0]; }
getHiddenLiveTemplateFiles
51,612
void () {}
foo
51,613
void () {}
foo
51,614
StructureViewBuilder (@NotNull PsiFile psiFile) { if (!(psiFile instanceof KtFile file)) { return null; } return new TreeBasedStructureViewBuilder() { @Override public @NotNull StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new KotlinStructureViewModel(file, editor, new KotlinFirStructure...
getStructureViewBuilder
51,615
StructureViewModel (@Nullable Editor editor) { return new KotlinStructureViewModel(file, editor, new KotlinFirStructureViewElement(file, file, false)) { @Override public @NotNull Collection<NodeProvider<?>> getNodeProviders() { return NODE_PROVIDERS; } }; }
createStructureViewModel
51,616
boolean () { return !KotlinIconProvider.Companion.isSingleClassFile(file); }
isRootNodeShown
51,617
int (Operation other) { return 0; }
plus
51,618
int (Operation other) { return 0; }
compareTo
51,619
Bar () { return null; }
getBar1
51,620
Bar () { return new Bar(); }
getBar2
51,621
void () { super.setUp(); myFixture.enableInspections(KDocUnresolvedReferenceInspection.class); }
setUp
51,622
void () { super.setUp(); myFixture.enableInspections(KDocUnresolvedReferenceInspection.class); }
setUp
51,623
boolean () { return true; }
isFirPlugin
51,624
KotlinLightProjectDescriptor () { return KotlinWithJdkAndRuntimeLightProjectDescriptor.getInstance(); }
getDefaultProjectDescriptor
51,625
String (@NotNull PsiElement e) { assert e instanceof KtElement; return KotlinBundle.message(key, ElementRenderingUtilsKt.getExpressionShortText((KtElement) e)); }
getDescription
51,626
boolean (@NotNull KtExpression expression, @NotNull KtElement parent) { if (expression instanceof KtBlockExpression block) { return block.getStatements().size() <= 1 || parent instanceof KtBlockExpression; } return true; }
canExtractExpression
51,627
boolean (PsiElement element) { return element instanceof PsiWhiteSpace; }
isWhiteSpace
51,628
void (@NotNull KtElement originalElement, @NotNull KtElement newElement) { if (myIsEffective) { originalElement.replace(newElement); } }
replace
51,629
Context () { return new Context(); }
createContext
51,630
KtElement (@NotNull KtLambdaExpression lambda) { PsiElement parent = lambda.getParent(); if (parent instanceof KtValueArgument) { KtCallExpression callExpression = PsiTreeUtil.getParentOfType(parent, KtCallExpression.class, true); if (callExpression != null) { PsiElement parentParent = callExpression.getParent(); if (p...
getLambdaEnclosingElement
51,631
boolean (PsiElement e) { if (!(e instanceof KtLambdaExpression lambda)) return false; KtBlockExpression body = lambda.getBodyExpression(); KtElement enclosingElement = getLambdaEnclosingElement(lambda); if (body == null || enclosingElement == null) return false; return canExtractExpression(body, (KtElement)enclosingEle...
isApplicableTo
51,632
PsiElement (@NotNull PsiElement e, @NotNull List<? super PsiElement> toExtract) { super.collectAffectedElements(e, toExtract); return getLambdaEnclosingElement((KtLambdaExpression) e); }
collectAffectedElements
51,633
KtElement (@NotNull KtElement element) { return element; }
getEnclosingElement
51,634
boolean (PsiElement e) { if (!(e instanceof KtElement)) return false; KtExpression expressionToUnwrap = getExpressionToUnwrap((KtElement) e); return expressionToUnwrap != null && canExtractExpression(expressionToUnwrap, (KtElement) getEnclosingElement((KtElement) e).getParent()); }
isApplicableTo
51,635
boolean (PsiElement e) { return e instanceof KtExpression && e.getParent() instanceof KtBlockExpression; }
isApplicableTo
51,636
KtExpression (@NotNull KtElement target) { return target instanceof KtIfExpression ? ((KtIfExpression) target).getElse() : null; }
getExpressionToUnwrap
51,637
KtExpression (@NotNull KtElement target) { return target instanceof KtIfExpression ? ((KtIfExpression) target).getThen() : null; }
getExpressionToUnwrap
51,638
boolean (PsiElement e) { return e instanceof KtIfExpression && ((KtIfExpression) e).getCondition() != null && ((KtIfExpression) e).getThen() != null && ((KtIfExpression) e).getElse() != null; }
isApplicableTo
51,639
KtExpression (@NotNull KtElement target) { return target instanceof KtLoopExpression ? ((KtLoopExpression) target).getBody() : null; }
getExpressionToUnwrap
51,640
KtExpression (@NotNull KtElement target) { return target instanceof KtTryExpression ? ((KtTryExpression) target).getTryBlock() : null; }
getExpressionToUnwrap
51,641
KtElement (@NotNull KtElement element) { return (KtElement)element.getParent(); }
getEnclosingElement
51,642
KtExpression (@NotNull KtElement target) { return target instanceof KtCatchClause ? ((KtCatchClause) target).getCatchBody() : null; }
getExpressionToUnwrap
51,643
boolean (PsiElement e) { return e instanceof KtCatchClause; }
isApplicableTo
51,644
boolean (PsiElement e) { return super.isApplicableTo(e) && getEnclosingElement((KtElement)e).getParent() instanceof KtBlockExpression; }
isApplicableTo
51,645
KtElement (@NotNull KtElement element) { return (KtElement)element.getParent(); }
getEnclosingElement
51,646
KtExpression (@NotNull KtElement target) { return target instanceof KtFinallySection ? ((KtFinallySection) target).getFinalExpression() : null; }
getExpressionToUnwrap
51,647
boolean (PsiElement e) { return e instanceof KtFinallySection; }
isApplicableTo
51,648
Unwrapper[] () { return new Unwrapper[] { new KotlinUnwrappers.KotlinExpressionRemover("remove.expression"), new KotlinUnwrappers.KotlinThenUnwrapper("unwrap.expression"), new KotlinUnwrappers.KotlinElseRemover("remove.else"), new KotlinUnwrappers.KotlinElseUnwrapper("unwrap.else"), new KotlinUnwrappers.KotlinLoopUnwra...
createUnwrappers
51,649
LineRange ( @NotNull PsiElement firstElement, @NotNull PsiElement lastElement, @NotNull Editor editor, LineRange oldRange ) { PsiElement parent = PsiTreeUtil.findCommonParent(firstElement, lastElement); int topExtension = 0; int bottomExtension = 0; if (parent instanceof KtFunctionLiteral) { KtBlockExpression block = (...
getSourceRange
51,650
int (@Nullable PsiElement element, @NotNull Editor editor, boolean first) { if (element == null) return -1; Document doc = editor.getDocument(); TextRange spaceRange = element.getTextRange(); return first ? doc.getLineNumber(spaceRange.getStartOffset()) : doc.getLineNumber(spaceRange.getEndOffset()); }
getElementLine
51,651
PsiElement (@Nullable PsiElement element, @NotNull Editor editor, boolean down) { if (element == null) return null; int line = getElementLine(element, editor, down); PsiElement lastElement = element; while (true) { if (lastElement == null) return null; PsiElement sibling = firstNonWhiteSibling(lastElement, down); if (g...
getLastNonWhiteSiblingInLine
51,652
KtAnnotationEntry (@Nullable PsiElement element) { if (element == null) return null; KtAnnotationEntry annotationEntry = PsiTreeUtil.getParentOfType(element, KtAnnotationEntry.class); if (annotationEntry == null) return null; KtAnnotationUseSiteTarget useSiteTarget = annotationEntry.getUseSiteTarget(); if (useSiteTarge...
getParentFileAnnotationEntry
51,653
boolean (PsiElement blockElement, PsiElement comment, KtBlockExpression block) { return PsiTreeUtil.isAncestor(block, blockElement, true) && comment instanceof PsiComment; }
checkCommentAtBlockBound
51,654
PsiElement (@NotNull PsiElement element, boolean down, @NotNull Class<? extends PsiElement> type) { return down ? PsiTreeUtil.getNextSiblingOfType(element, type) : PsiTreeUtil.getPrevSiblingOfType(element, type); }
getSiblingOfType
51,655
PsiElement (@NotNull LineRange lineRange, boolean down) { return firstNonWhiteElement(down ? lineRange.lastElement.getNextSibling() : lineRange.firstElement.getPrevSibling(), down); }
firstNonWhiteSibling
51,656
PsiElement (@NotNull PsiElement element, boolean down) { return firstNonWhiteElement(down ? element.getNextSibling() : element.getPrevSibling(), down); }
firstNonWhiteSibling
51,657
boolean (@NotNull Editor editor, @NotNull PsiFile file, @NotNull MoveInfo info, boolean down) { return (file instanceof KtFile) && super.checkAvailable(editor, file, info, down); }
checkAvailable
51,658
int (@NotNull CharSequence sequence, int index) { char ch = sequence.charAt(--index); while (Character.isWhitespace(ch)) { ch = sequence.charAt(--index); } return index; }
findNearestNonWhitespace
51,659
void (@NotNull Editor editor, @NotNull PsiFile file, @NotNull MoveInfo info, boolean down) { super.afterMove(editor, file, info, down); Document document = editor.getDocument(); if (moveEnumConstant) { CharSequence cs = document.getCharsSequence(); int end1 = findNearestNonWhitespace(cs, info.range1.getEndOffset()); ch...
afterMove
51,660
List<PsiElement> (@NotNull KtDeclaration declaration) { final List<PsiElement> memberSuspects = new ArrayList<>(); KtModifierList modifierList = declaration.getModifierList(); if (modifierList != null) memberSuspects.add(modifierList); if (declaration instanceof KtNamedDeclaration) { PsiElement nameIdentifier = ((KtNam...
getDeclarationAnchors
51,661
void (@NotNull KtClassInitializer initializer) { PsiElement brace = initializer.getOpenBraceNode(); if (brace != null) { memberSuspects.add(brace); } }
visitClassInitializer
51,662
void (@NotNull KtNamedFunction function) { PsiElement equalsToken = function.getEqualsToken(); if (equalsToken != null) memberSuspects.add(equalsToken); KtTypeParameterList typeParameterList = function.getTypeParameterList(); if (typeParameterList != null) memberSuspects.add(typeParameterList); KtTypeReference receiver...
visitNamedFunction
51,663
void (@NotNull KtProperty property) { PsiElement valOrVarKeyword = property.getValOrVarKeyword(); memberSuspects.add(valOrVarKeyword); KtTypeParameterList typeParameterList = property.getTypeParameterList(); if (typeParameterList != null) memberSuspects.add(typeParameterList); KtTypeReference receiverTypeRef = property...
visitProperty
51,664
KtDeclaration (@Nullable PsiElement element) { if (element == null) return null; if (getParentFileAnnotationEntry(element) != null) return null; KtDeclaration declaration = null; if (element.getNode().getElementType() == KtTokens.LBRACE) { KtLambdaExpression lambda = PsiTreeUtil.getParentOfType(element, KtLambdaExpress...
getMovableDeclaration
51,665
boolean (@NotNull PsiElement element) { return element instanceof KtDeclaration; }
checkSourceElement
51,666
LineRange (@NotNull PsiElement element, @NotNull Editor editor, @NotNull LineRange oldRange) { PsiElement first; PsiElement last; if (element instanceof KtDeclaration) { first = element.getFirstChild(); last = element.getLastChild(); if (first == null || last == null) return null; } else { first = last = element; } Tex...
getElementSourceLineRange
51,667
LineRange ( @NotNull Editor editor, @NotNull PsiElement sibling, boolean down, @NotNull PsiElement target ) { PsiElement start = sibling; PsiElement end = sibling; PsiElement nextParent; // moving out of code block if (isMovingOutOfBlock(sibling, down)) { // elements which aren't immediately placed in class body can't ...
getTargetRange
51,668
boolean (@NotNull PsiElement sibling, boolean down) { return sibling.getNode().getElementType() == (down ? KtTokens.RBRACE : KtTokens.LBRACE); }
isMovingOutOfBlock
51,669
KtClassBody (PsiElement element) { if (element instanceof KtClassOrObject) { return ((KtClassOrObject) element).getBody(); } else { return null; } }
getClassBody
51,670
boolean (@NotNull Editor editor, @NotNull PsiFile file, @NotNull MoveInfo info, boolean down) { if (!super.checkAvailable(editor, file, info, down)) return false; LineRange oldRange = info.toMove; Pair<PsiElement, PsiElement> psiRange = getElementRange(editor, file, oldRange); if (psiRange == null) return false; KtDecl...
checkAvailable
51,671
boolean () { return false; }
isExclusive
51,672
String () { return CodeInsightBundle.message("surround.with.if.template"); }
getTemplateDescription
51,673
String () { return "if (a) { \n}"; }
getCodeTemplate
51,674
boolean () { return true; }
isGenerateDefaultInitializers
51,675
boolean () { return false; }
isApplicableWhenUsedAsExpression
51,676
TextRange (@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement container, PsiElement @NotNull [] statements) { statements = MoveDeclarationsOutHelperKt.move(container, statements, isGenerateDefaultInitializers()); if (statements.length == 0) { return null; } KtIfExpression ifExpression = (KtIfExpressi...
surroundStatements
51,677
TextRange (Editor editor, @NotNull KtIfExpression ifExpression) { KtExpression condition = ifExpression.getCondition(); assert condition != null : "Condition should exists for created if expression: " + ifExpression.getText(); // Delete condition from created if TextRange range = condition.getTextRange(); TextRange tex...
getRange
51,678
String () { return "try { \n} finally {\nb\n}"; }
getCodeTemplate
51,679
TextRange (@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement container, PsiElement @NotNull[] statements) { TextRange textRange = super.surroundStatements(project, editor, container, statements); if (textRange == null) { return null; } // Delete dummy "b" element for caret editor.getDocument().delet...
surroundStatements
51,680
TextRange (@NotNull KtTryExpression expression) { KtFinallySection block = expression.getFinallyBlock(); assert block != null : "Finally block should exists for " + expression.getText(); KtExpression blockExpression = block.getFinalExpression().getStatements().get(0); return blockExpression.getTextRange(); }
getTextRangeForCaret
51,681
String () { return CodeInsightBundle.message("surround.with.try.finally.template"); }
getTemplateDescription
51,682
boolean () { return false; }
isExclusive
51,683
boolean () { return false; }
isApplicableWhenUsedAsExpression
51,684
TextRange (@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement container, PsiElement @NotNull [] statements) { statements = MoveDeclarationsOutHelperKt.move(container, statements, true); if (statements.length == 0) { return null; } KtTryExpression tryExpression = (KtTryExpression) new KtPsiFactory(pro...
surroundStatements
51,685
TextRange (@NotNull KtTryExpression expression) { KtParameter parameter = expression.getCatchClauses().get(0).getCatchParameter(); assert parameter != null : "Catch parameter should exists for " + expression.getText(); KtElement typeReference = parameter.getTypeReference(); assert typeReference != null : "Type referenc...
getCatchTypeParameterTextRange
51,686
String () { return "try { \n} catch(e: Exception) {\nTODO(\"Not yet implemented\")\n}"; }
getCodeTemplate
51,687
TextRange (@NotNull KtTryExpression expression) { return getCatchTypeParameterTextRange(expression); }
getTextRangeForCaret
51,688
String () { return KotlinCodeInsightBundle.message("surround.with.try.catch.template"); }
getTemplateDescription
51,689
String () { return CodeInsightBundle.message("surround.with.ifelse.template"); }
getTemplateDescription
51,690
String () { return "if (a) { \n} else { \n}"; }
getCodeTemplate
51,691
boolean () { return false; }
isGenerateDefaultInitializers
51,692
String () { return "try { \n} catch(e: Exception) {\nTODO(\"Not yet implemented\")\n} finally {\n}"; }
getCodeTemplate
51,693
TextRange (@NotNull KtTryExpression expression) { return getCatchTypeParameterTextRange(expression); }
getTextRangeForCaret
51,694
String () { return KotlinCodeInsightBundle.message("surround.with.try.catch.finally.template"); }
getTemplateDescription
51,695
TextRange (@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement container, PsiElement @NotNull [] statements) { statements = MoveDeclarationsOutHelperKt.move(container, statements, true); if (statements.length == 0) { return null; } KtPsiFactory psiFactory = new KtPsiFactory(project); KtCallExpression ...
surroundStatements
51,696
String () { //noinspection DialogTitleCapitalization,HardCodedStringLiteral return "run { }"; }
getTemplateDescription
51,697
String () { return "\"${expr}\""; }
getTemplateDescription
51,698
boolean (@NotNull KtExpression expression) { return !(expression instanceof KtStringTemplateExpression) && super.isApplicable(expression); }
isApplicable
51,699
TextRange (@NotNull Project project, @NotNull Editor editor, @NotNull KtExpression expression) { KtStringTemplateExpression stringTemplateExpression = (KtStringTemplateExpression) new KtPsiFactory(expression.getProject()).createExpression(getCodeTemplate(expression)); KtStringTemplateEntry templateEntry = stringTemplat...
surroundExpression