Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
255,300
PsiElement (@NotNull FoldRegion region, @NotNull PsiFile file) { return findElement(region.getStartOffset(), region.getEndOffset(), file); }
findElement
255,301
PsiElement (int startOffset, int endOffset, @NotNull PsiFile file) { for (PsiElement element = file.findElementAt(startOffset); element != null; element = element.getParent()) { TextRange range = element.getTextRange(); if (range.getStartOffset() < startOffset) { return null; } if (range.getStartOffset() == startOffset...
findElement
255,302
void (@NotNull String text, @NotNull String ext) { myFixture.configureByText("test." + ext, text); EditorTestUtil.buildInitialFoldingsInBackground(myFixture.getEditor()); EditorFoldingInfo info = EditorFoldingInfo.get(myFixture.getEditor()); FoldRegion[] foldRegions = myFixture.getEditor().getFoldingModel().getAllFoldR...
doTest
255,303
String () { return myExpectedText; }
getExpectedText
255,304
boolean () { return myShouldPresent; }
shouldPresent
255,305
boolean () { return myCheckPreview; }
shouldCheckPreview
255,306
IntentionAction (@NotNull Collection<? extends IntentionAction> actions, @NotNull Supplier<String> infoSupplier) { return findAndCheck(actions, null, infoSupplier); }
findAndCheck
255,307
IntentionAction (@NotNull Collection<? extends IntentionAction> actions, @Nullable ActionContext context, @NotNull Supplier<String> infoSupplier) { String[] steps = myExpectedText.split("\\|->"); CommonIntentionAction found = null; Collection<? extends CommonIntentionAction> commonActions = actions; for (int i = 0; i <...
findAndCheck
255,308
String (@Nullable ActionContext context, CommonIntentionAction t) { if (t instanceof IntentionAction intention) { return intention.getText(); } if (!(t instanceof ModCommandAction action)) { throw new AssertionError("Action is not ModCommandAction: " + t); } if (context == null) { fail("Context is not specified for Mod...
getActionText
255,309
String (String text) { return "Action with " + (myExactMatch ? "text" : "prefix") + " '" + text + "'"; }
exceptionHeader
255,310
ActionHint (@NotNull PsiFile file, @NotNull String contents) { return parse(file, contents, true); }
parse
255,311
ActionHint (@NotNull PsiFile file, @NotNull String contents, boolean exactMatch) { PsiFile hostFile = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file); final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(hostFile.getLanguage()); String comment = commenter.getLineCommentPrefix...
parse
255,312
void (final String text, final String textAfter) { String fileName = "before." + getFileExtension(); PsiFile file = createFileFromText(text, fileName, PsiFileFactory.getInstance(getProject())); checkDocument(file, text, textAfter); }
doTextTest
255,313
PsiFile (String text, String fileName, final PsiFileFactory fileFactory) { return fileFactory.createFileFromText(fileName, getFileType(fileName), text, LocalTimeCounter.currentTime(), true, false); }
createFileFromText
255,314
FileType (String fileName) { return FileTypeManager.getInstance().getFileTypeByFileName(fileName); }
getFileType
255,315
Disposable () { return myBeforeParentDisposeDisposable; }
getTestRootDisposable
255,316
boolean () { return false; }
doCheckDocumentUpdate
255,317
void (final PsiFile file, final String text, String textAfter) { final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(file); assert document != null; final EditorImpl editor; if (doCheckDocumentUpdate()) { editor =(EditorImpl)FileEditorManager.getInstance(getProject()).openTextEditor(new O...
checkDocument
255,318
void (final PsiFile file) { try { if (myTextRange == null) { CodeStyleManager.getInstance(getProject()).reformat(file); } else { CodeStyleManager.getInstance(getProject()).reformatRange(file, myTextRange.getStartOffset(), myTextRange.getEndOffset()); } } catch (IncorrectOperationException e) { fail(); } }
performFormatting
255,319
void (final PsiFile file) { try { if (myTextRange == null) { CodeStyleManager.getInstance(getProject()).reformatText(file, 0, file.getTextLength()); } else { CodeStyleManager.getInstance(getProject()).reformatText(file, myTextRange.getStartOffset(), myTextRange.getEndOffset()); } } catch (IncorrectOperationException e)...
performFormattingWithDocument
255,320
String () { return PathManagerEx.getTestDataPath(); }
getTestDataPath
255,321
String (final String text) { return text; }
prepareText
255,322
CommonCodeStyleSettings (Language language) { return CodeStyle.getSettings(getProject()).getCommonSettings(language); }
getSettings
255,323
CodeStyleSettings () { return CodeStyle.getSettings(getProject()); }
getSettings
255,324
String (final List<? extends File> failedFiles) { final StringBuilder result = new StringBuilder(); for (File file : failedFiles) { result.append(file.getPath()); result.append("\n"); } return result.toString(); }
composeMessage
255,325
void (@NotNull MockApplication application, @NotNull MockProjectEx project, @NotNull PluginDescriptor pluginDescriptor) { registerExtensionPoint(project.getExtensionArea(), MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME, MultiHostInjector.class, pluginDescriptor); registerExtensionPoint(application.getExtensionArea(), La...
registerMockInjectedLanguageManager
255,326
String () { return "fold"; }
getMarker
255,327
void (@NotNull Info info, @NotNull Map<String, String> attributes, int start, int end) { String placeholder = ObjectUtils.notNull(attributes.get("text"), "..."); info.foldings.add(new FoldingInfo(placeholder, start, end)); }
handle
255,328
record (String placeholder, int start, int end) { }
FoldingInfo
255,329
String () { return "range"; }
getMarker
255,330
void (@NotNull Info info, @NotNull Map<String, String> attributes, int start, int end) { info.ranges.add(TextRange.create(start, end)); }
handle
255,331
CommonCodeStyleSettings () { return CodeStyle.getSettings(myFixture.getProject()).getCommonSettings(language); }
getCommonSettings
255,332
ArrangementSectionRule (StdArrangementMatchRule @NotNull ... rules) { return section(null, null, rules); }
section
255,333
ArrangementSectionRule (@Nullable String start, @Nullable String end, StdArrangementMatchRule @NotNull ... rules) { return ArrangementSectionRule.create(start, end, rules); }
section
255,334
StdArrangementRuleAliasToken (@NotNull String id, StdArrangementMatchRule @NotNull ... rules) { return new StdArrangementRuleAliasToken(id, id, List.of(rules)); }
alias
255,335
ArrangementGroupingRule (@NotNull ArrangementSettingsToken type) { return group(type, KEEP); }
group
255,336
ArrangementGroupingRule (@NotNull ArrangementSettingsToken type, @NotNull ArrangementSettingsToken order) { return new ArrangementGroupingRule(type, order); }
group
255,337
StdArrangementMatchRule (@NotNull ArrangementSettingsToken token) { return new StdArrangementMatchRule(new StdArrangementEntryMatcher(atom(token))); }
rule
255,338
StdArrangementMatchRule (@NotNull String nameFilter, ArrangementSettingsToken @NotNull ... tokens) { if (tokens.length == 0) { return new StdArrangementMatchRule(new StdArrangementEntryMatcher(atom(nameFilter))); } else { ArrangementAtomMatchCondition[] conditions = new ArrangementAtomMatchCondition[tokens.length + 1];...
nameRule
255,339
StdArrangementMatchRule (ArrangementSettingsToken @NotNull ... conditions) { return rule(ContainerUtil.map(conditions, it -> atom(it))); }
rule
255,340
StdArrangementMatchRule (@NotNull List<ArrangementAtomMatchCondition> conditions) { return rule(conditions.toArray(new ArrangementAtomMatchCondition[0])); }
rule
255,341
StdArrangementMatchRule (ArrangementAtomMatchCondition @NotNull ... conditions) { ArrangementMatchCondition compositeCondition = ArrangementUtil.combine(conditions); return new StdArrangementMatchRule(new StdArrangementEntryMatcher(compositeCondition)); }
rule
255,342
StdArrangementMatchRule (@NotNull ArrangementSettingsToken orderType, @NotNull StdArrangementMatchRule rule) { return new StdArrangementMatchRule(rule.getMatcher(), orderType); }
ruleWithOrder
255,343
ArrangementAtomMatchCondition (@NotNull ArrangementSettingsToken token) { return new ArrangementAtomMatchCondition(token); }
atom
255,344
ArrangementAtomMatchCondition (@NotNull ArrangementSettingsToken token, boolean included) { return new ArrangementAtomMatchCondition(token, included); }
atom
255,345
ArrangementAtomMatchCondition (@NotNull String nameFilter) { return new ArrangementAtomMatchCondition(StdArrangementTokens.Regexp.NAME, nameFilter); }
atom
255,346
void (@NotNull Map<String, ?> args) { @SuppressWarnings("unchecked") List<ArrangementGroupingRule> groupingRules = ObjectUtils.coalesce((List<ArrangementGroupingRule>)args.get("groups"), Collections.emptyList()); List<?> rules = (List<?>)args.get("rules"); List<ArrangementSectionRule> sectionRules = getSectionRules(rul...
doTest
255,347
void (@NotNull String text, @NotNull String expected, @Nullable ArrangementSettings arrangementSettings, @Nullable List<TextRange> ranges) { Info info = parse(text); if (!isEmpty(ranges) && !isEmpty(info.ranges)) { fail("Duplicate ranges set: explicit: " + ranges + ", " + "derived: " + info.ranges + ", text:\n" + text)...
doTestWithSettings
255,348
List<ArrangementSectionRule> (@Nullable List<?> rules) { if (rules == null) { return ContainerUtil.emptyList(); } return ContainerUtil.map(rules, o -> o instanceof ArrangementSectionRule ? (ArrangementSectionRule)o : ArrangementSectionRule.create((StdArrangementMatchRule)o)); }
getSectionRules
255,349
boolean (Collection<?> collection) { return collection == null || collection.isEmpty(); }
isEmpty
255,350
Info (@NotNull String text) { Info result = new Info(); StringBuilder buffer = new StringBuilder(text); int offset = 0; while (offset < buffer.length()) { RichTextHandler handler = null; int richTextMarkStart = -1; for (RichTextHandler h : RICH_TEXT_HANDLERS) { int i = buffer.indexOf("<" + h.getMarker(), offset); if (i...
parse
255,351
void () { doTestEscape(null); }
doTestEscape
255,352
void (@Nullable Consumer<? super AbstractInplaceIntroducer> pass) { String name = getTestName(true); configureByFile(getBasePath() + name + getExtension()); final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled(); try { TemplateManagerImpl.setTemplateTesting(getTestRootDisposable()); getEdito...
doTestEscape
255,353
void (@Nullable Consumer<? super AbstractInplaceIntroducer> pass) { String name = getTestName(true); configureByFile(getBasePath() + name + getExtension()); boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled(); try { TemplateManagerImpl.setTemplateTesting(getTestRootDisposable()); getEditor().ge...
doTest
255,354
void (@NotNull String pattern, @NotNull Runnable runnable) { TodoConfiguration todoConfiguration = TodoConfiguration.getInstance(); TodoPattern[] originalPatterns = todoConfiguration.getTodoPatterns(); try { TodoPattern todoPattern = new TodoPattern(pattern, new TodoAttributes(new TextAttributes()), false); todoConfigu...
doWithPattern
255,355
List<HighlightInfo> () { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); int[] toIgnore = {Pass.UPDATE_FOLDING, Pass.LOCAL_INSPECTIONS, Pass.WHOLE_FILE_LOCAL_INSPECTIONS}; Editor editor = getEditor(); PsiFile file = getFile(); if (editor instanceof EditorWindow) { editor = ((EditorWindow)editor).getD...
doHighlighting
255,356
void (String text) { configureFromFileText("Foo." + getFileExtension(), text); EditorTestUtil.setEditorVisibleSize(getEditor(), 1000, 1000); // set visible area for highlighting List<TextRange> expectedTodoRanges = extractExpectedTodoRanges(getEditor().getDocument()); List<HighlightInfo> highlightInfos = doHighlighting...
testTodos
255,357
void () { int todosInIndex = TodoCacheManager.getInstance(getProject()).getTodoCount(getVFile(), TodoIndexPatternProvider.getInstance()); int todosInHighlighting = PsiTodoSearchHelper.getInstance(getProject()).findTodoItems(getFile()).length; assertEquals("Mismatch between todos in index and highlighting", todosInIndex...
assertSameTodoCountInIndexAndHighlighting
255,358
void (String text) { DocumentImpl document = new DocumentImpl(text); List<TextRange> expectedTodoRanges = extractExpectedTodoRanges(document); List<HighlightInfo> highlightInfos = doHighlighting(); checkResultByText(document.getText()); List<TextRange> actualTodoRanges = getActualTodoRanges(highlightInfos); assertTodoR...
checkTodos
255,359
List<TextRange> (Document document) { ArrayList<TextRange> result = new ArrayList<>(); int offset = 0; int startPos; while ((startPos = document.getText().indexOf('[', offset)) != -1) { int finalStartPos = startPos; WriteCommandAction.runWriteCommandAction(getProject(), () -> document.deleteString(finalStartPos, finalS...
extractExpectedTodoRanges
255,360
List<TextRange> (List<? extends HighlightInfo> highlightInfos) { return highlightInfos.stream() .filter(info -> info.type == HighlightInfoType.TODO) .map(info -> info.getHighlighter().getTextRange()) .sorted(Segment.BY_START_OFFSET_THEN_END_OFFSET) .collect(Collectors.toList()); }
getActualTodoRanges
255,361
void (List<? extends TextRange> expectedTodoRanges, List<? extends TextRange> actualTodoRanges) { assertEquals("Unexpected todos highlighting", generatePresentation(expectedTodoRanges), generatePresentation(actualTodoRanges)); }
assertTodoRanges
255,362
String (List<? extends TextRange> ranges) { StringBuilder b = new StringBuilder(getEditor().getDocument().getText()); int prevStart = Integer.MAX_VALUE; for (int i = ranges.size() - 1; i >= 0; i--) { TextRange r = ranges.get(i); assertTrue(r.getEndOffset() <= prevStart); b.insert(r.getEndOffset(), ']'); b.insert(prevSt...
generatePresentation
255,363
void () { if (!supportsCStyleSingleLineComments()) return; testTodos("// [TODO first line]\n" + "// [second line]"); }
testSuccessiveLineComments
255,364
void () { if (!supportsCStyleSingleLineComments()) return; testTodos("// [TODO first line]\n" + "// <caret>second line"); type(" "); checkTodos("// [TODO first line]\n" + "// [second line]"); }
testSuccessiveLineCommentsAfterEditing
255,365
void () { if (!supportsCStyleSingleLineComments()) return; testTodos("// [TODO first]\nwords\n<caret>"); Document document = getEditor().getDocument(); FileDocumentManager documentManager = FileDocumentManager.getInstance(); PsiTodoSearchHelper todoSearchHelper = PsiTodoSearchHelper.getInstance(getProject()); assertTod...
testNewTodoAfterUnsavedEditing
255,366
void (int count) { try { Map<TodoIndexEntry, Integer> map = ContainerUtil.getFirstItem(((FileBasedIndexEx)FileBasedIndex.getInstance()).getIndex(TodoIndex.NAME) .getIndexedFileData(FileBasedIndex.getFileId(getVFile())).values()); int result = map == null ? 0 : map.values().stream().mapToInt(o -> o).sum(); assertEquals(...
assertTodoCountInIndexStorage
255,367
void () { if (!supportsCStyleSingleLineComments()) return; testTodos("// [TO<caret>DO first line]\n" + "// [second line]"); delete(); checkTodos("// TOO first line\n" + "// second line"); }
testAllLinesLoseHighlightingWithFirstLine
255,368
void () { if (!supportsCStyleSingleLineComments()) return; testTodos("// [TODO first line]\n" + "// [TODO second line]"); }
testContinuationIsNotOverlappedWithFollowingTodo
255,369
void () { if (!supportsCStyleMultiLineComments()) return; testTodos(""" /* * [TODO first line] * [second line] */"""); }
testContinuationInBlockCommentWithStars
255,370
void (String expected, Element root) { assertEquals(expected, JDOMUtil.write(root)); }
assertXmlOutputEquals
255,371
Element (@NotNull EditorColorsScheme scheme) { Element root = new Element("scheme"); ((AbstractColorsScheme)scheme).writeExternal(root); fixPlatformSpecificValues(root); root.removeChildren("metaInfo"); return root; }
serialize
255,372
Element (@NotNull EditorColorsScheme scheme) { Element root = new Element("scheme"); ((AbstractColorsScheme)scheme).writeExternal(root); fixPlatformSpecificValues(root); Element metaInfo = root.getChild("metaInfo"); if (metaInfo != null) { metaInfo.getChildren().forEach((child) -> { Attribute name = child.getAttribute(...
serializeWithFixedMeta
255,373
Element (@NotNull AbstractColorsScheme scheme, String... properties) { Element root = new Element("scheme"); scheme.writeExternal(root); fixPlatformSpecificValues(root); Element metaInfo = root.getChild("metaInfo"); if (metaInfo == null) { return root; } List<Element> toRemove = new ArrayList<>(); for (Element element ...
serializeWithSelectedMetaInfo
255,374
void (@NotNull Element root) { List<Element> fontOptions = new ArrayList<>(root.getChildren("option")); for (Element option : fontOptions) { String name = option.getAttributeValue("name"); if (name != null) { if ("FONT_SCALE".equals(name) || "EDITOR_FONT_SIZE".equals(name) || "EDITOR_FONT_NAME".equals(name)) { root.rem...
fixPlatformSpecificValues
255,375
void () { Assertions.assertFalse(EDT.isCurrentThreadEdt()); }
beforeAll
255,376
void () { Assertions.assertFalse(EDT.isCurrentThreadEdt()); }
afterAll
255,377
void () { Assertions.assertFalse(EDT.isCurrentThreadEdt()); }
beforeAll
255,378
void () { Assertions.assertFalse(EDT.isCurrentThreadEdt()); }
afterAll
255,379
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
beforeAll
255,380
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
afterAll
255,381
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
beforeAll
255,382
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
afterAll
255,383
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
beforeAll
255,384
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
afterAll
255,385
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
beforeAll
255,386
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
afterAll
255,387
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
beforeAll
255,388
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
afterAll
255,389
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
beforeAll
255,390
void () { Assertions.assertTrue(EDT.isCurrentThreadEdt()); Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked()); }
afterAll
255,391
boolean (ExtensionContext context) { return true; }
supportsTestTemplate
255,392
Stream<TestTemplateInvocationContext> (ExtensionContext context) { return Stream.of(new TestTemplateInvocationContext() { }); }
provideTestTemplateInvocationContexts
255,393
void () { doTest("<warning descr=\"Magic problem\">just some text</warning>", new MySimpleInspection()); }
testExpectedWarning
255,394
void () { try { doTest("just some text", new MySimpleInspection()); } catch (ComparisonFailure failure) { String message = failure.getMessage(); String firstLine = message.split("\n")[0]; assertSameLines("hello.txt: extra (1:1/14): 'just some text' (Magic problem) [HighlightInfoTypeImpl[severity=WARNING, key=WARNING_AT...
testUnexpectedWarning
255,395
void () { try { doTest("<warning descr=\"Magic problem\">just some text</warning>", new MyDoubleInspection()); } catch (ComparisonFailure failure) { String message = failure.getMessage(); String firstLine = message.split("\n")[0]; assertSameLines("hello.txt: duplicated (1:1/14): 'just some text' (Magic problem)", first...
testDoubleMessage
255,396
void () { doTest("<warning descr=\"Magic problem\">just some text</warning>", new MyDoubleInspection()); }
testDoNotCheckDoubleMessage
255,397
void () { try { ExpectedHighlightingData.expectedDuplicatedHighlighting( () -> doTest("<warning descr=\"Magic problem\">just some text</warning>", new MySimpleInspection()) ); } catch (IllegalStateException failure) { String message = failure.getMessage(); assertSameLines(ExpectedHighlightingData.EXPECTED_DUPLICATION_M...
testExpectedDuplicationWasNotFound
255,398
void (@NotNull String text, LocalInspectionTool inspection) { myFixture.configureByText("hello.txt", text); try { myFixture.enableInspections(inspection); myFixture.checkHighlighting(); } finally { myFixture.disableInspections(inspection); } }
doTest
255,399
void (PsiPlainText content, @NotNull ProblemsHolder holder) { holder.registerProblem(content, "Magic problem", ProblemHighlightType.GENERIC_ERROR_OR_WARNING); }
report