Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
63,200
void (UExpression argument, Map<String, Computable<UValue>> argumentMap, Collection<TestDataFile> result) { UValue testDataFileValue = UEvaluationContextKt.uValueOf(argument, new TestDataEvaluatorExtension(argumentMap)); if (testDataFileValue instanceof UStringConstant) { result.add(new TestDataFile.LazyResolved(myTest...
handleArgument
63,201
String () { return StringUtil.join(myLogMessages, "\n"); }
getLog
63,202
Object (@NotNull PsiMethod target, @NotNull List<? extends UValue> argumentValues) { if (target.getName().equals("getTestName") && argumentValues.size() == 1) { UValue lowercaseArg = argumentValues.get(0); boolean lowercaseArgValue = lowercaseArg instanceof UBooleanConstant && ((UBooleanConstant)lowercaseArg).getValue(...
evaluateMethodCall
63,203
Object (@NotNull UVariable variable) { if (variable instanceof UParameter) { Computable<UValue> value = myArguments.get(variable.getName()); if (value != null) { UValue computedValue = value.compute(); UConstant constant = computedValue.toConstant(); return constant != null ? constant.getValue() : super.evaluateVariabl...
evaluateVariable
63,204
String (String name) { boolean lowercaseChars = false; int uppercaseChars = 0; for (int i = 0; i < name.length(); i++) { if (Character.isLowerCase(name.charAt(i))) { lowercaseChars = true; break; } if (Character.isUpperCase(name.charAt(i))) { uppercaseChars++; } } return !lowercaseChars && uppercaseChars >= 3 ? name : ...
lowercaseFirstLetter
63,205
List<TestDataFile> (@NotNull PsiMethod psiMethod, @Nullable String testDataPath) { Application application = ApplicationManager.getApplication(); if (!application.isUnitTestMode() && application.isHeadlessEnvironment()) { // shouldn't be invoked under these conditions anyway, just for additional safety LOG.warn("Collec...
collectTestDataByExistingFiles
63,206
List<TestDataFile> (PsiMethod method) { String testName = getTestName(method); if (testName == null) return Collections.emptyList(); PsiClass psiClass = method.getContainingClass(); if (psiClass == null) return Collections.emptyList(); String testDataBasePath = TestDataLineMarkerProvider.getTestDataBasePath(psiClass); ...
guessTestDataName
63,207
List<TestDataFile> (PsiMethod psiMethod, String testDataBasePath, String testName) { return buildDescriptorFromExistingTestData(psiMethod, testDataBasePath).generateByTemplates(testName, null); }
guessTestDataBySiblingTest
63,208
String (@NotNull PsiMethod method) { final PsiClass psiClass = PsiTreeUtil.getParentOfType(method, PsiClass.class); if (psiClass == null) { return null; } TestFramework framework = TestFrameworks.detectFramework(psiClass); if (framework == null || !framework.isTestMethod(method)) { return null; } return getTestName(met...
getTestName
63,209
String (@NotNull String methodName) { return StringUtil.trimStart(methodName, "test"); }
getTestName
63,210
TestDataDescriptor (@NotNull PsiMethod method, @Nullable String testDataPath) { return CachedValuesManager.getCachedValue(method, () -> new CachedValueProvider.Result<>( buildDescriptor(method, testDataPath), PsiModificationTracker.MODIFICATION_COUNT)); }
buildDescriptorFromExistingTestData
63,211
TestDataDescriptor (@NotNull PsiMethod psiMethod, @Nullable String testDataPath) { PsiClass psiClass = PsiTreeUtil.getParentOfType(psiMethod, PsiClass.class); String testName = getTestName(psiMethod); if (testName == null || psiClass == null) return TestDataDescriptor.NOTHING_FOUND; return buildDescriptor(testName, psi...
buildDescriptor
63,212
List<TestDataFile> (@NotNull String testName, String testDataPath, @NotNull PsiClass psiClass) { return buildDescriptor(testName, psiClass, testDataPath).restoreFiles(); }
suggestTestDataFiles
63,213
TestDataDescriptor (@NotNull String testName, @NotNull PsiClass psiClass, @Nullable String testDataPath) { String normalizedTestDataPath = testDataPath == null ? null : StringUtil.trimEnd(StringUtil.trimEnd(testDataPath, "/"), "\\"); // PhpStorm has tests that use '$' symbol as a file path separator, e.g. 'test$while_s...
buildDescriptor
63,214
Collection<String> (final String testName, final GotoFileModel model) { CommonProcessors.CollectProcessor<String> processor = new CommonProcessors.CollectProcessor<>() { @Override public boolean accept(String name) { ProgressManager.checkCanceled(); return StringUtil.containsIgnoreCase(name, testName); } }; model.proce...
getAllFileNames
63,215
boolean (String name) { ProgressManager.checkCanceled(); return StringUtil.containsIgnoreCase(name, testName); }
accept
63,216
void (List<TestLocationDescriptor> descriptorsByFileNames) { if (descriptorsByFileNames.size() < 2) { return; } if (!ContainerUtil.exists(descriptorsByFileNames, descriptor -> descriptor.isFromCurrentModule)) { return; } descriptorsByFileNames.removeIf(d -> !d.isFromCurrentModule); }
filterDirsFromOtherModules
63,217
String (@NotNull PsiClass psiClass) { String result = psiClass.getQualifiedName(); if (result == null) { return null; } result = StringUtil.trimEnd(result, "Test"); int i = result.lastIndexOf('.'); if (i >= 0) { result = result.substring(i + 1); } return result; }
getSimpleClassName
63,218
boolean (@NotNull TestLocationDescriptor candidate, @NotNull TestLocationDescriptor current, @NotNull PsiClass psiClass) { final String className = psiClass.getQualifiedName(); if (className == null) { return false; } boolean candidateMatched; boolean currentMatched; // By package. int lastDotIndex = className.lastInde...
moreRelevantPath
63,219
TestLocationDescriptor (@NotNull String testName, @NotNull VirtualFile matched, @NotNull Project project, @Nullable Module module) { if (testName.isEmpty()) return null; String path = matched.getPath(); int idx = StringUtil.indexOf(path, testName); boolean capitalized = StringUtil.isCapitalized(testName); boolean start...
create
63,220
int () { int result = 0; result = 31 * result + (pathPrefix != null ? pathPrefix.hashCode() : 0); result = 31 * result + (pathSuffix != null ? pathSuffix.hashCode() : 0); result = 31 * result + (startWithLowerCase ? 1 : 0); return result; }
hashCode
63,221
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestLocationDescriptor that = (TestLocationDescriptor)o; if (startWithLowerCase != that.startWithLowerCase) return false; if (!Objects.equals(pathPrefix, that.pathPrefix)) return false; if (!Objects.equals(pathSu...
equals
63,222
String () { return String.format("%s[...]%s", pathPrefix, pathSuffix); //NON-NLS }
toString
63,223
List<TestDataFile> () { return ContainerUtil.mapNotNull(myDescriptors, d -> { PsiFile file = ReadAction.compute(() -> d.filePointer.getElement()); return file == null ? null : new TestDataFile.Existing(file.getVirtualFile()); }); }
restoreFiles
63,224
List<TestDataFile> (@NotNull String testName, @Nullable String root) { List<TestDataFile> result = new ArrayList<>(); if (StringUtil.isEmpty(testName)) { return result; } for (TestLocationDescriptor descriptor : myDescriptors) { if (root != null && !descriptor.pathPrefix.startsWith(root)) continue; result.add(new TestD...
generateByTemplates
63,225
String () { return myDescriptors.toString(); }
toString
63,226
String () { return myTestDataFiles.size() != 1 ? DevKitBundle.message("testdata.related.navigation.title") : myTestDataFiles.get(0).getName(); }
getCustomName
63,227
void () { RelativePoint location = JBPopupFactory.getInstance().guessBestPopupLocation(myEditor); TestDataNavigationHandler.navigate(location, myTestDataFiles, Objects.requireNonNull(getElement()).getProject()); }
navigate
63,228
JComponent () { Splitter result = SoftReference.dereference(myComponent); if (result == null) { myComponent = new WeakReference<>(result = createComponent()); } return result; }
getComponent
63,229
Splitter () { Splitter splitter = new OnePixelSplitter(false, 0.5f, 0.1f, 0.9f); splitter.setFirstComponent(wrapWithTitle(myFile.getBeforeFile().getName(), myBeforeEditor)); splitter.setSecondComponent(wrapWithTitle(myFile.getAfterFile().getName(), myAfterEditor)); return splitter; }
createComponent
63,230
Editor () { return (SwingUtilities.isEventDispatchThread() && isBeforeEditorFocused() ? myBeforeEditor : myAfterEditor).getEditor(); }
getEditor
63,231
boolean () { IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject); Component focusOwner = focusManager.getFocusOwner(); Splitter splitter = (Splitter)getComponent(); return UIUtil.isDescendingFrom(focusOwner, splitter.getFirstComponent()); }
isBeforeEditorFocused
63,232
boolean (@NotNull Navigatable navigatable) { return false; }
canNavigateTo
63,233
void (@NotNull Navigatable navigatable) { }
navigateTo
63,234
JComponent (@NlsSafe String name, FileEditor beforeEditor) { JPanel panel = new JPanel(new BorderLayout()); JLabel label = new JBLabel(name, UIUtil.ComponentStyle.SMALL); label.setBorder(JBUI.Borders.empty(1, 4, 2, 0)); panel.add(BorderLayout.NORTH, label); panel.add(BorderLayout.CENTER, beforeEditor.getComponent()); r...
wrapWithTitle
63,235
JComponent () { return null; }
getPreferredFocusedComponent
63,236
String () { return myFile.getName(); }
getName
63,237
void (@NotNull FileEditorState state) { }
setState
63,238
boolean () { return myBeforeEditor.isModified() || myAfterEditor.isModified(); }
isModified
63,239
boolean () { return myBeforeEditor.isValid() && myAfterEditor.isValid(); }
isValid
63,240
void (@NotNull PropertyChangeListener listener) { }
addPropertyChangeListener
63,241
void (@NotNull PropertyChangeListener listener) { }
removePropertyChangeListener
63,242
VirtualFile () { return myFile; }
getFile
63,243
void () { TextEditorProvider.getInstance().disposeEditor(myBeforeEditor); TextEditorProvider.getInstance().disposeEditor(myAfterEditor); }
dispose
63,244
void (@NotNull AnActionEvent e) { RelativePoint point = JBPopupFactory.getInstance().guessBestPopupLocation(e.getDataContext()); TestDataNavigationHandler.navigate(point, Collections.singletonList(new TestDataFile.LazyResolved(myFilePath)), myProject); }
actionPerformed
63,245
int (Object o) { return o instanceof GotoTestDataAction ? 0 : 1; }
compareTo
63,246
List<Location> (Project project, VirtualFile file) { if (DumbService.isDumb(project)) return Collections.emptyList(); final List<Location> locations = new ArrayList<>(); final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); if (fileIndex.isInContent(file) && !fileIndex.isInSource(fi...
collectRelativeLocations
63,247
Location (Project project, String fileName, String nameWithoutExtension, PsiClass aClass) { final PsiAnnotation annotation = AnnotationUtil.findAnnotation(aClass, TestFrameworkConstants.TEST_DATA_PATH_ANNOTATION_QUALIFIED_NAME); if (annotation != null) { final Location parameterizedLocation = PsiMemberParameterizedLoca...
getLocation
63,248
String (@NotNull String beforeName, @NotNull String afterName) { if (isBeforeAfterPrefixedPair(beforeName, afterName)) { return BEFORE_AFTER_DISPLAY_NAME_PART + StringUtil.trimStart(beforeName, TESTDATA_FILE_BEFORE_MARKER); } String commonPrefix = StringUtil.commonPrefix(beforeName, afterName); if (!commonPrefix.isEmpt...
getGroupDisplayName
63,249
TestDataGroupVirtualFile (@NotNull String fileName1, @NotNull String fileName2) { return getTestDataGroup(new TestDataFile.LazyResolved(fileName1), new TestDataFile.LazyResolved(fileName2)); }
getTestDataGroup
63,250
TestDataGroupVirtualFile (@NotNull TestDataFile testDataFile1, @NotNull TestDataFile testDataFile2) { VirtualFile file1 = testDataFile1.getVirtualFile(); VirtualFile file2 = testDataFile2.getVirtualFile(); if (file1 == null || file2 == null) { return null; } if (!Objects.equals(file1.getParent(), file2.getParent())) { ...
getTestDataGroup
63,251
boolean (@NotNull @NonNls String name1, @NotNull @NonNls String name2) { String lcName1 = StringUtil.toLowerCase(name1); String lcName2 = StringUtil.toLowerCase(name2); if (lcName1.startsWith(TESTDATA_FILE_BEFORE_MARKER) && lcName2.startsWith(TESTDATA_FILE_AFTER_MARKER)) { String lcName1MainPart = StringUtil.substringA...
isBeforeAfterPrefixedPair
63,252
boolean (@NonNls String nameToCheck, @NonNls String secondName, int commonPrefixLength) { String nameToCheckLastPart = StringUtil.toLowerCase(nameToCheck.substring(commonPrefixLength)); if (!nameToCheckLastPart.contains(TESTDATA_FILE_AFTER_MARKER)) { return false; } String nameToCheckWithoutAfter = nameToCheckLastPart....
isAfterSuffixed
63,253
void (final Project project, final String path) { VirtualFile file = ApplicationManager.getApplication().runWriteAction(new Computable<>() { @Override public VirtualFile compute() { try { File file = new File(path); VirtualFile parent = VfsUtil.createDirectories(file.getParent()); return parent.createChildData(this, fi...
createFileAndNavigate
63,254
VirtualFile () { try { File file = new File(path); VirtualFile parent = VfsUtil.createDirectories(file.getParent()); return parent.createChildData(this, file.getName()); } catch (IOException e) { Messages.showErrorDialog(project, e.getMessage(), DevKitBundle.message("testdata.create.dialog.title")); return null; } }
compute
63,255
void (@NotNull Project project, @NotNull TestDataFile testDataFile) { VirtualFile file = testDataFile.getVirtualFile(); if (file != null) { PsiNavigationSupport.getInstance().createNavigatable(project, file, -1).navigate(true); } else { String displayPath = getHtmlDisplayPathForMissingFile(project, testDataFile.getPath...
openOrAskToCreateFile
63,256
String (Project project, String path) { return getHtmlDisplayPathForRelativePathPair(getRelativePathPairForMissingFile(project, path)); }
getHtmlDisplayPathForMissingFile
63,257
String (Pair<String, String> relativePathPair) { String base = relativePathPair.getFirst(); if (base == null) { return relativePathPair.getSecond(); } else { return "<b>" + base + "</b>/" + relativePathPair.getSecond(); // NON-NLS } }
getHtmlDisplayPathForRelativePathPair
63,258
String (@NotNull Project project, @NotNull VirtualFile file) { if (!(file instanceof TestDataGroupVirtualFile)) { return null; } // TestDataGroupVirtualFile.getName() implementation is fine return file.getName(); }
getEditorTabTitle
63,259
void (@NotNull PsiReferenceRegistrar registrar) { UastReferenceRegistrar.registerUastReferenceProvider(registrar, UastPatterns.injectionHostUExpression() .annotationParam( TestFrameworkConstants.TEST_DATA_PATH_ANNOTATION_QUALIFIED_NAME, "value"), new TestDataReferenceProvider(), PsiReferenceRegistrar.DEFAULT_PRIORITY);...
registerReferenceProviders
63,260
boolean (@NotNull PsiElement target) { return target instanceof PsiFileSystemItem; }
acceptsTarget
63,261
boolean () { return false; }
isEmptyPathAllowed
63,262
boolean () { return super.isAbsolutePathReference() || StringUtil.startsWithChar(getPathString(), '$'); }
isAbsolutePathReference
63,263
FileReference (TextRange range, int index, String text) { return new TestDataReference(this, range, index, text); }
createFileReference
63,264
Collection<PsiFileSystemItem> () { return toFileSystemItems(ManagingFS.getInstance().getLocalRoots()); }
computeDefaultContexts
63,265
Condition<PsiFileSystemItem> () { return DIRECTORY_FILTER; }
getReferenceCompletionFilter
63,266
PsiDirectory () { final Project project = getElement().getProject(); final VirtualFile projectDir = project.getBaseDir(); if (projectDir != null) { final PsiManager psiManager = PsiManager.getInstance(project); return psiManager.findDirectory(projectDir); } return null; }
getProjectPsiRoot
63,267
PsiDirectory () { final Project project = getElement().getProject(); final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); final VirtualFile file = getElement().getContainingFile().getOriginalFile().getVirtualFile(); if (file != null) { final VirtualFile contentRoot = fileIndex.getC...
getContentPsiRoot
63,268
boolean () { return true; }
exists
63,269
VirtualFile () { return myFile; }
getVirtualFile
63,270
String () { return myFile.getPath(); }
getPath
63,271
String () { return myFile.getName(); }
getName
63,272
boolean () { return false; }
exists
63,273
VirtualFile () { return null; }
getVirtualFile
63,274
String () { return myPath; }
getPath
63,275
String () { return PathUtil.getFileName(getPath()); }
getName
63,276
void () { if (!myResolved) { myResolved = true; myFile = ReadAction.compute(() -> LocalFileSystem.getInstance().refreshAndFindFileByPath(myPath)); } }
resolve
63,277
boolean () { resolve(); return getVirtualFile() != null; }
exists
63,278
VirtualFile () { resolve(); return myFile; }
getVirtualFile
63,279
String () { return PathUtil.getFileName(getPath()); }
getName
63,280
String () { return myPath; }
getPath
63,281
void (MouseEvent e, PsiMethod elt) { List<TestDataFile> fileNames = getFileNames(elt); if (fileNames.isEmpty()) return; navigate(new RelativePoint(e), fileNames, elt.getProject()); }
navigate
63,282
List<TestDataFile> (PsiMethod method) { return getFileNames(method, true); }
getFileNames
63,283
List<TestDataFile> (PsiMethod method, boolean collectByExistingFiles) { List<TestDataFile> fileNames = null; String testDataPath = TestDataLineMarkerProvider.getTestDataBasePath(method.getContainingClass()); if (testDataPath != null) { fileNames = new TestDataReferenceCollector(testDataPath, method.getName().substring(...
getFileNames
63,284
void (@NotNull RelativePoint point, @NotNull List<TestDataFile> testDataFiles, Project project) { if (testDataFiles.isEmpty()) return; if (testDataFiles.size() == 1) { TestDataUtil.openOrAskToCreateFile(project, testDataFiles.get(0)); return; } else if (testDataFiles.size() == 2) { TestDataGroupVirtualFile groupFile = ...
navigate
63,285
List<String> (@NotNull String testDataFileRelativePath, PsiMethod method) { return getFileNames(method, false).stream() .map(TestDataFile::getPath) .filter(path -> path.endsWith(testDataFileRelativePath.startsWith("/") ? testDataFileRelativePath : "/" + testDataFileRelativePath)) .distinct() .collect(Collectors.toList(...
fastGetTestDataPathsByRelativePath
63,286
void (Project project, List<TestDataFile> filePaths, RelativePoint point) { filePaths.sort(Comparator.comparing(TestDataFile::getName, String.CASE_INSENSITIVE_ORDER)); List<TestDataNavigationElement> elementsToDisplay = new ArrayList<>(); List<TestDataNavigationElement> nonExistingElementsToDisplay = new ArrayList<>();...
showNavigationPopup
63,287
void (@NotNull JList list, TestDataNavigationElement element, int index, boolean selected, boolean hasFocus) { element.getTitleFragments().forEach(pair -> append(pair.getFirst(), pair.getSecond())); setIcon(element.getIcon()); }
customizeCellRenderer
63,288
void (@NotNull Project project, @NotNull Set<TestDataFile> files, @NotNull Consumer<TestDataNavigationElement> consumer) { for (Map.Entry<VirtualFile, Collection<TestDataFile>> e: ContainerUtil.groupBy(files, f -> { VirtualFile file = f.getVirtualFile(); assert file != null; return file.getParent(); }).entrySet()) { Co...
consumeElementsToDisplay
63,289
String () { return DevKitBundle.message("gutter.name.test.data.line.marker"); }
getName
63,290
Icon () { return AllIcons.Nodes.Folder; }
getIcon
63,291
void (@NotNull List<? extends PsiElement> elements, @NotNull Collection<? super LineMarkerInfo<?>> result) { for (PsiElement element : elements) { RunLineMarkerContributor.Info info = getSlowInfo(element); if (info != null) { result.add(RunLineMarkerProvider.createLineMarker(element, AllIcons.Nodes.Folder, Collections....
collectSlowLineMarkers
63,292
String (@Nullable PsiClass psiClass) { if (psiClass == null) return null; return CachedValuesManager.getCachedValue(psiClass, () -> { final List<String> pathComponents = new ArrayList<>(); PsiClass currentPsiClass = psiClass; String testMetaData = null; String testDataPath = null; while (currentPsiClass != null) { test...
getTestDataBasePath
63,293
String (@NotNull PsiModifierListOwner owner, String annotationFqName) { Set<String> annotationNames = Collections.singleton(annotationFqName); boolean nestedClass = owner instanceof PsiClass && ((PsiClass)owner).getContainingClass() != null; PsiAnnotation element = nestedClass ? AnnotationUtil.findAnnotation(owner, ann...
annotationValue
63,294
String () { return TestDataUtil.getGroupDisplayName(myBeforeFile.getName(), myAfterFile.getName()); }
getName
63,295
VirtualFile () { return myBeforeFile; }
getBeforeFile
63,296
VirtualFile () { return myAfterFile; }
getAfterFile
63,297
VirtualFileSystem () { return TestDataGroupFileSystem.getTestDataGroupFileSystem(); }
getFileSystem
63,298
String () { return TestDataGroupFileSystem.getPath(myBeforeFile, myAfterFile); }
getPath
63,299
boolean () { return myBeforeFile.isWritable(); }
isWritable