Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
254,400
boolean (@NotNull PsiFile file) { FileViewProvider viewProvider = file.getViewProvider(); for (Language language : viewProvider.getLanguages()) { FoldingBuilder foldingBuilder = LanguageFolding.INSTANCE.forLanguage(language); if (foldingBuilder != null && !DumbService.isDumbAware(foldingBuilder)) return false; } return...
supportsDumbModeFolding
254,401
boolean (final Element reportedProblem, final Element expectedProblem) { Element reportedTextRange = reportedProblem.getChild("entry_point"); if (reportedTextRange == null) return false; Element expectedTextRange = expectedProblem.getChild("entry_point"); return Objects.equals(reportedTextRange.getAttributeValue("TYPE"...
compareTextRange
254,402
boolean (Element reportedProblem, Element expectedProblem) { return Objects.equals(reportedProblem.getChildText("line"), expectedProblem.getChildText("line")); }
compareLines
254,403
boolean (Element reportedProblem, Element expectedProblem) { String reportedFileName = reportedProblem.getChildText("file"); if (reportedFileName == null) { return true; } File reportedFile = new File(reportedFileName); return Objects.equals(reportedFile.getName(), expectedProblem.getChildText("file")); }
compareFiles
254,404
void (@NotNull GlobalInspectionContextImpl context, @NotNull InspectionToolWrapper<?,?> toolWrapper, boolean checkRange, @NotNull String testDir) { compareToolResults(context, checkRange, testDir, Collections.singletonList(toolWrapper)); }
compareToolResults
254,405
void (@NotNull GlobalInspectionContextImpl context, boolean checkRange, @NotNull String testDir, @NotNull Collection<? extends InspectionToolWrapper<?,?>> toolWrappers) { final Element root = new Element(GlobalInspectionContextBase.PROBLEMS_TAG_NAME); for (InspectionToolWrapper<?,?> toolWrapper : toolWrappers) { Inspec...
compareToolResults
254,406
void (@NotNull InspectionToolWrapper<?,?> toolWrapper, @NotNull final AnalysisScope scope, @NotNull final GlobalInspectionContextForTests globalContext) { final String shortName = toolWrapper.getShortName(); final HighlightDisplayKey key = HighlightDisplayKey.find(shortName); if (key == null){ HighlightDisplayKey.regis...
runTool
254,407
List<InspectionProfileEntry> (Set<String> classNames) { List<InspectionProfileEntry> tools = JBIterable.of(LocalInspectionEP.LOCAL_INSPECTION, InspectionEP.GLOBAL_INSPECTION) .flatten(o -> o.getExtensionList()) .filter(o -> classNames.contains(o.implementationClass)) .transform(InspectionEP::instantiateTool) .toList();...
instantiateTools
254,408
TemporaryDirectory () { return temporaryDirectory; }
getTempDir
254,409
VirtualFile () { return createTestProjectStructure(null, true); }
createTestProjectStructure
254,410
VirtualFile (@Nullable String rootPath) { return createTestProjectStructure(rootPath, true); }
createTestProjectStructure
254,411
VirtualFile (@Nullable String rootPath, boolean addProjectRoots) { Path dir = temporaryDirectory.newPath(); try { Files.createDirectories(dir); } catch (IOException e) { throw new UncheckedIOException(e); } VirtualFile result = HeavyTestHelper.createTestProjectStructure(myModule, rootPath, dir, addProjectRoots); PsiDoc...
createTestProjectStructure
254,412
VirtualFile (@Nullable Module module, @Nullable String rootPath, boolean addProjectRoots, @NotNull TemporaryDirectory temporaryDirectory) { Path dir = temporaryDirectory.newPath(); try { Files.createDirectories(dir); } catch (IOException e) { throw new UncheckedIOException(e); } return HeavyTestHelper.createTestProject...
createTestProjectStructure
254,413
VirtualFile (@NotNull Project project, @Nullable Module module, @Nullable String rootPath, boolean addProjectRoots) { VirtualFile file = createTestProjectStructure(module, rootPath, addProjectRoots, getTempDir()); PsiDocumentManager.getInstance(project).commitAllDocuments(); return file; }
createTestProjectStructure
254,414
void (@NotNull VirtualFile tempDir) { tempDir.getChildren(); tempDir.refresh(false, true); }
synchronizeTempDirVfs
254,415
VirtualFile (@NotNull Path tempDir) { VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(tempDir.toString())); // null is ok, because Path can be only generated, but not created if (virtualFile != null) { synchronizeTempDirVfs(virtualFile); } return virtual...
synchronizeTempDirVfs
254,416
Path () { IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); String testName = policy == null ? null : policy.getPerTestTempDirName(); if (testName == null) { testName = TEMP_DIR_MARKER + TemporaryDirectory.testNameToFileName(getName()); } Path result = TemporaryDirectory.generateTemporaryPath(testName...
createGlobalTempDirectory
254,417
void (@NotNull Path dir) { temporaryDirectory.after(); }
removeGlobalTempDirectory
254,418
void (@NotNull Path file) { throw new UnsupportedOperationException(); }
addTmpFileToKeep
254,419
Project () { return myProject; }
getProject
254,420
PsiManager () { return PsiManager.getInstance(myProject); }
getPsiManager
254,421
Module () { return myModule; }
getModule
254,422
OpenProjectTaskBuilder () { // doCreateRealModule uses myProject.getName() as module name - use constant project name because projectFile here unique temp file return new OpenProjectTaskBuilder().projectName(getProjectFilename()); }
getOpenProjectOptions
254,423
Project () { OpenProjectTaskBuilder optionBuilder = getOpenProjectOptions(); Path projectFile = getProjectDirOrFile(isCreateDirectoryBasedProject()); return Objects.requireNonNull(ProjectManagerEx.getInstanceEx().openProject(projectFile, optionBuilder.build())); }
doCreateAndOpenProject
254,424
boolean () { return false; }
isCreateDirectoryBasedProject
254,425
Path () { return getProjectDirOrFile(isCreateDirectoryBasedProject()); }
getProjectDirOrFile
254,426
Path (boolean isDirectoryBasedProject) { return temporaryDirectory.newPath(getProjectFilename() + (isDirectoryBasedProject ? "" : ProjectFileType.DOT_DEFAULT_EXTENSION)); }
getProjectDirOrFile
254,427
void () { try { WriteCommandAction.writeCommandAction(getProject()).run(() -> myModule = createMainModule()); } catch (IOException e) { throw new RuntimeException(e); } }
setUpModule
254,428
Module (@NonNls @NotNull String moduleName) { return doCreateRealModule(moduleName); }
createModule
254,429
Module (@NotNull String moduleName) { return doCreateRealModuleIn(moduleName, myProject, getModuleType()); }
doCreateRealModule
254,430
Module (@NotNull String moduleName, @NotNull Project project, @NotNull ModuleType<?> moduleType) { return createModuleAt(moduleName, project, moduleType, ProjectKt.getStateStore(project).getProjectBasePath()); }
doCreateRealModuleIn
254,431
Module (@NotNull String moduleName, @NotNull Project project, @NotNull ModuleType<?> moduleType, @NotNull Path path) { Path moduleFile = path.resolve(moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION); return WriteAction.computeAndWait(() -> ModuleManager.getInstance(project).newModule(moduleFile, moduleType.getId()));...
createModuleAt
254,432
void (@Nullable Project project) { Application app = ApplicationManager.getApplication(); if (app == null) { return; } NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UndoManagerImpl globalInstance = (UndoManagerImpl)UndoManager.getGlobalInstance(); if (globalInstance != null) { globalInstance.dropHistoryInTest...
cleanupApplicationCaches
254,433
Set<VirtualFile> () { if (ourEternallyLivingFilesCache != null) { return ourEternallyLivingFilesCache; } Set<VirtualFile> survivors = new HashSet<>(); for (IndexableSetContributor contributor : IndexableSetContributor.EP_NAME.getExtensions()) { for (VirtualFile file : IndexableSetContributor.getRootsToIndex(contributor...
eternallyLivingFiles
254,434
void (@NotNull Collection<? extends VirtualFile> files) { for (VirtualFile each : files) { registerSurvivor(eternallyLivingFiles(), each); } }
addSurvivingFiles
254,435
void (@NotNull Set<? super VirtualFile> survivors, @NotNull VirtualFile file) { addSubTree(file, survivors); while (file != null && survivors.add(file)) { file = file.getParent(); } }
registerSurvivor
254,436
void (@NotNull VirtualFile root, @NotNull Set<? super VirtualFile> to) { if (root instanceof VirtualDirectoryImpl) { for (VirtualFile child : ((VirtualDirectoryImpl)root).getCachedChildren()) { if (child instanceof VirtualDirectoryImpl) { to.add(child); addSubTree(child, to); } } } }
addSubTree
254,437
void () { resetClassFields(getClass()); }
resetAllFields
254,438
void (@NotNull Class<?> aClass) { try { clearDeclaredFields(this, aClass); } catch (IllegalAccessException e) { LOG.error(e); } if (aClass == HeavyPlatformTestCase.class) return; resetClassFields(aClass.getSuperclass()); }
resetClassFields
254,439
void (Sdk jdk) { ProjectJdkTable jdkTable = ProjectJdkTable.getInstance(); for (Sdk existingSdk : jdkTable.getAllJdks()) { if (existingSdk == jdk) return; } WriteAction.runAndWait(()-> jdkTable.addJdk(jdk, myProject)); }
registerTestProjectJdk
254,440
void () { final Sdk jdk = getTestProjectJdk(); if (jdk != null) { registerTestProjectJdk(jdk); } Module[] modules = ModuleManager.getInstance(myProject).getModules(); for (Module module : modules) { ModuleRootModificationUtil.setModuleSdk(module, jdk); } }
setUpJdk
254,441
Object (@NotNull String dataId) { return myProject == null || myProject.isDisposed() ? null : new TestDataProvider(myProject).getData(dataId); }
getData
254,442
VirtualFile (@NotNull File file) { return Objects.requireNonNull(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)); }
getVirtualFile
254,443
VirtualFile (@NotNull VirtualFile dir, @NotNull String name) { try { // requestor must be notnull (for GlobalUndoTest) return WriteAction.computeAndWait(() -> dir.createChildData(dir, name)); } catch (IOException e) { throw new RuntimeException(e); } }
createChildData
254,444
VirtualFile (@NotNull VirtualFile dir, @NotNull String name) { try { return WriteAction.computeAndWait(() -> dir.createChildDirectory(dir, name)); } catch (IOException e) { throw new RuntimeException(e); } }
createChildDirectory
254,445
void (@NotNull VirtualFile vFile1, @NotNull String newName) { try { WriteCommandAction.writeCommandAction(null).run(() -> vFile1.rename(vFile1, newName)); } catch (IOException e) { throw new RuntimeException(e); } }
rename
254,446
void (@NotNull VirtualFile file) { VfsTestUtil.deleteFile(file); }
delete
254,447
void (final @NotNull VirtualFile vFile1, final @NotNull VirtualFile newFile) { try { WriteCommandAction.writeCommandAction(null).run(() -> vFile1.move(vFile1, newFile)); } catch (IOException e) { throw new RuntimeException(e); } }
move
254,448
VirtualFile (final @NotNull VirtualFile file, final @NotNull VirtualFile newParent, final @NotNull String copyName) { final VirtualFile[] copy = new VirtualFile[1]; try { WriteCommandAction.writeCommandAction(null).run(() -> copy[0] = file.copy(file, newParent, copyName)); } catch (IOException e) { throw new RuntimeExc...
copy
254,449
void (final @NotNull VirtualFile vTestRoot, final @NotNull VirtualFile toDir) { try { WriteCommandAction.writeCommandAction(null).run(() -> { for (VirtualFile file : vTestRoot.getChildren()) { VfsUtil.copy(file, file, toDir); } }); } catch (IOException e) { throw new RuntimeException(e); } }
copyDirContentsTo
254,450
void (final @NotNull VirtualFile file, final @NotNull String text) { try { WriteAction.runAndWait(() -> LoadTextUtil.write(null, file, file,text, -1)); } catch (IOException e) { throw new RuntimeException(e); } }
setFileText
254,451
void (final @NotNull VirtualFile file, final byte @NotNull [] content) { try { WriteAction.runAndWait(() -> file.setBinaryContent(content)); } catch (IOException e) { throw new RuntimeException(e); } }
setBinaryContent
254,452
void (final @NotNull VirtualFile file, final byte @NotNull [] content, final long newModificationStamp, final long newTimeStamp, final Object requestor) { try { WriteAction.runAndWait(() -> file.setBinaryContent(content, newModificationStamp, newTimeStamp, requestor)); } catch (IOException e) { throw new RuntimeExcepti...
setBinaryContent
254,453
VirtualFile () { return HeavyTestHelper.getOrCreateProjectBaseDir(myProject); }
getOrCreateProjectBaseDir
254,454
boolean () { return true; }
isRunInCommand
254,455
void (@TestDataFile @NonNls @NotNull String relativePath) { try { String fullPath = getTestDataPath() + relativePath; File ioFile = new File(fullPath); checkCaseSensitiveFS(fullPath, ioFile); String fileText = FileUtilRt.loadFile(ioFile, CharsetToolkit.UTF8, true); configureFromFileText(ioFile.getName(), fileText); } c...
configureByFile
254,456
String () { return getTestDataPath() + myFileSuffix + ".txt"; }
getAnswerFilePath
254,457
String () { if (myTestDataPath != null) { return myTestDataPath; } return PathManagerEx.getTestDataPath(); }
getTestDataPath
254,458
VirtualFile (@NonNls @NotNull String filePath) { String fullPath = getTestDataPath() + filePath; VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/')); assertNotNull("file " + fullPath + " not found", vFile); return vFile; }
getVirtualFile
254,459
Document (@NonNls @NotNull String fileName, @NonNls @NotNull String fileText) { return configureFromFileText(fileName, fileText, false); }
configureFromFileText
254,460
Document (@NonNls @NotNull String fileName, @NonNls @NotNull String fileText, boolean checkCaret) { return WriteCommandAction.writeCommandAction(null).compute(() -> { Document fakeDocument = new DocumentImpl(fileText); EditorTestUtil.CaretAndSelectionState caretsState = EditorTestUtil.extractCaretAndSelectionMarkers(fa...
configureFromFileText
254,461
Editor (@NonNls @NotNull String fileText) { return WriteCommandAction.writeCommandAction(getProject()).compute(() -> { Document fakeDocument = EditorFactory.getInstance().createDocument(fileText); EditorTestUtil.CaretAndSelectionState caretsState = EditorTestUtil.extractCaretAndSelectionMarkers(fakeDocument); String ne...
configureFromFileTextWithoutPSI
254,462
Editor (@NotNull VirtualFile file) { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); Editor editor = FileEditorManager.getInstance(getProject()).openTextEditor(new OpenFileDescriptor(getProject(), file, 0), false); DaemonCodeAnalyzer.getInstance(getProject()).restart(); assertNotNull(editor); ((Edito...
createEditor
254,463
Editor (@NotNull String relativePath, @NotNull String fileText) { Editor editor = createEditor(VfsTestUtil.createFile(getSourceRoot(), relativePath, fileText)); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); getIndexingMode().ensureIndexingStatus(getProject()); return editor; }
createSaveAndOpenFile
254,464
VirtualFile (@NotNull String relativePath, @NotNull String fileText) { return VfsTestUtil.createFile(getSourceRoot(), relativePath, fileText); }
createAndSaveFile
254,465
void () { if (getEditor() != null) { Editor hostEditor = getEditor() instanceof EditorWindow ? ((EditorWindow)getEditor()).getDelegate() : getEditor(); PsiFile hostFile = myFile == null ? null : InjectedLanguageManager.getInstance(getProject()).getTopLevelFile(myFile); Ref<EditorWindow> editorWindowRef = new Ref<>(); h...
setupEditorForInjectedLanguage
254,466
void (@TestDataFile @NonNls @NotNull String expectedFilePath) { checkResultByFile(null, expectedFilePath, false); }
checkResultByFile
254,467
void (@Nullable String message, @TestDataFile @NotNull String expectedFilePath, boolean ignoreTrailingSpaces) { bringRealEditorBack(); PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); if (ignoreTrailingSpaces) { Editor editor = getEditor(); TrailingSpacesStripper.strip(editor.getDocument...
checkResultByFile
254,468
void (@NonNls @NotNull String expectedFileText) { checkResultByText(null, expectedFileText, false, null); }
checkResultByText
254,469
void (@Nullable String message, @NotNull String expectedFileText, boolean ignoreTrailingSpaces) { checkResultByText(message, expectedFileText, ignoreTrailingSpaces, null); }
checkResultByText
254,470
void (@Nullable String message, @NotNull String expectedFileText, boolean ignoreTrailingSpaces, @Nullable String filePath) { bringRealEditorBack(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); ApplicationManager.getApplication().runWriteAction(() -> { Document document = EditorFactory.getInstance(...
checkResultByText
254,471
void (@Nullable String message, @NotNull Editor editor, @NotNull String fileText, boolean ignoreTrailingSpaces, @Nullable String filePath) { ApplicationManager.getApplication().runWriteAction(() -> { Document fakeDocument = EditorFactory.getInstance().createDocument(fileText); if (ignoreTrailingSpaces) { ((DocumentImpl...
checkResultByTextWithoutPSI
254,472
String (@NonNls @NotNull String engineMessage, @Nullable String userMessage) { if (userMessage == null) return engineMessage; return userMessage + " [" + engineMessage + "]"; }
getMessage
254,473
Editor () { return myEditor; }
getEditor
254,474
PsiFile () { return myFile; }
getFile
254,475
VirtualFile () { return myVFile; }
getVFile
254,476
void () { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); if (getEditor() instanceof EditorWindow) { Document document = ((DocumentWindow)getEditor().getDocument()).getDelegate(); myFile = PsiDocumentManager.getInstance(getProject()).getPsiFile(document); myEditor = ((EditorWindow)getEditor()).getDel...
bringRealEditorBack
254,477
void () { caretRight(getEditor()); }
caretRight
254,478
void (@NotNull Editor editor) { executeAction(IdeActions.ACTION_EDITOR_MOVE_CARET_RIGHT, editor); }
caretRight
254,479
void () { caretUp(getEditor()); }
caretUp
254,480
void (@NotNull Editor editor) { executeAction(IdeActions.ACTION_EDITOR_MOVE_CARET_UP, editor); }
caretUp
254,481
void () { deleteLine(getEditor(), getProject()); }
deleteLine
254,482
void (@NotNull Editor editor, @Nullable Project project) { executeAction(IdeActions.ACTION_EDITOR_DELETE_LINE, editor, project); }
deleteLine
254,483
void (@NonNls @NotNull String s) { for (char c : s.toCharArray()) { type(c); } }
type
254,484
void (char c) { type(c, getEditor(), getProject()); }
type
254,485
void (char c, @NotNull Editor editor, @Nullable Project project) { if (c == '\n') { executeAction(IdeActions.ACTION_EDITOR_ENTER, editor, project); } else { DataContext dataContext = DataManager.getInstance().getDataContext(); TypedAction action = TypedAction.getInstance(); action.actionPerformed(editor, c, dataContext...
type
254,486
void () { backspace(getEditor(), getProject()); }
backspace
254,487
void (@NotNull Editor editor, @Nullable Project project) { executeAction(IdeActions.ACTION_EDITOR_BACKSPACE, editor, project); }
backspace
254,488
void () { HighlightUsagesHandler.invoke(getProject(), getEditor(), getFile()); }
ctrlShiftF7
254,489
void () { ctrlW(getEditor(), getProject()); }
ctrlW
254,490
void (@NotNull Editor editor, Project project) { executeAction(IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET, editor, project); }
ctrlW
254,491
void () { ctrlD(getEditor(), getProject()); }
ctrlD
254,492
void (@NotNull Editor editor, Project project) { executeAction(IdeActions.ACTION_EDITOR_DUPLICATE, editor, project); }
ctrlD
254,493
void () { delete(getEditor(), getProject()); }
delete
254,494
void (@NotNull Editor editor, Project project) { executeAction(IdeActions.ACTION_EDITOR_DELETE, editor, project); }
delete
254,495
void () { executeAction(IdeActions.ACTION_EDITOR_MOVE_LINE_START); }
home
254,496
void () { executeAction(IdeActions.ACTION_EDITOR_MOVE_LINE_END); }
end
254,497
void () { executeAction(IdeActions.ACTION_EDITOR_MOVE_LINE_START_WITH_SELECTION); }
homeWithSelection
254,498
void () { executeAction(IdeActions.ACTION_EDITOR_MOVE_LINE_END_WITH_SELECTION); }
endWithSelection
254,499
void () { executeAction(IdeActions.ACTION_EDITOR_COPY); }
copy