Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
254,800
Editor (@NotNull PsiElement elementAtCaret) { // sometimes the element found by TargetElementUtil may belong to the other editor, e.g, in case of an injected element // but inplace rename requires that both element and the editor must be consistent Editor editorForElement = PsiEditorUtil.getInstance().findEditorByPsiEl...
openEditorFor
254,801
void (VariableInplaceRenameHandler handler, final String newName, @NotNull Editor editor, PsiElement elementAtCaret) { if (!tryInlineRename(handler, newName, editor, elementAtCaret)) { Assert.fail("Inline refactoring wasn't performed"); } }
doInlineRename
254,802
boolean (VariableInplaceRenameHandler handler, final String newName, @NotNull Editor editor, @NotNull PsiElement elementAtCaret) { Project project = editor.getProject(); Disposable disposable = Disposer.newDisposable(); try { TemplateManagerImpl.setTemplateTesting(disposable); DataContext context = DataManager.getInsta...
tryInlineRename
254,803
void (VariableInplaceRenameHandler handler, String file, String extension, String newName, CodeInsightTestFixture fixture) { fixture.configureByFile(file + "." + extension); doInlineRename(handler, newName, fixture); fixture.checkResultByFile(file + "_after." + extension); }
doInlineRenameTest
254,804
void (AnAction action, String file, CodeInsightTestFixture fixture) { String extension = FileUtilRt.getExtension(file); String name = FileUtilRt.getNameWithoutExtension(file); fixture.configureByFile(file); fixture.testAction(action); fixture.checkResultByFile(name + "_after." + extension); }
doActionTest
254,805
void (final Template template, Disposable parentDisposable) { final TemplateSettings settings = TemplateSettings.getInstance(); settings.addTemplate(template); Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { settings.removeTemplate(template); } }); }
addTemplate
254,806
void () { settings.removeTemplate(template); }
dispose
254,807
List<Annotation> (@NotNull Annotator annotator, @NotNull PsiElement @NotNull... elements) { PsiFile psiFile = elements[0].getContainingFile(); return AnnotationSessionImpl.computeWithSession(psiFile, false, annotationHolder -> { for (PsiElement element : elements) { annotationHolder.runAnnotatorWithContext(element, ann...
testAnnotator
254,808
void (@NotNull PsiFile psiFile, @NotNull Editor editor) { IdentifierHighlighterPass pass = new IdentifierHighlighterPassFactory().createHighlightingPass(psiFile, editor, psiFile.getTextRange()); assert pass != null; try { ReadAction.nonBlocking(() -> { DaemonProgressIndicator indicator = new DaemonProgressIndicator(); ...
runIdentifierHighlighterPass
254,809
Disposable () { return myFixture == null ? super.getTestRootDisposable() : myFixture.getTestRootDisposable(); }
getTestRootDisposable
254,810
TempDirTestFixture () { IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); return policy != null ? policy.createTempDirTestFixture() : new LightTempDirTestFixtureImpl(true); }
createTempDirTestFixture
254,811
String () { return ""; }
getBasePath
254,812
LightProjectDescriptor () { return null; }
getProjectDescriptor
254,813
String () { String path = isCommunity() ? PlatformTestUtil.getCommunityPath() : IdeaTestExecutionPolicy.getHomePathWithPolicy(); return StringUtil.trimEnd(FileUtil.toSystemIndependentName(path), "/") + '/' + StringUtil.trimStart(FileUtil.toSystemIndependentName(getBasePath()), "/"); }
getTestDataPath
254,814
boolean () { return false; }
isCommunity
254,815
boolean () { return false; }
isWriteActionRequired
254,816
Project () { return myFixture.getProject(); }
getProject
254,817
PsiManager () { return PsiManager.getInstance(getProject()); }
getPsiManager
254,818
PsiFile (FileType fileType, String text) { return PsiFileFactory.getInstance(getProject()).createFileFromText("a." + fileType.getDefaultExtension(), fileType, text); }
createLightFile
254,819
PsiFile (String fileName, Language language, String text) { return PsiFileFactory.getInstance(getProject()).createFileFromText(fileName, language, text, false, true); }
createLightFile
254,820
Module () { return myFixture.getModule(); }
getModule
254,821
void (String s) { myTester.typeWithPauses(s); }
type
254,822
boolean () { return false; }
runInDispatchThread
254,823
LookupImpl () { return (LookupImpl)myFixture.getLookup(); }
getLookup
254,824
void () { List<ThrowableRunnable<?>> actions = new ArrayList<>(); if (myProject != null) { Project project = myProject; actions.add(() -> { TestApplicationManager.tearDownProjectAndApp(myProject); myProject = null; }); for (ModuleFixtureBuilder<?> moduleFixtureBuilder : myModuleFixtureBuilders) { actions.add(() -> modu...
tearDown
254,825
void (@NotNull Project __, @NotNull Module module) { if (myModule == null) { myModule = module; } }
moduleAdded
254,826
Path () { Path tempDirectory; if (myProjectPath == null) { tempDirectory = TemporaryDirectory.generateTemporaryPath(mySanitizedName); myFilesToDelete.add(tempDirectory); } else { tempDirectory = myProjectPath; } return tempDirectory.resolve(mySanitizedName + (myIsDirectoryBasedProject ? "" : ProjectFileType.DOT_DEFAULT...
generateProjectPath
254,827
void () { TestApplicationManager.getInstance().setDataProvider(new MyDataProvider()); }
initApplication
254,828
Project () { Assert.assertNotNull("setUp() should be called first", myProject); return myProject; }
getProject
254,829
Module () { return myModule; }
getModule
254,830
Object (@NotNull @NonNls String dataId) { if (CommonDataKeys.PROJECT.is(dataId)) { return myProject; } else if (CommonDataKeys.EDITOR.is(dataId) || OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) { if (myProject == null || myProject.isDisposed()) { return null; } return FileEditorManager.getInstance(myProject).getSel...
getData
254,831
PsiDirectory () { return psiDirectory; }
getOrChooseDirectory
254,832
void (@NotNull Class<? extends ModuleFixtureBuilder<?>> aClass, @NotNull String implClassName) { try { @SuppressWarnings("unchecked") Class<? extends ModuleFixtureBuilder<?>> implClass = (Class<? extends ModuleFixtureBuilder<?>>)Class.forName(implClassName); assertTrue(aClass.isAssignableFrom(implClass)); myFixtureBuil...
registerFixtureBuilder
254,833
TestFixtureBuilder<IdeaProjectTestFixture> (@NotNull String name, boolean isDirectoryBasedProject) { return new HeavyTestFixtureBuilderImpl(new HeavyIdeaTestFixtureImpl(name, null, isDirectoryBasedProject), myFixtureBuilderProviders); }
createFixtureBuilder
254,834
TestFixtureBuilder<IdeaProjectTestFixture> (@NotNull String name, @Nullable Path projectPath, boolean isDirectoryBasedProject) { return new HeavyTestFixtureBuilderImpl(new HeavyIdeaTestFixtureImpl(name, projectPath, isDirectoryBasedProject), myFixtureBuilderProviders); }
createFixtureBuilder
254,835
TestFixtureBuilder<IdeaProjectTestFixture> (@NotNull String projectName) { return createLightFixtureBuilder(null, projectName); }
createLightFixtureBuilder
254,836
TestFixtureBuilder<IdeaProjectTestFixture> (@Nullable LightProjectDescriptor projectDescriptor, @NotNull String projectName) { if (projectDescriptor == null) { projectDescriptor = LightProjectDescriptor.EMPTY_PROJECT_DESCRIPTOR; } return new LightTestFixtureBuilderImpl<>(new LightIdeaTestFixtureImpl(projectDescriptor, ...
createLightFixtureBuilder
254,837
CodeInsightTestFixture (@NotNull IdeaProjectTestFixture projectFixture) { return createCodeInsightFixture(projectFixture, new TempDirTestFixtureImpl()); }
createCodeInsightFixture
254,838
CodeInsightTestFixture (@NotNull IdeaProjectTestFixture projectFixture, @NotNull TempDirTestFixture tempDirFixture) { return new CodeInsightTestFixtureImpl(projectFixture, tempDirFixture); }
createCodeInsightFixture
254,839
TempDirTestFixture () { return new TempDirTestFixtureImpl(); }
createTempDirTestFixture
254,840
BareTestFixture () { return new BareTestFixtureImpl(); }
createBareFixture
254,841
ModuleFixture () { return new ModuleFixtureImpl(this); }
instantiateFixture
254,842
ModuleFixtureBuilder<T> (@NotNull final String contentRootPath) { myContentRoots.add(contentRootPath); return this; }
addContentRoot
254,843
ModuleFixtureBuilder<T> (@NotNull final String sourceRootPath) { Assert.assertFalse("content root should be added first", myContentRoots.isEmpty()); mySourceRoots.add(sourceRootPath); return this; }
addSourceRoot
254,844
void (@NotNull final String outputPath) { myOutputPath = outputPath; }
setOutputPath
254,845
void (@NotNull String outputPath) { myTestOutputPath = outputPath; }
setTestOutputPath
254,846
Module () { Project project = myFixtureBuilder.getFixture().getProject(); Assert.assertNotNull(project); Path moduleFilePath = ((ProjectStoreOwner)project).getComponentStore().getProjectBasePath().getParent().resolve(getNextIndex() + ModuleFileType.DOT_DEFAULT_EXTENSION); return ModuleManager.getInstance(project).newMo...
createModule
254,847
int () { return ourIndex++; }
getNextIndex
254,848
void (@NotNull final String path) { addContentRoot(path); addSourceRoot(path); }
addSourceContentRoot
254,849
void (Module module) { final ModuleRootManager rootManager = ModuleRootManager.getInstance(module); final ModifiableRootModel rootModel = rootManager.getModifiableModel(); try { for (String contentRoot : myContentRoots) { final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(contentRoot...
initModule
254,850
void (ModifiableRootModel rootModel) { }
setupRootModel
254,851
VirtualFile (@NotNull String dataDir, @NotNull String targetDir) { return copyAll(dataDir, targetDir, VirtualFileFilter.ALL); }
copyAll
254,852
VirtualFile (@NotNull String dataDir, @NotNull String targetDir, @NotNull VirtualFileFilter filter) { createTempDirectory(); return WriteAction.computeAndWait(() -> { try { VirtualFile tempDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(myTempDir.toString()); assertNotNull(tempDir); if (!targetDir.isEmpty(...
copyAll
254,853
String () { return createTempDirectory().toString(); }
getTempDirPath
254,854
VirtualFile (@NotNull String path) { String fullPath = myTempDir.toString() + '/' + path; VfsRootAccess.allowRootAccess(getTestRootDisposable(), fullPath); return WriteAction.computeAndWait(() -> LocalFileSystem.getInstance().refreshAndFindFileByPath(fullPath)); }
getFile
254,855
VirtualFile (@NotNull String name) { Path file; try { file = createEmptyTempFile(createTempDirectory(), name); } catch (IOException e) { throw new RuntimeException(e); } VfsRootAccess.allowRootAccess(getTestRootDisposable(), file.toString()); return WriteAction.computeAndWait(() -> { return LocalFileSystem.getInstance(...
createFile
254,856
Path (@NotNull Path parent, @NotNull String name) { return parent.resolve(name.startsWith("/") ? name.substring(1) : name).normalize(); }
resolvePath
254,857
boolean () { return true; }
deleteOnTearDown
254,858
Path () { return null; }
getTempHome
254,859
Path () { if (myTempDir == null) { myTempDir = doCreateTempDirectory(); } return myTempDir; }
createTempDirectory
254,860
Path () { return HeavyTestHelper.createTempDirectoryForTempDirTestFixture(getTempHome(), "unitTest"); }
doCreateTempDirectory
254,861
T () { throw new UnsupportedOperationException(); }
instantiateFixture
254,862
VirtualFile (@NotNull String path) { return WriteAction.computeAndWait(() -> { try { return findOrCreateChildDir(getSourceRoot(), path); } catch (IOException e) { throw new RuntimeException(e); } }); }
findOrCreateDir
254,863
VirtualFile (@NotNull String dataDir, @NotNull String targetDir) { return copyAll(dataDir, targetDir, VirtualFileFilter.ALL); }
copyAll
254,864
VirtualFile (@NotNull String dataDir, @NotNull String targetDir, @NotNull VirtualFileFilter filter) { return ApplicationManager.getApplication().runWriteAction(new Computable<>() { @Override public VirtualFile compute() { VirtualFile from = LocalFileSystem.getInstance().refreshAndFindFileByPath(dataDir); Assert.assertN...
copyAll
254,865
VirtualFile () { VirtualFile from = LocalFileSystem.getInstance().refreshAndFindFileByPath(dataDir); Assert.assertNotNull("Cannot find testdata directory " + dataDir, from); try { UsefulTestCase.refreshRecursively(from); VirtualFile tempDir = getSourceRoot(); if (targetDir.length() > 0) { tempDir = findOrCreateChildDir...
compute
254,866
String () { return "temp:///root"; }
getTempDirPath
254,867
VirtualFile (@NotNull String path) { VirtualFile sourceRoot = getSourceRoot(); VirtualFile result = sourceRoot.findFileByRelativePath(path); if (result == null) { sourceRoot.refresh(false, true); result = sourceRoot.findFileByRelativePath(path); } return result; }
getFile
254,868
VirtualFile (@NotNull String targetPath) { try { return WriteAction.computeAndWait(() -> doCreateFile(targetPath)); } catch (IOException e) { throw new RuntimeException(e); } }
createFile
254,869
void () { if (!mySourceRoot.isInitialized()) { return; } ApplicationManager.getApplication().runWriteAction(() -> { VirtualFile sourceRoot = mySourceRoot.getValue(); VirtualFile[] toDelete = sourceRoot == null ? getSourceRoot().getChildren() : new VirtualFile[]{sourceRoot}; for (VirtualFile file : toDelete) { try { fil...
deleteAll
254,870
VirtualFile () { VirtualFile sourceRoot = mySourceRoot.getValue(); return sourceRoot == null ? LightPlatformTestCase.getSourceRoot() : sourceRoot; }
getSourceRoot
254,871
Module () { if (myModule == null) { myModule = myBuilder.buildModule(); } return myModule; }
getModule
254,872
HeavyIdeaTestFixture () { return myFixture; }
getFixture
254,873
void (@NotNull Class<?> builderClass) { try { for (Field field : builderClass.getFields()) { field.get(null); } } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
loadClassConstants
254,874
void (@NotNull VirtualFile file, @NotNull Editor editor) { myFile = file; this.editor = editor; myEditorTestFixture = new EditorTestFixture(getProject(), editor, file); myPsiFile = ReadAction.compute(() -> PsiManager.getInstance(getProject()).findFile(myFile)); }
setFileAndEditor
254,875
void () { myFile = null; editor = null; myEditorTestFixture = null; myPsiFile = null; myAllPsiFiles = null; }
clearFileAndEditor
254,876
void (GutterMark renderer, int offset, @NotNull Map<? super Integer, List<GutterMark>> result) { if (renderer == null) return; List<GutterMark> renderers = result.computeIfAbsent(offset, __ -> new SmartList<>()); renderers.add(renderer); }
addGutterIconRenderer
254,877
void (@NotNull List<? extends HighlightInfo> infos) { infos.sort((o1, o2) -> { int i = o1.startOffset - o2.startOffset; return i != 0 ? i : o1.getSeverity().myVal - o2.getSeverity().myVal; }); HighlightInfo prevInfo = null; for (Iterator<? extends HighlightInfo> it = infos.iterator(); it.hasNext();) { HighlightInfo inf...
removeDuplicatedRangesForInjected
254,878
List<HighlightInfo> (@NotNull PsiFile file, @NotNull Editor editor, int @NotNull [] toIgnore, boolean canChangeDocument) { return instantiateAndRun(file, editor, toIgnore, canChangeDocument, false); }
instantiateAndRun
254,879
List<HighlightInfo> (@NotNull PsiFile psiFile, @NotNull Editor editor, int @NotNull [] toIgnore, boolean canChangeDocument, boolean readEditorMarkupModel) { Project project = psiFile.getProject(); ensureIndexesUpToDate(project); VirtualFile virtualFile = psiFile.getVirtualFile(); if (!ReadAction.compute(() -> ProblemHi...
instantiateAndRun
254,880
void (@NotNull Project project) { if (!DumbService.isDumb(project)) { ReadAction.run(() -> { for (FileBasedIndexExtension<?,?> extension : FileBasedIndexExtension.EXTENSION_POINT_NAME.getExtensionList()) { FileBasedIndex.getInstance().ensureUpToDate(extension.getName(), project, null); } }); } }
ensureIndexesUpToDate
254,881
List<IntentionAction> (@NotNull Editor editor, @NotNull PsiFile file) { IdeaTestExecutionPolicy current = IdeaTestExecutionPolicy.current(); if (current != null) { current.waitForHighlighting(file.getProject(), editor); } waitForUnresolvedReferencesQuickFixesUnderCaret(file, editor); List<IntentionAction> result = new ...
getAvailableIntentions
254,882
IntentionListStep (@NotNull Editor editor, @NotNull PsiFile file) { CachedIntentions cachedIntentions = ShowIntentionActionsHandler.calcCachedIntentions(file.getProject(), editor, file); return new IntentionListStep(null, editor, file, file.getProject(), cachedIntentions); }
getIntentionListStep
254,883
void (@NotNull PsiFile file, @NotNull Editor editor) { if (ApplicationManager.getApplication().isDispatchThread()) { assert !ApplicationManager.getApplication().isWriteAccessAllowed(): "must not call under write action"; Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { if (!ReadActio...
waitForUnresolvedReferencesQuickFixesUnderCaret
254,884
String () { return myTempDirFixture.getTempDirPath(); }
getTempDirPath
254,885
TempDirTestFixture () { return myTempDirFixture; }
getTempDirFixture
254,886
VirtualFile (@NotNull String sourcePath) { return copyFileToProject(sourcePath, sourcePath); }
copyFileToProject
254,887
VirtualFile (@NotNull String sourcePath, @NotNull String targetPath) { String testDataPath = getTestDataPath(); File sourceFile = new File(testDataPath, toSystemDependentName(sourcePath)); if (!sourceFile.exists()) { File candidate = new File(sourcePath); if (candidate.isAbsolute()) { sourceFile = candidate; if (FileUt...
copyFileToProject
254,888
void (@NotNull File sourceFile) { try { String sourceName = sourceFile.getPath(); File realFile = sourceFile.getCanonicalFile(); String realFileName = realFile.getPath(); if (!sourceName.equals(realFileName) && sourceName.equalsIgnoreCase(realFileName)) { fail("Please correct case-sensitivity of path to prevent test fa...
assertFileEndsWithCaseSensitivePath
254,889
void (@NotNull File sourceFile, @NotNull VirtualFile targetFile) { try { WriteAction.runAndWait(() -> { targetFile.setBinaryContent(FileUtil.loadFileBytes(sourceFile)); // update the document now, otherwise MemoryDiskConflictResolver will do it later at unexpected moment of time FileDocumentManager.getInstance().reload...
copyContent
254,890
VirtualFile (@NotNull String sourcePath, @NotNull String targetPath) { String testDataPath = getTestDataPath(); File fromFile = new File(testDataPath + "/" + sourcePath); if (myTempDirFixture instanceof LightTempDirTestFixtureImpl) { return myTempDirFixture.copyAll(fromFile.getPath(), targetPath); } File targetFile = n...
copyDirectoryToProject
254,891
void (InspectionProfileEntry @NotNull ... inspections) { assertInitialized(); InspectionsKt.enableInspectionTools(getProject(), myProjectFixture.getTestRootDisposable(), inspections); }
enableInspections
254,892
void (Class<? extends LocalInspectionTool> @NotNull ... inspections) { enableInspections(Arrays.asList(inspections)); }
enableInspections
254,893
void (@NotNull Collection<Class<? extends LocalInspectionTool>> inspections) { List<InspectionProfileEntry> tools = InspectionTestUtil.instantiateTools(inspections); enableInspections(tools.toArray(new InspectionProfileEntry[0])); }
enableInspections
254,894
void (InspectionProfileEntry @NotNull ... inspections) { InspectionsKt.disableInspections(getProject(), inspections); }
disableInspections
254,895
void (InspectionToolProvider @NotNull ... providers) { List<Class<? extends LocalInspectionTool>> classes = Stream.of(providers) .flatMap(p -> Stream.of(p.getInspectionClasses())) .filter(LocalInspectionTool.class::isAssignableFrom) .collect(Collectors.toList()); enableInspections(classes); }
enableInspections
254,896
long (boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, String @NotNull ... filePaths) { if (filePaths.length > 0) { configureByFilesInner(filePaths); } return collectAndCheckHighlighting(checkWarnings, checkInfos, checkWeakWarnings); }
testHighlighting
254,897
long (boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, String @NotNull ... paths) { return collectAndCheckHighlighting(checkWarnings, checkInfos, checkWeakWarnings, Stream.of(paths).map(this::copyFileToProject)); }
testHighlightingAllFiles
254,898
long (boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, VirtualFile @NotNull ... files) { return collectAndCheckHighlighting(checkWarnings, checkInfos, checkWeakWarnings, Stream.of(files)); }
testHighlightingAllFiles
254,899
long (boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, @NotNull Stream<? extends VirtualFile> files) { record FileHighlighting(PsiFile file, Editor editor, ExpectedHighlightingData data) {} List<FileHighlighting> data = files.map(file -> { PsiFile psiFile = myPsiManager.findFile(file); assertNotNul...
collectAndCheckHighlighting