Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
255,000
List<HighlightInfo> (@NotNull HighlightSeverity minimalSeverity) { return ContainerUtil.filter(doHighlighting(), info -> info.getSeverity().compareTo(minimalSeverity) >= 0); }
doHighlighting
255,001
String () { return myTestDataPath; }
getTestDataPath
255,002
void (@NotNull String dataPath) { myTestDataPath = dataPath; }
setTestDataPath
255,003
Project () { return myProjectFixture.getProject(); }
getProject
255,004
Module () { return myProjectFixture.getModule(); }
getModule
255,005
Editor () { return editor; }
getEditor
255,006
int () { return editor.getCaretModel().getOffset(); }
getCaretOffset
255,007
PsiFile () { return myFile != null ? ReadAction.compute(() -> PsiManager.getInstance(getProject()).findFile(myFile)) : null; }
getFile
255,008
void (@NotNull VirtualFile file) { assert myVirtualFileFilter instanceof FileTreeAccessFilter : "configured filter does not support this method"; ((FileTreeAccessFilter)myVirtualFileFilter).allowTreeAccessForFile(file); }
allowTreeAccessForFile
255,009
void () { assert myVirtualFileFilter instanceof FileTreeAccessFilter : "configured filter does not support this method"; ((FileTreeAccessFilter)myVirtualFileFilter).allowTreeAccessForAllFiles(); }
allowTreeAccessForAllFiles
255,010
void (@NotNull String expectedFile, @NotNull PsiFile originalFile, boolean stripTrailingSpaces) { IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); if (policy != null) { policy.beforeCheckResult(getFile()); } PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); if (!stripTrailingSpaces) ...
checkResultByFile
255,011
void (@NotNull String expectedFile, boolean stripTrailingSpaces, @NotNull SelectionAndCaretMarkupLoader loader, @NotNull String actualText) { assertInitialized(); Project project = getProject(); Editor editor = getEditor(); if (editor instanceof EditorWindow) { editor = ((EditorWindow)editor).getDelegate(); } UsefulTes...
checkResult
255,012
String (@NotNull String actualText) { Document document = EditorFactory.getInstance().createDocument(actualText); ((DocumentImpl)document).stripTrailingSpaces(getProject()); actualText = document.getText(); return actualText; }
stripTrailingSpaces
255,013
void (boolean canI) { myAllowDirt = canI; }
canChangeDocumentDuringHighlighting
255,014
String (boolean withCollapseStatus) { Editor topEditor = getHostEditor(); return EdtTestUtil.runInEdtAndGet(() -> { IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); if (policy != null) { policy.waitForHighlighting(getProject(), topEditor); } EditorTestUtil.buildInitialFoldingsInBackground(topEditor);...
getFoldingDescription
255,015
String (Editor topEditor, boolean withCollapseStatus) { return getTagsFromSegments(topEditor.getDocument().getText(), Arrays.asList(topEditor.getFoldingModel().getAllFoldRegions()), FOLD, foldRegion -> "text='" + foldRegion.getPlaceholderText() + "'" + (withCollapseStatus ? " expand='" + foldRegion.isExpanded() + "'" :...
getFoldingData
255,016
int (@NotNull Border o) { return offset < o.offset ? 1 : -1; }
compareTo
255,017
void (@NotNull String verificationFileName, @Nullable String destinationFileName, boolean doCheckCollapseStatus) { String expectedContent; File verificationFile; try { verificationFile = new File(verificationFileName); expectedContent = FileUtil.loadFile(verificationFile); } catch (IOException e) { throw new RuntimeExc...
testFoldingRegions
255,018
String (String expectedContent) { return expectedContent.replaceAll("<" + FOLD + "\\stext='[^']*'(\\sexpand='[^']*')*>", "") .replace("</" + FOLD + ">", ""); }
removeFoldingMarkers
255,019
void (@NotNull String verificationFileName) { testFoldingRegions(verificationFileName, null, true); }
testFoldingWithCollapseStatus
255,020
void (@NotNull String verificationFileName, @Nullable String destinationFileName) { testFoldingRegions(verificationFileName, destinationFileName, true); }
testFoldingWithCollapseStatus
255,021
void (@NotNull String verificationFileName) { testFoldingRegions(verificationFileName, null, false); }
testFolding
255,022
void (@NotNull String fileName, @NotNull String text, boolean isRainbowOn, boolean withColor) { EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme(); boolean isRainbowOnInScheme = RainbowHighlighter.isRainbowEnabled(globalScheme, null); try { RainbowHighlighter.setRainbowEnabled(globalS...
testRainbow
255,023
void () { InlayHintsChecker checker = new InlayHintsChecker(this); try { checker.setUp(); checker.checkParameterHints(); } finally { checker.tearDown(); } }
testInlays
255,024
void (java.util.function.Function<? super Inlay<?>, String> inlayPresenter, Predicate<? super Inlay<?>> inlayFilter) { InlayHintsChecker checker = new InlayHintsChecker(this); try { checker.setUp(); checker.checkInlays(inlayPresenter::apply, inlayFilter::test); } finally { checker.tearDown(); } }
testInlays
255,025
void (String text) { Document checkDocument = new DocumentImpl(text); InlayHintsChecker checker = new InlayHintsChecker(this); CaretAndInlaysInfo inlaysAndCaretInfo = checker.extractInlaysAndCaretInfo(checkDocument); checkResult(checkDocument.getText()); checker.verifyInlaysAndCaretInfo(inlaysAndCaretInfo, text); }
checkResultWithInlays
255,026
void (int selected, String @NotNull ... expected) { myEditorTestFixture.assertPreferredCompletionItems(selected, expected); }
assertPreferredCompletionItems
255,027
void (@NotNull Consumer<? super StructureViewComponent> consumer) { assertNotNull("configure first", myFile); FileEditor fileEditor = FileEditorManager.getInstance(getProject()).getSelectedEditor(myFile); assertNotNull("editor not opened for " + myFile, myFile); StructureViewBuilder builder = LanguageStructureViewBuild...
testStructureView
255,028
void (boolean caresAboutInjection) { this.caresAboutInjection = caresAboutInjection; }
setCaresAboutInjection
255,029
void (boolean readEditorMarkupModel) { myReadEditorMarkupModel = readEditorMarkupModel; }
setReadEditorMarkupModel
255,030
LookupImpl () { return myEditorTestFixture.getLookup(); }
getLookup
255,031
List<Object> (@NotNull String pattern, boolean searchEverywhere, @Nullable PsiElement contextForSorting) { SearchEverywhereContributor<Object> contributor = createMockClassSearchEverywhereContributor(searchEverywhere); ArrayList<Object> results = new ArrayList<>(); contributor.fetchElements(pattern, new MockProgressInd...
getGotoClassResults
255,032
List<Object> (@NotNull String pattern, boolean searchEverywhere, @Nullable PsiElement contextForSorting) { SearchEverywhereContributor<Object> contributor = createMockSymbolSearchEverywhereContributor(searchEverywhere); ArrayList<Object> results = new ArrayList<>(); contributor.fetchElements(pattern, new MockProgressIn...
getGotoSymbolResults
255,033
List<Crumb> () { return myEditorTestFixture.getBreadcrumbsAtCaret(); }
getBreadcrumbsAtCaret
255,034
SearchEverywhereContributor<Object> (boolean everywhere) { DataContext dataContext = SimpleDataContext.getProjectContext(getProject()); AnActionEvent event = AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, dataContext); ClassSearchEverywhereContributor contributor = new ClassSearchEverywhereContributor(...
createMockClassSearchEverywhereContributor
255,035
SearchEverywhereContributor<Object> (boolean everywhere) { DataContext dataContext = SimpleDataContext.getProjectContext(getProject()); AnActionEvent event = AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, dataContext); SymbolSearchEverywhereContributor contributor = new SymbolSearchEverywhereContributo...
createMockSymbolSearchEverywhereContributor
255,036
void () { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); if (editor instanceof EditorWindow) { Document document = ((DocumentWindow)editor.getDocument()).getDelegate(); setFileAndEditor(FileDocumentManager.getInstance().getFile(document), ((EditorWindow)editor).getDelegate()); } }
bringRealEditorBack
255,037
void (@NotNull IntentionAction action, @NotNull PsiFile file, @NotNull Editor editor) { // Test that action will automatically clear the read-only attribute if modification is necessary. // If your test fails due to this, make sure that your quick-fix/intention // overrides "getElementToMakeWritable" or has the followi...
invokeIntention
255,038
boolean (VirtualFile vFile, Project project, Runnable action) { boolean writable; ReadonlyStatusHandlerImpl handler = (ReadonlyStatusHandlerImpl)ReadonlyStatusHandler.getInstance(project); setReadOnly(vFile, true); handler.setClearReadOnlyInTests(true); try { action.run(); } finally { writable = vFile.isWritable(); han...
withReadOnlyFile
255,039
void (@NotNull Project project, @NotNull VirtualFile vFile) { PsiFile topLevelPsi = vFile.isValid() ? PsiManager.getInstance(project).findFile(vFile) : null; if (topLevelPsi != null) { if (Registry.is("ide.check.structural.psi.text.consistency.in.tests")) { PsiTestUtil.checkPsiStructureWithCommit(topLevelPsi, PsiTestUt...
checkPsiTextConsistency
255,040
void (VirtualFile vFile, boolean readOnlyStatus) { try { WriteAction.runAndWait(() -> ReadOnlyAttributeUtil.setReadOnlyAttribute(vFile, readOnlyStatus)); } catch (IOException e) { throw new UncheckedIOException(e); } }
setReadOnly
255,041
String (@NotNull UsageViewImpl usageView) { Disposer.register(getTestRootDisposable(), usageView); usageView.expandAll(); return TreeNodeTester.forNode(usageView.getRoot()).withPresenter(usageView::getNodeText).constructTextRepresentation(); }
getUsageViewTreeTextRepresentation
255,042
SelectionAndCaretMarkupLoader (@NotNull String path, String charset) { return fromIoSource(() -> FileUtil.loadFile(new File(path), charset), path); }
fromFile
255,043
SelectionAndCaretMarkupLoader (@NotNull VirtualFile file) { return fromIoSource(() -> VfsUtilCore.loadText(file), file.getPath()); }
fromFile
255,044
SelectionAndCaretMarkupLoader (@NotNull ThrowableComputable<String, IOException> source, String path) { try { return new SelectionAndCaretMarkupLoader(StringUtil.convertLineSeparators(source.compute()), path); } catch (IOException e) { throw new RuntimeException(e); } }
fromIoSource
255,045
SelectionAndCaretMarkupLoader (@NotNull String text) { return new SelectionAndCaretMarkupLoader(text, null); }
fromText
255,046
Disposable () { return myProjectFixture.getTestRootDisposable(); }
getProjectDisposable
255,047
void (SelectionAndCaretMarkupApplyPolicy policy) { mySelectionAndCaretMarkupApplyPolicy = policy; }
setSelectionAndCaretMarkupApplyPolicy
255,048
F () { return myFixture; }
getFixture
255,049
void () { EdtTestUtil.runInEdtAndWait(() -> { Disposer.dispose(myTestRootDisposable); }); }
disposeRootDisposable
255,050
void (Class<?> aClass) { try { UsefulTestCase.clearDeclaredFields(this, aClass); } catch (IllegalAccessException e) { throw new RuntimeException(e); } if (aClass != BaseFixture.class) { resetClassFields(aClass.getSuperclass()); } }
resetClassFields
255,051
Disposable () { return myTestRootDisposable; }
getTestRootDisposable
255,052
void (@NotNull Throwable e) { if (mySuppressedExceptions == null) { mySuppressedExceptions = new SmartList<>(); } mySuppressedExceptions.add(e); }
addSuppressedException
255,053
void (@NotNull AnalysisScope scope) { super.notifyInspectionsFinished(scope); myFinished = true; }
notifyInspectionsFinished
255,054
boolean (final InspectionProfile profile) { return true; }
includeDoNotShow
255,055
boolean () { return myFinished; }
isFinished
255,056
CodeStyleSettings () { return CodeStyleSchemes.getInstance().getCurrentScheme() == null ? CodeStyle.createTestSettings() : CodeStyle.getSettings(getProject()); }
getCurrentCodeStyleSettings
255,057
void () { Project project = getProject(); // don't use method references here to make stack trace reading easier //noinspection Convert2MethodRef new RunAll( () -> { if (project != null) { CodeStyle.dropTemporarySettings(project); } }, () -> { if (myCodeStyleSettingsTracker != null) { myCodeStyleSettingsTracker.checkFo...
tearDown
255,058
Project () { return myProject; }
getProject
255,059
Module () { return myModule; }
getModule
255,060
void (@NotNull HierarchyTreeStructure treeStructure, @NotNull String expectedStructure) { doHierarchyTest(treeStructure, expectedStructure, null, null); }
doHierarchyTest
255,061
void (@NotNull HierarchyTreeStructure treeStructure, @NotNull String expectedStructure, @Nullable Comparator<? super NodeDescriptor<?>> comparator, @Nullable File expectedFile) { Element element; try { element = JDOMUtil.load(expectedStructure); } catch (Throwable e) { String actual = dump(treeStructure, null, comparat...
doHierarchyTest
255,062
String (@NotNull HierarchyTreeStructure treeStructure, @Nullable HierarchyNodeDescriptor descriptor, @Nullable Comparator<? super NodeDescriptor<?>> comparator, int level) { StringBuilder s = new StringBuilder(); dump(treeStructure, descriptor, comparator,level, s); return s.toString(); }
dump
255,063
void (@NotNull HierarchyTreeStructure treeStructure, @Nullable HierarchyNodeDescriptor descriptor, @Nullable Comparator<? super NodeDescriptor<?>> comparator, int level, @NotNull StringBuilder b) { if (level > 10) { b.append(" ".repeat(level)); b.append("<Probably infinite part skipped>\n"); return; } if (descriptor ==...
dump
255,064
void (@NotNull HierarchyTreeStructure treeStructure, @Nullable Element rootElement, @Nullable Comparator<? super NodeDescriptor<?>> comparator) { HierarchyNodeDescriptor rootNodeDescriptor = (HierarchyNodeDescriptor)treeStructure.getRootElement(); rootNodeDescriptor.update(); if (rootElement == null || !NODE_ELEMENT_NA...
checkHierarchyTreeStructure
255,065
void (@NotNull HierarchyTreeStructure treeStructure, @NotNull HierarchyNodeDescriptor descriptor, @NotNull Element expectedElement, @Nullable Comparator<? super NodeDescriptor<?>> comparator) { checkBaseNode(treeStructure, descriptor, expectedElement); checkContent(descriptor, expectedElement); checkChildren(treeStruct...
checkNodeDescriptorRecursively
255,066
void (@NotNull HierarchyTreeStructure treeStructure, @NotNull HierarchyNodeDescriptor descriptor, @NotNull Element expectedElement) { String baseAttrValue = expectedElement.getAttributeValue(BASE_ATTR_NAME); HierarchyNodeDescriptor baseDescriptor = treeStructure.getBaseDescriptor(); boolean mustBeBase = "true".equalsIg...
checkBaseNode
255,067
void (@NotNull HierarchyNodeDescriptor descriptor, @NotNull Element expectedElement) { assertEquals("parent: " + descriptor.getParentDescriptor(), expectedElement.getAttributeValue(TEXT_ATTR_NAME), descriptor.getHighlightedText().getText()); }
checkContent
255,068
void (@NotNull HierarchyTreeStructure treeStructure, @NotNull HierarchyNodeDescriptor descriptor, @NotNull Element element, @Nullable Comparator<? super NodeDescriptor<?>> comparator) { if (element.getChild(ANY_NODES_ELEMENT_NAME) != null) { return; } Object[] children = getSortedChildren(treeStructure, descriptor, com...
checkChildren
255,069
void (@NotNull Environment env) { PsiDocumentManager.getInstance(getProject()).commitDocument(getDocument()); int randomOffset = generatePsiOffset(env, null); PsiElement leaf = getFile().findElementAt(randomOffset); TextRange leafRange = leaf != null ? leaf.getTextRange() : null; int insertOffset = leafRange != null ? ...
performCommand
255,070
PsiFile () { return PsiManager.getInstance(getProject()).findFile(getVirtualFile()); }
getFile
255,071
Project () { return myProject; }
getProject
255,072
VirtualFile () { return myVirtualFile; }
getVirtualFile
255,073
Document () { return FileDocumentManager.getInstance().getDocument(getVirtualFile()); }
getDocument
255,074
int (@NotNull Environment env, @Nullable String logMessage) { return env.generateValue(Generator.integers(0, getFile().getTextLength()).noShrink(), logMessage); }
generatePsiOffset
255,075
int (@NotNull Environment env, @Nullable String logMessage) { return env.generateValue(Generator.integers(0, getDocument().getTextLength()).noShrink(), logMessage); }
generateDocOffset
255,076
void (@NotNull Environment env) { int offset = generateDocOffset(env, null); env.logMessage("Invoke basic completion at " + MadTestingUtil.getPositionDescription(offset, getDocument())); String selectionCharacters = myPolicy.getPossibleSelectionCharacters(); char c = selectionCharacters.charAt(env.generateValue(Generat...
performCommand
255,077
void (int offset, char completionChar, Environment env) { Project project = getProject(); Editor editor = FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, getVirtualFile(), 0), true); assert editor != null; PsiDocumentManager.getInstance(project).commitAllDocuments(); editor.getCare...
performActionAt
255,078
void (@NotNull Editor editor, @NotNull PsiFile file, char completionChar, Environment env) { int caretOffset = editor.getCaretModel().getOffset(); PsiElement leaf = file.findElementAt(TargetElementUtil.adjustOffset(file, getDocument(), caretOffset)); PsiReference ref = TargetElementUtil.findReference(editor); String ex...
performCompletion
255,079
boolean (Editor editor, Environment env, String expectedVariant) { Editor hostEditor = InjectedLanguageEditorUtil.getTopLevelEditor(editor); List<HighlightInfo> infos = InvokeIntention.highlightErrors(getProject(), hostEditor); int caretOffset = hostEditor.getCaretModel().getOffset(); boolean hasErrors = ContainerUtil....
checkHighlightingErrorsAtCaret
255,080
boolean (int caretOffset, PsiElement leaf, PsiReference ref, String expectedVariant) { if (expectedVariant == null) return false; int expectedEnd = ref != null ? ref.getRangeInElement().getEndOffset() + ref.getElement().getTextRange().getStartOffset() : leaf != null ? leaf.getTextRange().getEndOffset() : 0; return expe...
isPrefixEqualToExpectedVariant
255,081
void (List<? extends LookupElement> items) { Map<List<?>, LookupElement> presentations = new HashMap<>(); for (LookupElement item : items) { LookupElementPresentation p = TestLookupElementPresentation.renderReal(item); if (seemsTruncated(p.getItemText()) || seemsTruncated(p.getTailText()) || seemsTruncated(p.getTypeTex...
checkNoDuplicates
255,082
boolean (String text) { return text != null && text.contains("..."); }
seemsTruncated
255,083
void (@NotNull Environment env) { env.logMessage("FilePropertiesChanged " + getVirtualFile().getPath()); PushedFilePropertiesUpdater.getInstance(getProject()).filePropertiesChanged(getVirtualFile(), Conditions.alwaysTrue()); }
performCommand
255,084
void (@NotNull Environment env) { env.logMessage(toString()); PsiTestUtil.checkFileStructure(getFile()); }
performCommand
255,085
void (@NotNull Environment env) { int offset = generateDocOffset(env, null); String toInsert = env.generateValue(Generator.stringsOf(Generator.asciiPrintableChars()), "Insert '%s' at " + offset); WriteCommandAction.runWriteCommandAction(getProject(), () -> getDocument().insertString(offset, toInsert)); }
performCommand
255,086
String () { return "\n\t\r .("; }
getPossibleSelectionCharacters
255,087
String (@NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiElement leaf, @Nullable PsiReference ref) { if (isAfterError(file, leaf)) { return null; } String leafText = ref != null ? ref.getRangeInElement().substring(ref.getElement().getText()) : leaf.getText(); if (leafText.isEmpty() || !Character.isLetter(leaf...
getExpectedVariant
255,088
boolean (@NotNull PsiFile file, @NotNull PsiElement leaf) { return MadTestingUtil.isAfterError(file, leaf.getTextRange().getStartOffset()); }
isAfterError
255,089
boolean (@NotNull Editor editor, @NotNull PsiFile file, @Nullable PsiElement leaf) { return leaf != null && !isAfterError(file, leaf); }
shouldCheckDuplicates
255,090
boolean (@NotNull LookupElement item1, @NotNull LookupElement item2) { return false; }
areDuplicatesOk
255,091
PsiElement (@NotNull PsiReference ref) { if (ref instanceof PsiPolyVariantReference) { for (ResolveResult result : ((PsiPolyVariantReference)ref).multiResolve(false)) { if (!result.isValidResult()) { return null; } } } return ref.resolve(); }
getValidResolveResult
255,092
boolean (Editor editor, PsiFile file, PsiElement leaf, @Nullable PsiReference ref) { PsiElement target = TargetElementUtil.findTargetElement(editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); if (target != null) target = target.getNavigationElement(); PsiFile targetFile = ...
isDeclarationName
255,093
boolean (@NotNull PsiElement leaf) { return true; }
shouldSuggestNonReferenceLeafText
255,094
boolean (@NotNull PsiReference ref, @NotNull PsiElement target) { return !(ref instanceof WebReference); }
shouldSuggestReferenceText
255,095
void (@NotNull Environment env) { env.logMessage(toString()); PsiDocumentManager.getInstance(getProject()).commitDocument(getFile().getViewProvider().getDocument()); WriteCommandAction.runWriteCommandAction(getProject(), this::performMutation); PsiTestUtil.checkPsiStructureWithCommit(getFile(), PsiTestUtil::checkStubsM...
performCommand
255,096
void (@NotNull Environment env) { env.logMessage(toString()); WriteCommandAction.runWriteCommandAction(getProject(), () -> { Document document = getDocument(); try { new ExpectedHighlightingData(document, true, true, true, true).init(); } catch (AssertionError ignore) { // can fail on unpaired markups } for (String s :...
performCommand
255,097
void (Document document, String marker) { document.setText(StringUtil.replace(document.getText(), marker, "")); }
removeMarkup
255,098
String () { return "Strip markup: " + Arrays.toString(MARKUP); }
toString
255,099
void (Document document, Runnable r) { letSaveAllDocumentsPassIfAny(); watchDocumentChanges(r::run, event -> { Document changed = event.getDocument(); if (changed != document) { VirtualFile file = FileDocumentManager.getInstance().getFile(changed); if (file != null && file.isInLocalFileSystem()) { throw new AssertionEr...
restrictChangesToDocument