Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
273,000
void (@NotNull PsiFile file, ChangedLines... expected) { ChangedLines[] formatted = myMockCodeStyleManager.getFormattedLinesFor(file); Comparator<ChangedLines> cmp = Comparator.comparingInt(o -> o.from); Arrays.sort(expected, cmp); Arrays.sort(formatted, cmp); assertArrayEquals(getErrorMessage(expected, formatted), exp...
assertFormattedRangesEqualsTo
273,001
boolean (@NotNull PsiFile file) { return myMockPlainTextImportOptimizer.getProcessedFiles().contains(file); }
isImportsOptimized
273,002
String (ChangedLines[] expected, ChangedLines[] actual) { return "Expected: " + Arrays.toString(expected) + " Actual: " + Arrays.toString(actual); }
getErrorMessage
273,003
void (@NotNull PsiDirectory dir) { ReformatCodeProcessor processor = new ReformatCodeProcessor(getProject(), dir, true, true); processor.run(); }
reformatDirectory
273,004
void () { myFileStructure.createDirectoryAndMakeItCurrent("inner"); }
createDirectoryAndMakeItCurrent
273,005
PsiFile (@NotNull String fileName, @NotNull String committedContent, @NotNull String actualContent) { PsiFile file = myFileStructure.addTestFile(fileName, actualContent); if (!committedContent.equals(actualContent)) { registerCommittedRevision(committedContent, file); } return file; }
createFile
273,006
void (@NotNull String committedContent, PsiFile @NotNull ... files) { List<Change> changes = createChanges(committedContent, files); injectChanges(changes); }
registerCommittedRevision
273,007
List<Change> (@NotNull String committed, PsiFile @NotNull ... files) { List<Change> changes = new ArrayList<>(); for (PsiFile file : files) { changes.add(createChange(committed, file)); } return changes; }
createChanges
273,008
void (@NotNull List<Change> changes) { Change[] arr = changes.toArray(Change.EMPTY_CHANGE_ARRAY); myMockChangeListManager.addChanges(arr); }
injectChanges
273,009
Change (@NotNull String committed, @NotNull PsiFile file) { FilePath filePath = VcsUtil.getFilePath(file.getVirtualFile()); ContentRevision before = new SimpleContentRevision(committed, filePath, ""); ContentRevision after = new SimpleContentRevision("", filePath, ""); return new Change(before, after); }
createChange
273,010
PsiDirectory () { return myFileStructure.getCurrentDirectory(); }
getCurrentDirectory
273,011
boolean (@NotNull PsiFile file) { return file.getLanguage() == PlainTextLanguage.INSTANCE; }
supports
273,012
Runnable (@NotNull PsiFile file) { myProcessedFiles.add(file); return EmptyRunnable.INSTANCE; }
processFile
273,013
Set<PsiFile> () { return myProcessedFiles; }
getProcessedFiles
273,014
String () { return "(" + from + ", " + to + ")"; }
toString
273,015
boolean (Object obj) { if (obj instanceof ChangedLines line) { return from == line.from && to == line.to; } return false; }
equals
273,016
String () { return PlatformTestUtil.getPlatformTestDataPath() + "codeStyle/formatter/"; }
getTestDataPath
273,017
void (int expectedLinesChanged) { myFixture.configureByFile(getTestName(true) + "_revision.java"); PsiFile file = myFixture.getFile(); CharSequence revisionContent = myFixture.getDocument(file).getCharsSequence(); myFixture.configureByFile(getTestName(true) + ".java"); file = myFixture.getFile(); Document document = my...
doTest
273,018
void () { doTest(17); }
testAddedLines
273,019
void () { doTest(6); }
testModifiedLines
273,020
void () { doTest(3); }
testDeletedLines
273,021
void () { doTest(1); }
testChangedSingleLine
273,022
void () { doTest(6); }
testChangedAndDeleted
273,023
void () { doTest(3); }
testModification
273,024
void () { doTest(2); }
testInsert
273,025
void () { doTest(19); }
testLotsWhiteSpaces
273,026
void (@NotNull CodeStyleManager manager) { ServiceContainerUtil.replaceService(getProject(), CodeStyleManager.class, manager, getTestRootDisposable()); }
registerCodeStyleManager
273,027
void () { TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory); PsiFile java1 = fileTree.addTestFile("Test.java", "empty content"); PsiFile java2 = fileTree.addTestFile("Pair.java", "empty content"); PsiFile java3 = fileTree.addTestFile("Pair2.java", "empty content"); PsiFile php = fileTr...
testReformatWithoutMask
273,028
void () { TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory); PsiFile java1 = fileTree.addTestFile("Test.java", "empty content"); PsiFile java2 = fileTree.addTestFile("Pair.java", "empty content"); PsiFile java3 = fileTree.addTestFile("Pair2.java", "empty content"); PsiFile php = fileTr...
testFormatByOnlyOneMask
273,029
void () { TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory); PsiFile java1 = fileTree.addTestFile("Test.java", "empty content"); PsiFile java2 = fileTree.addTestFile("Pair.java", "empty content"); PsiFile java3 = fileTree.addTestFile("Pair2.java", "empty content"); PsiFile php1 = fileT...
testFormatByMultiMask
273,030
void () { TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory); PsiFile java1 = fileTree.addTestFile("Test1.java", "empty content"); PsiFile php1 = fileTree.addTestFile("Pair1.phpMask", "empty content"); PsiFile js1 = fileTree.addTestFile("Pair1.jsMask", "empty content"); PsiDirectory out...
testDirectoryScope
273,031
void () { TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory); PsiFile java1 = fileTree.addTestFile("Test1.java", "empty content"); PsiFile php1 = fileTree.addTestFile("Pair1.phpMask", "empty content"); PsiFile js1 = fileTree.addTestFile("Pair1.jsMask", "empty content"); PsiDirectory out...
testDirectoryScopeWithMask
273,032
void () { TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory); fileTree.createDirectoryAndMakeItCurrent("src"); PsiFile java2 = fileTree.addTestFile("Test2.tj", "empty content"); PsiFile php2 = fileTree.addTestFile("Pair2.phpMask", "empty content"); PsiFile js2 = fileTree.addTestFile("Pa...
testIDEA126830
273,033
void (PsiFile... files) { final Set<PsiFile> formattedFiles = myMockCodeStyleManager.getFormattedFiles(); for (PsiFile file : files) { assertTrue(file.getName() + " should be formatted", formattedFiles.contains(file)); } }
assertWasFormatted
273,034
void (PsiFile... files) { final Set<PsiFile> formattedFiles = myMockCodeStyleManager.getFormattedFiles(); for (PsiFile file : files) { assertTrue(file.getName() + " should not be formatted", !formattedFiles.contains(file)); } }
assertWasNotFormatted
273,035
void (@NotNull PsiDirectory directory, @Nullable String mask) { reformatDirectory(directory, mask, null); }
reformatDirectoryWithFileMask
273,036
void (@NotNull PsiDirectory directory, @Nullable SearchScope scope) { reformatDirectory(directory, null, scope); }
reformatDirectoryWithScopeFilter
273,037
void (@NotNull PsiDirectory directory, @Nullable SearchScope scope) { myMockCodeStyleManager.clearFormattedFiles(); AbstractLayoutCodeProcessor processor = new ReformatCodeProcessor(getProject(), directory, true, false); ReformatCodeAction.registerScopeFilter(processor, scope); processor = new RearrangeCodeProcessor(pr...
reformatWithRearrange
273,038
void (@NotNull PsiDirectory workingDirectory, @NotNull GlobalSearchScope scope) { myMockCodeStyleManager.clearFormattedFiles(); AbstractLayoutCodeProcessor processor = new ReformatCodeProcessor(getProject(), workingDirectory, true, false); ReformatCodeAction.registerScopeFilter(processor, scope); processor = new Optimi...
reformatAndOptimize
273,039
void (@NotNull PsiDirectory directory, @Nullable String mask, @Nullable SearchScope scope) { myMockCodeStyleManager.clearFormattedFiles(); ReformatCodeProcessor processor = new ReformatCodeProcessor(getProject(), directory, true, false); ReformatCodeAction.registerFileMaskFilter(processor, mask); ReformatCodeAction.reg...
reformatDirectory
273,040
Set<PsiFile> () { return myFormattedLinesForFile.keySet(); }
getFormattedFiles
273,041
void () { myFormattedLinesForFile = new HashMap<>(); }
clearFormattedFiles
273,042
Project () { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.getProject(...)"); }
getProject
273,043
int (@NotNull Document document, int offset) { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.adjustLineIndent(...)"); }
adjustLineIndent
273,044
boolean (@NotNull PsiFile file, int offset) { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.isLineToBeIndented(...)"); }
isLineToBeIndented
273,045
String (@NotNull PsiFile file, int offset) { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.getLineIndent(...)"); }
getLineIndent
273,046
String (@NotNull Document document, int offset) { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.getLineIndent(...)"); }
getLineIndent
273,047
Indent (String text, FileType fileType) { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.getIndent(...)"); }
getIndent
273,048
String (Indent indent, FileType fileType) { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.fillIndent(...)"); }
fillIndent
273,049
Indent () { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.zeroIndent(...)"); }
zeroIndent
273,050
boolean () { throw new UnsupportedOperationException("com.intellij.codeInsight.actions.MockCodeStyleManager.isSequentialProcessingAllowed(...)"); }
isSequentialProcessingAllowed
273,051
void (Runnable r) { throw new UnsupportedOperationException( "com.intellij.codeInsight.actions.MockCodeStyleManager.performActionWithFormatterDisabled(...)"); }
performActionWithFormatterDisabled
273,052
PsiFile (@NotNull String name, @NotNull String content) { PsiFile createdFile = null; try { createdFile = createFile(myModule, myCurrentLevelDirectory.getVirtualFile(), name, content); } catch (IOException e) { throw new RuntimeException(e); } getCurrentDirectoryFiles().add(createdFile); return createdFile; }
addTestFile
273,053
List<PsiFile> () { return myFilesForLevel.get(myLevel); }
getCurrentDirectoryFiles
273,054
PsiDirectory () { return myCurrentLevelDirectory; }
getCurrentDirectory
273,055
PsiDirectory (String name) { myLevel++; myFilesForLevel.add(new ArrayList<>()); myCurrentLevelDirectory = createDirectory(myProject, myCurrentLevelDirectory.getVirtualFile(), name); return myCurrentLevelDirectory; }
createDirectoryAndMakeItCurrent
273,056
List<PsiFile> (int level) { assert (myLevel >= level); return myFilesForLevel.get(level); }
getFilesAtLevel
273,057
PsiDirectory (@NotNull Project project, @NotNull final VirtualFile parent, @NotNull final String name) { final VirtualFile[] dir = new VirtualFile[1]; ApplicationManager.getApplication().runWriteAction(() -> { try { dir[0] = parent.createChildDirectory(null, name); } catch (IOException e) { e.printStackTrace(); } }); r...
createDirectory
273,058
void (@NotNull final VirtualFile file) { ApplicationManager.getApplication().runWriteAction(() -> { try { file.delete(null); } catch (IOException e) { e.printStackTrace(); } }); }
delete
273,059
void () { final FoldingBuilder first = createDummyFoldingBuilder("plain", "mountain", false); final FoldingBuilder second = createDummyFoldingBuilder("plain", "tree", false); LanguageFolding.INSTANCE.addExplicitExtension(PlainTextLanguage.INSTANCE, first); LanguageFolding.INSTANCE.addExplicitExtension(PlainTextLanguage...
testAllowOnlyOneDescriptorPerTextRange
273,060
void () { final FoldingBuilder first = createDummyFoldingBuilder("plain", "mountain", true); LanguageFolding.INSTANCE.addExplicitExtension(PlainTextLanguage.INSTANCE, first); try { PsiFile file = getFile(); List<FoldingUpdate.RegionInfo> regionInfos = FoldingUpdate.getFoldingsFor(file, false); int regionCount = Contain...
testOverrideGetText
273,061
FoldingBuilder (final String textToFold, final String placeholderText, final boolean overrideGetText) { return new CustomFoldingBuilder() { @Override protected void buildLanguageFoldRegions( @NotNull List<FoldingDescriptor> descriptors, @NotNull PsiElement root, @NotNull Document document, boolean quick) { final int in...
createDummyFoldingBuilder
273,062
void ( @NotNull List<FoldingDescriptor> descriptors, @NotNull PsiElement root, @NotNull Document document, boolean quick) { final int index = root.getText().indexOf(textToFold); TextRange textRange = new TextRange(index, index + textToFold.length()); if (overrideGetText) { descriptors.add(new FoldingDescriptor(root.get...
buildLanguageFoldRegions
273,063
String () { return placeholderText; }
getPlaceholderText
273,064
String (@NotNull ASTNode node, @NotNull TextRange range) { return ""; }
getLanguagePlaceholderText
273,065
boolean (@NotNull ASTNode node) { return true; }
isRegionCollapsedByDefault
273,066
void (String leftMostPosition, String... rightPositions) { doTest(true, leftMostPosition); doTest(false, leftMostPosition, rightPositions); }
doTestFromLeftToRight
273,067
void (String rightMostPosition, String... leftPositions) { doTest(false, rightMostPosition); doTest(true, rightMostPosition, leftPositions); }
doTestFromRightToLeft
273,068
void (boolean moveLeft, String before, String... after) { String current = before; for (String next : after) { doTestSingle(moveLeft, current, next); current = next; } doTestSingle(moveLeft, current, current); if (after.length == 0) return; for (int i = after.length - 2; i >= 0; i--) { String prev = after[i]; doTestSin...
doTest
273,069
void (boolean moveLeft, String before, String after) { configureEditor(before); executeAction(moveLeft ? IdeActions.MOVE_ELEMENT_LEFT : IdeActions.MOVE_ELEMENT_RIGHT); checkResultByText(after); }
doTestSingle
273,070
String () { return "platform/platform-tests/testData/editor/actionsInCustomFileType"; }
getBasePath
273,071
boolean () { return true; }
isCommunity
273,072
void (String test, String ext) { myFixture.configureByFile(test + "." + ext); performEndBlockAction(); myFixture.checkResultByFile(test + "_after." + ext); myFixture.configureByFile(test + "_after." + ext); performStartBlockAction(); myFixture.checkResultByFile(test + "." + ext); }
_testBlockNavigation
273,073
void () { EditorActionHandler actionHandler = new CodeBlockStartAction().getHandler(); actionHandler.execute(myFixture.getEditor(), myFixture.getEditor().getCaretModel().getPrimaryCaret(), ((EditorEx)myFixture.getEditor()).getDataContext()); }
performStartBlockAction
273,074
void () { EditorActionHandler actionHandler = new CodeBlockEndAction().getHandler(); actionHandler.execute(myFixture.getEditor(), myFixture.getEditor().getCaretModel().getPrimaryCaret(), ((EditorEx)myFixture.getEditor()).getDataContext()); }
performEndBlockAction
273,075
void () { _testBlockNavigation("blockNavigation","cs"); }
testBlockNavigation
273,076
void () { myFixture.configureByFile("InsertDeleteQuote.cs"); EditorTestUtil.performTypingAction(myFixture.getEditor(), '"'); myFixture.checkResultByFile("InsertDeleteQuote_after.cs"); myFixture.configureByFile("InsertDeleteQuote_after.cs"); EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_CHAR);...
testInsertDeleteQuotes
273,077
void () { myFixture.configureByFile("InsertDeleteBracket.cs"); EditorTestUtil.performTypingAction(myFixture.getEditor(), '['); myFixture.checkResultByFile("InsertDeleteBracket_after.cs"); myFixture.configureByFile("InsertDeleteBracket_after.cs"); EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_...
testInsertDeleteBracket
273,078
void () { myFixture.configureByFile("InsertDeleteParenth.cs"); EditorTestUtil.performTypingAction(myFixture.getEditor(), '('); myFixture.checkResultByFile("InsertDeleteParenth_after.cs"); myFixture.configureByFile("InsertDeleteParenth_after.cs"); EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_...
testInsertDeleteParenth
273,079
void (String fileName, String before, char typed, String after) { myFixture.configureByText(fileName, before); EditorTestUtil.performTypingAction(myFixture.getEditor(), typed); myFixture.checkResult(after); }
checkTyping
273,080
void () { checkTyping("a.cs", "<caret>a", '(', "(<caret>a"); checkTyping("a.cs", "<caret>@a", '(', "(<caret>@a"); checkTyping("a.cs", "<caret>(a", '(', "(<caret>(a"); checkTyping("a.cs", "<caret>[a", '(', "(<caret>[a"); checkTyping("a.cs", "<caret> (a", '(', "(<caret>) (a"); checkTyping("a.cs", "(<caret>)", '(', "((<ca...
testParenthesesBeforeNonWs
273,081
void () { checkTyping("a.cs", "<caret>a", '"', "\"<caret>a"); checkTyping("a.cs", "<caret> ", '"', "\"<caret>\" "); checkTyping("a.cs", "<caret>a", '\'', "'<caret>a"); checkTyping("a.cs", "<caret> ", '\'', "'<caret>' "); }
testQuoteBeforeNonWs
273,082
void () { CodeInsightSettings settings = CodeInsightSettings.getInstance(); boolean oldValue = settings.SURROUND_SELECTION_ON_QUOTE_TYPED; settings.SURROUND_SELECTION_ON_QUOTE_TYPED = false; boolean oldValuePairQuote = settings.AUTOINSERT_PAIR_QUOTE; settings.AUTOINSERT_PAIR_QUOTE = false; try { checkTyping("a.cs", "<c...
testReplaceQuoteDontSurroundSelection
273,083
void () { CodeInsightSettings settings = CodeInsightSettings.getInstance(); boolean oldValue = settings.AUTOINSERT_PAIR_QUOTE; settings.AUTOINSERT_PAIR_QUOTE = false; try { checkTyping("a.cs", "<caret><selection>\"</selection>a\"", '\'', "'<selection><caret>\"</selection>'a\""); checkTyping("a.cs", "<caret><selection>\...
testReplaceQuoteDontInsertPair
273,084
void () { checkTyping("a.cs", "<caret><selection>\"</selection>a\"", '\'', "'<caret>a'"); checkTyping("a.cs", "<caret><selection>\"</selection>a'", '\'', "'<selection><caret>\"</selection>'a'"); checkTyping("a.cs", "\"a<caret><selection>\"</selection>", '\'', "'a'<caret>"); checkTyping("a.cs", "'a<caret><selection>\"</...
testReplaceQuote
273,085
void () { checkTyping("a.txt", "<caret>", '(', "(<caret>"); checkTyping("a.txt", "{<caret>}", '}
testNoPairedBracesInPlainText
273,086
void () { myFixture.configureByText("a.txt", "<caret>"); EditorTestUtil.performTypingAction(myFixture.getEditor(), '('); EditorTestUtil.performTypingAction(myFixture.getEditor(), ')'); myFixture.checkResult("()<caret>"); }
testClosingBraceInPlainText
273,087
void () { myFixture.configureByFile("InsertBraceOnEnter.cs"); EditorTestUtil.performTypingAction(myFixture.getEditor(), '\n'); myFixture.checkResultByFile("InsertBraceOnEnter_after.cs"); }
testInsertBraceOnEnter
273,088
void () { String testName = getTestName(false); myFixture.configureByFile(testName + ".fx"); EditorTestUtil.performTypingAction(myFixture.getEditor(), '\n'); myFixture.checkResultByFile(testName + "_after.fx"); }
testInsertBraceOnEnterJavaFx
273,089
void () { EditorHighlighter highlighter = HighlighterFactory.createHighlighter(getProject(), "A.cpp"); // 0123456789012345678 9 0123 45 6 7 highlighter.setText("#include try enum \"\\xff\\z\\\"xxx\""); HighlighterIterator iterator = highlighter.createIterator(2); TestCase.assertEquals(CustomHighlighterTokenType.KEYWORD...
testCpp
273,090
void () { EditorHighlighter highlighter = HighlighterFactory.createHighlighter(getProject(), "A.hs"); // 0123456789012345678 9 0123 45 6 7 highlighter.setText("{-# #-} module"); HighlighterIterator iterator = highlighter.createIterator(2); TestCase.assertEquals(CustomHighlighterTokenType.MULTI_LINE_COMMENT, iterator.ge...
testHaskel
273,091
void () { String text = " <start>"; EnterAfterJavadocTagHandler.Context context = parse(text); assertEmpty(context); }
textWithoutAsterisk
273,092
void () { String text = "/**\n * <p><"; EnterAfterJavadocTagHandler.Context context = parse(text, text.length() - 1); assertEquals(9, context.startTagEndOffset); assertEquals(-1, context.endTagStartOffset); String text2 = "/**\n * <p></"; context = parse(text2, text2.length() - 2); assertEquals(9, context.startTagEndOf...
unterminatedTagAtTheEnd
273,093
void () { String text = " * <start>"; // Cursor after single tag EnterAfterJavadocTagHandler.Context context = parse(text); assertEquals(text.indexOf(">"), context.startTagEndOffset); assertTrue(context.endTagStartOffset < 0); // Cursor before context = parse(text, text.length() - 1); assertEmpty(context); }
startTagOnly
273,094
void () { String text = " * <outer><inner> sdf </inner></outer>"; // Cursor before <outer>. EnterAfterJavadocTagHandler.Context context = parse(text, 0); assertEmpty(context); // Cursor at <outer>. int offset = text.indexOf("<outer>") + 2; context = parse(text, offset); assertEmpty(context); // Cursor between <outer> a...
nestedTags
273,095
void () { EnterAfterJavadocTagHandler.Context context = parse("* <p/>"); assertEmpty(context); }
emptyTag
273,096
void (EnterAfterJavadocTagHandler.Context context) { assertTrue(context.startTagEndOffset < 0); assertTrue(context.endTagStartOffset < 0); }
assertEmpty
273,097
void () { DocumentationComponent component = createDocumentationComponent(); String actionText = CodeInsightBundle.message("javadoc.show.popup.automatically"); ToggleAction showPopupAction = ObjectUtils.tryCast(findAction(component, actionText), ToggleAction.class); assertNotNull(showPopupAction); CodeInsightSettings s...
testShowPopupAutomaticallyAction
273,098
DocumentationComponent () { DocumentationManager manager = DocumentationManager.getInstance(getProject()); DocumentationComponent component = new DocumentationComponent(manager); Disposer.register(getTestRootDisposable(), component); return component; }
createDocumentationComponent
273,099
AnActionEvent () { DataContext context = SimpleDataContext.builder() .add(CommonDataKeys.PROJECT, getProject()) .build(); return AnActionEvent.createFromDataContext("", null, context); }
createEvent