Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
271,100
void () { initText("<caret>one two \n" + "three<caret> four"); executeAction("EditorCopy"); executeAction("EditorLineEnd"); executeAction("EditorPaste"); checkResultByText(""" one two\s one two<caret>\s three four three four<caret>"""); }
testCopyPasteFromEmptySelection
271,101
void () { initText("<caret>one <caret>two \n" + "three<caret> four<caret>"); executeAction("EditorCopy"); executeAction("EditorLineEnd"); executeAction("EditorPaste"); checkResultByText(""" one two\s one two<caret>\s three four three four<caret>"""); }
testCopyPasteFromEmptySelectionMultiCaretOnEachLine
271,102
void () { initText(""" \tone two\s hi<caret>\s \tthree four\s"""); int tabSize = getEditor().getSettings().getTabSize(getProject()); getEditor().getSettings().setCaretInsideTabs(true); executeAction("EditorCopy"); executeAction("EditorLineStart"); getEditor().getCaretModel().moveToVisualPosition(new VisualPosition(1,0)...
testCopyPasteFromEmptySelectionMultipleCaretsAtLineStart
271,103
void () { initText("<selection>one<caret></selection> two \n" + "<selection>three<caret></selection> four "); executeAction("EditorCut"); executeAction("EditorLineEnd"); executeAction("EditorPaste"); checkResultByText(" twoone<caret> \n" + " fourthree<caret> "); }
testCutAndPaste
271,104
void () { initText(""" <caret>one\s two\s th<caret>ree\s four\s"""); executeAction("EditorCut"); checkResultByText("<caret>two \n" + "<caret>four "); executeAction("EditorLineEnd"); executeAction("EditorPaste"); checkResultByText(""" one\s two<caret>\s three\s four<caret>\s"""); }
testCutFromEmptySelectionAndPasteWithCaretAtLineEnd
271,105
void () { initText(""" <caret>one\s two\s th<caret>ree\s four\s"""); executeAction("EditorCut"); checkResultByText("<caret>two \n" + "<caret>four "); executeAction("EditorPaste"); checkResultByText(""" one\s <caret>two\s three\s <caret>four\s"""); }
testCutFromEmptySelectionAndPasteWithCaretAtLineStart
271,106
void () { initText(""" <caret>one\s two\s th<caret>ree\s four<caret>\s"""); executeAction("EditorCut"); checkResultByText("<caret>two \n" + "<caret>"); executeAction("EditorLineEnd"); executeAction("EditorPaste"); checkResultByText(""" one\s two<caret>\s three\s <caret>"""); }
testCutFromEmptySelectionAndPasteWithFewerCaret
271,107
void () { initText(""" <caret>one\s two\s th<caret>ree\s four<caret>\s"""); executeAction("EditorCut"); checkResultByText("<caret>two \n" + "<caret>"); getEditor().getCaretModel().addCaret(new VisualPosition(0,2)); executeAction("EditorPaste"); checkResultByText(""" one\s three\s <caret>tw<caret>o\s four\s <caret>""");...
testCutFromEmptySelectionAndPasteWithMultipleCaretsOnSingleLine
271,108
void () { initText(""" <caret>one\s two\s th<caret>ree\s four<caret>\s"""); executeAction("EditorCut"); checkResultByText("<caret>two \n" + "<caret>"); initText("<caret>t<caret>w<caret>o \n"); executeAction("EditorPaste"); checkResultByText(""" one\s three\s four\s <caret>t<caret>w<caret>o\s """); }
testCutFromEmptySelectionAndPasteWithMultipleCaretsOnSingleLineAndLineStart
271,109
void () { initText("<selection>one<caret></selection> two \n" + "three four "); executeAction("EditorCopy"); executeAction("EditorCloneCaretBelow"); executeAction("EditorLineEnd"); executeAction("EditorPaste"); checkResultByText("one twoone<caret> \n" + "three fourone<caret> "); }
testPasteSingleItem
271,110
void () { initText(""" one <selection>two\s three<caret></selection> four\s five <selection>six\s seven<caret></selection> eight"""); executeAction("EditorCut"); executeAction("EditorLineEnd"); executeAction("EditorPaste"); checkResultByText(""" one fourtwo\s three<caret>\s five eightsix\s seven<caret>"""); }
testCutAndPasteMultiline
271,111
void () { initText(""" <selection>one two<caret></selection> three four"""); executeAction("EditorCopy"); executeAction("EditorTextStart"); executeAction("EditorCloneCaretBelow"); executeAction("EditorPaste"); checkResultByText(""" one two<caret>one one two<caret>two three four"""); }
testCopyMultilineFromOneCaretPasteIntoTwo
271,112
void () { initText(""" <selection>one two<caret></selection> <selection>three<caret></selection> four"""); executeAction("EditorCopy"); executeAction("EditorPaste"); checkResultByText(""" one two<caret> three<caret> four"""); }
testCopyPasteDoesNothingWithUnevenSelection
271,113
void () { initText(""" <selection>one<caret></selection> <selection>two<caret></selection> <selection>three<caret></selection> <selection>four<caret></selection>"""); copy(); getEditor().getCaretModel().setCaretsAndSelections(Arrays.asList(new CaretState(new LogicalPosition(0, 0), new LogicalPosition(0, 0), new Logical...
testPastingAtDifferentNumberOfCarets
271,114
void () { initText("<caret>\n" + "<caret>"); CopyPasteManager.getInstance().setContents(new StringSelection("abc\n")); paste(); checkResultByText("abc<caret>\n" + "abc<caret>"); }
testPastingLineWithBreakFromOutside
271,115
void () { initText("line1\n" + "line2"); setEditorVisibleSize(1000, 1000); mouse().alt().pressAt(0, 1).dragTo(1, 2).release(); executeAction("EditorEscape"); checkResultByText("li<caret>ne1\n" + "line2"); }
testEscapeAfterDragDown
271,116
void () { initText("line1\n" + "line2"); setEditorVisibleSize(1000, 1000); mouse().alt().pressAt(1, 1).dragTo(0, 2).release(); executeAction("EditorEscape"); checkResultByText("line1\n" + "li<caret>ne2"); }
testEscapeAfterDragUp
271,117
void () { initText("q<caret>uick brown fox"); mouse().alt().shift().doubleClickAt(0, 8); checkResultByText("q<caret>uick <selection>brown<caret></selection> fox"); }
testAltShiftDoubleClick
271,118
void () { initText("q<caret>uick br<caret>own fox"); mouse().alt().shift().doubleClickAt(0, 8); checkResultByText("q<caret>uick brown fox"); }
testAltShiftDoubleClickAtExistingCaret
271,119
void () { initText(""" q<caret>uick brown fox"""); mouse().alt().shift().tripleClickAt(1, 2); checkResultByText(""" q<caret>uick <selection>br<caret>own </selection>fox"""); }
testAltShiftTripleClick
271,120
void () { initText(""" q<caret>uick br<caret>own fox"""); mouse().alt().shift().tripleClickAt(1, 2); checkResultByText(""" q<caret>uick brown fox"""); }
testAltShiftTripleClickAtExistingCaret
271,121
void () { initText(""" <selection><caret>word</selection> some long prefix <selection><caret>word</selection>-suffix"""); EditorTestUtil.configureSoftWraps(getEditor(), 17); // wrapping right before 'word-suffix' delete(); checkResultByText(""" <caret> some long prefix <caret>-suffix"""); verifySoftWrapPositions(19); }
testCaretPositionsRecalculationOnDocumentChange
271,122
void () { initText(""" <caret>line long line very long line long line line"""); mouse().alt().shift().middle().clickAt(2, 2); checkResultByText(""" <selection>li<caret></selection>ne <selection>lo<caret></selection>ng line <selection>ve<caret></selection>ry long line long line line"""); }
testCreateRectangularSelectionWithMouseClicks
271,123
void () { initText(""" <caret>line long line very long line long line line"""); mouse().alt().shift().middle().clickAt(1, 1); checkResultByText(""" <selection>l<caret></selection>ine <selection>l<caret></selection>ong line very long line long line line"""); mouse().alt().shift().middle().clickAt(2, 2); checkResultByTex...
testCreateRectangularSelectionExtendsSelection
271,124
void () { initText("s<selection>om<caret></selection>e text\nother text"); setEditorVisibleSize(1000, 1000); mouse().alt().shift().pressAt(0, 5).dragTo(1, 2).release(); checkResultByText("s<selection>om<caret></selection>e <selection>text\not<caret></selection>her text"); }
testAddingMultipleSelectionsUsingMouse
271,125
void () { initText("s<selection>om<caret></selection>e text\nother text"); setEditorVisibleSize(1000, 1000); ((EditorEx)getEditor()).setColumnMode(true); mouse().alt().shift().pressAt(0, 5).dragTo(1, 2).release(); checkResultByText("s<selection>om<caret></selection>e <selection>text\not<caret></selection>her text"); }
testAddingMultipleSelectionsUsingMouseInColumnSelectionMode
271,126
void () { initText("<selection>a<caret></selection>b<caret>racadabra"); setEditorVisibleSize(1000, 1000); mouse().alt().shift().pressAt(0, 2).dragTo(0, 3).release(); checkResultByText("<selection>a<caret></selection>bracadabra"); }
testAltShiftDragAfterRemovingCaret
271,127
void () { initText("s<selection>om<caret></selection>e text\nother text"); setEditorVisibleSize(1000, 1000); mouse().ctrl().alt().shift().pressAt(0, 7).dragTo(1, 5).release(); checkResultByText("s<selection>om<caret></selection>e <selection><caret>te</selection>xt\nother<selection><caret> t</selection>ext"); }
testAddingRectangualSelectionUsingMouse
271,128
void () { initText(""" line1 line2 l<caret>ine3 line<caret>4"""); addCollapsedFoldRegion(0, 6, "..."); verifyCaretsAndSelections(1, 1, 1, 1, 2, 4, 4, 4); }
testCaretPositionUpdateOnFolding
271,129
void () { initText(""" word <caret>word word """); getEditor().getCaretModel().addCaret(new VisualPosition(0, 0)); getEditor().getCaretModel().addCaret(new VisualPosition(1, 5)); assertEquals(new VisualPosition(1, 5), getEditor().getCaretModel().getPrimaryCaret().getVisualPosition()); down(); checkResultByText(""" word...
testCaretStaysPrimaryOnMerging
271,130
void () { initText("<caret>\t<caret>\t"); rightWithSelection(); type(' '); checkResultByText(" <caret> <caret>"); }
testTypingAdjacentSpaces
271,131
void () { initText("\n"); addInlay(0); addInlay(1); mouse().clickAt(0, 0); executeAction("EditorCloneCaretBelow"); verifyCaretsAndSelections(0, 0, 0, 0, 1, 0, 0, 0); }
testCloneCaretBeforeInlay
271,132
void () { initText("\n"); addInlay(0); addInlay(1); mouse().clickAt(0, 1); executeAction("EditorCloneCaretBelow"); verifyCaretsAndSelections(0, 1, 1, 1, 1, 1, 1, 1); }
testCloneCaretAfterInlay
271,133
void () { initText("long long line<caret>\nshort line"); executeAction(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN); executeAction(IdeActions.ACTION_EDITOR_CLONE_CARET_ABOVE); checkResultByText("long long <caret>line\nshort line<caret>"); }
testCloneCaretDoesNotUseRememberedHorizontalPositionFromMovement
271,134
void () { initText("<selection>quick<caret></selection> <selection>brown<caret></selection> fox"); mouse().right().clickAt(0, 1); checkResultByText("<selection>q<caret>uick</selection> <selection>brown<caret></selection> fox"); }
testRightClickInMultiCaretSelection1
271,135
void () { initText("<selection>quick<caret></selection> <selection>brown<caret></selection> fox"); mouse().right().clickAt(0, 7); checkResultByText("<selection>quick<caret></selection> <selection>b<caret>rown</selection> fox"); }
testRightClickInMultiCaretSelection2
271,136
void () { initText("<selection>quick<caret></selection> <selection>brown<caret></selection> fox"); mouse().right().clickAt(0, 13); checkResultByText("quick brown f<caret>ox"); }
testRightClickOutsideMultiCaretSelection
271,137
void () { WriteCommandAction.writeCommandAction(getProject()).run(() -> { final Document doc = new DocumentImpl(""); final StringBuilder b = new StringBuilder(); doc.addDocumentListener(new DocumentListener() { @Override public void beforeDocumentChange(@NotNull DocumentEvent e) { b.append("before1 "); } @Override publ...
testCorrectlyAddingAndRemovingListeners
271,138
void (@NotNull DocumentEvent e) { b.append("before1 "); }
beforeDocumentChange
271,139
void (@NotNull DocumentEvent e) { b.append("after1 "); }
documentChanged
271,140
void (@NotNull DocumentEvent event) { doc.removeDocumentListener(this); }
beforeDocumentChange
271,141
void (@NotNull DocumentEvent e) { doc.removeDocumentListener(this); }
documentChanged
271,142
void (@NotNull DocumentEvent e) { b.append("before2 "); }
beforeDocumentChange
271,143
void (@NotNull DocumentEvent e) { b.append("after2 "); }
documentChanged
271,144
void () { CommandProcessor commandProcessor = CommandProcessor.getInstance(); assertTrue(!commandProcessor.isUndoTransparentActionInProgress() && commandProcessor.getCurrentCommand() == null); final Document doc = new DocumentImpl("xxx"); mustThrow(() -> doc.insertString(1, "x")); mustThrow(() -> doc.deleteString(1, 2)...
testModificationInsideCommandAssertion
271,145
void () { WriteCommandAction.runWriteCommandAction(getProject(), () -> { DocumentImpl document = new DocumentImpl(""); assertEquals(0, document.getLineCount()); document.insertString(0, "a"); assertEquals(1, document.getLineCount()); document.deleteString(0, 1); assertEquals(0, document.getLineCount()); }); }
testEmptyDocumentLineCount
271,146
void (Runnable runnable) { try { ApplicationManager.getApplication().runWriteAction(runnable); fail("Must throw IncorrectOperationException"); } catch (IncorrectOperationException ignored) { } }
mustThrow
271,147
void (@NotNull DocumentEvent event) { // force population of text layout cache on document update // this can be done by editor implementation in real life, // but we're doing it manually here to cover more potential cases getEditor().visualPositionToXY(new VisualPosition(0, 10)); }
documentChanged
271,148
int (@NotNull Inlay inlay) { return 10; }
calcWidthInPixels
271,149
void (@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) { g.setColor(Color.red); g.fillRect(targetRegion.x, targetRegion.y, targetRegion.width, targetRegion.height); }
paint
271,150
void (int startLine, int endLine) { FoldingModel foldingModel = getEditor().getFoldingModel(); foldingModel.runBatchFoldingOperation(() -> foldingModel.addCustomLinesFolding(startLine, endLine, new OurCustomFoldRegionRenderer())); }
addCustomLinesFolding
271,151
void () { IndentsPass indentsPass = new IndentsPass(getProject(), getEditor(), getFile()); indentsPass.doCollectInformation(new EmptyProgressIndicator()); indentsPass.doApplyInformationToEditor(); }
runIndentsPass
271,152
void (int offset, SeparatorPlacement placement, Color color) { RangeHighlighter highlighter = addRangeHighlighter(offset, offset, 0, null); highlighter.setLineSeparatorColor(color); highlighter.setLineSeparatorPlacement(placement); }
addLineSeparator
271,153
boolean (Object obj) { return false; }
equals
271,154
int () { return 0; }
hashCode
271,155
Icon () { return myIcon; }
getIcon
271,156
int (@NotNull Inlay inlay) { return 0; }
calcWidthInPixels
271,157
void (@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) {}
paint
271,158
GutterIconRenderer (@NotNull Inlay inlay) { return myGutterIconRenderer; }
calcGutterIconRenderer
271,159
int (@NotNull CustomFoldRegion region) { return WIDTH; }
calcWidthInPixels
271,160
int (@NotNull CustomFoldRegion region) { return HEIGHT; }
calcHeightInPixels
271,161
void (@NotNull CustomFoldRegion region, @NotNull Graphics2D g, @NotNull Rectangle2D targetRegion, @NotNull TextAttributes textAttributes) { g.setColor(Color.pink); Rectangle r = targetRegion.getBounds(); int startX = r.x; int endX = r.x + r.width - 1; int startY = r.y; int endY = r.y + r.height - 1; g.drawLine(startX, ...
paint
271,162
boolean () { return false; }
isRunInCommand
271,163
void () { WriteAction.run(()-> { init(""" some<caret> text<caret> some <selection><caret>other</selection> <selection>text<caret></selection> <selection>ano<caret>ther</selection> line"""); type('A'); executeAction("EditorDelete"); mouse().clickAt(0, 1); undo(); checkResult("someA<caret>textA<caret>some A<caret>A<caret...
testUndoRedo
271,164
void () { WriteAction.run(()-> { init("a"); ((EditorEx)getEditor()).setColumnMode(true); mouse().clickAt(0, 2); type('b'); undo(); executeAction("EditorRightWithSelection"); verifyCaretsAndSelections(0, 3, 2, 3); }); }
testBlockSelectionStateAfterUndo
271,165
void () { WriteAction.run(() -> { init("a"); ((EditorEx)getEditor()).setColumnMode(true); mouse().pressAt(0, 0).dragTo(0, 2).release(); type('b'); undo(); verifyCaretsAndSelections(0, 2, 0, 2); }); }
testBlockSelectionStateAfterUndo2
271,166
void () { WriteAction.run(() -> { init("line1\n" + "line2"); mouse().alt().pressAt(1, 1).dragTo(0, 0).release(); type(' '); undo(); assertEquals(new LogicalPosition(0, 0), getEditor().getCaretModel().getPrimaryCaret().getLogicalPosition()); }); }
testPrimaryCaretPositionAfterUndo
271,167
void (final String text) { CommandProcessor.getInstance().runUndoTransparentAction(() -> checkResultByText(text)); }
checkResult
271,168
void () { getUndoManager().undo(getTextEditor()); }
undo
271,169
void () { getUndoManager().redo(getTextEditor()); }
redo
271,170
UndoManagerImpl () { return (UndoManagerImpl) UndoManager.getInstance(getProject()); }
getUndoManager
271,171
TextEditor () { return TextEditorProvider.getInstance().getTextEditor(getEditor()); }
getTextEditor
271,172
void (String text) { init(text, PlainTextFileType.INSTANCE); setEditorVisibleSize(1000, 1000); getUndoManager().setOverriddenEditorProvider(new CurrentEditorProvider() { @Override public FileEditor getCurrentEditor(@Nullable Project project) { return getTextEditor(); } }); }
init
271,173
FileEditor (@Nullable Project project) { return getTextEditor(); }
getCurrentEditor
271,174
void () { int caretCount = 1000; int charactersToType = 100; String initialText = StringUtil.repeat("<caret>\n", caretCount); initText(initialText); PlatformTestUtil.startPerformanceTest("Typing with large number of carets", 100_000, () -> { for (int i = 0; i < charactersToType; i++) { type('a'); } }).attempts(1).asser...
testTyping
271,175
void () { int caretCount = 1000; int charactersToType = 100; String initialText = StringUtil.repeat(" <caret> \n", caretCount); initText(initialText); getEditor().getFoldingModel().runBatchFoldingOperation(() -> { for (int i = 0; i < caretCount; i++) { addFoldRegion(getEditor().getDocument().getLineStartOffset(i), getE...
testTypingWithManyFoldRegions
271,176
void () { int caretCount = 1000; int charactersToType = 100; String initialText = "<root>\n" + StringUtil.repeat(" <node><caret></node>\n", caretCount) + "</root>"; init(initialText, StdFileTypes.XML); PlatformTestUtil.startPerformanceTest("Typing in XML with large number of carets", 100_000, () -> { for (int i = 0; i ...
testTypingInXml
271,177
void () { super.prepare(); myStrategy = new DefaultLineWrapPositionStrategy(); }
prepare
271,178
void () { String document = "void method(String <WRAP>p1<EDGE>, String p2) {}"; doTest(myStrategy, document, false); }
commaNotSeparated
271,179
void () { String document = "void method(String p1,<WRAP><EDGE> String p2) {}"; doTest(myStrategy, document); }
wrapOnExceedingWhiteSpace
271,180
void () { String document = "int variable = testMethod(var1 + var2, var3 + <WRAP>va<EDGE>r4);"; doTest(myStrategy, document); }
doNotPreferWrapOnComma
271,181
void () { String document = "-----------------<EDGE>---------------------------------------------------------"; doTest(myStrategy, document); }
longStringWithoutWrapPositionIsNotWrapped
271,182
void () { String document = "queueing the JSON for later submission, we retain the <WRAP>SimpleRequestDa<EDGE>ta"; doTest(myStrategy, document, false); }
preferNearestWhiteSpaceWrap_InsteadOf_Comma
271,183
int () { return myResult; }
getResult
271,184
void (Shape s) { throw new UnsupportedOperationException(); }
draw
271,185
boolean (Image img, AffineTransform xform, ImageObserver obs) { throw new UnsupportedOperationException(); }
drawImage
271,186
void (BufferedImage img, BufferedImageOp op, int x, int y) { throw new UnsupportedOperationException(); }
drawImage
271,187
void (RenderedImage img, AffineTransform xform) { throw new UnsupportedOperationException(); }
drawRenderedImage
271,188
void (RenderableImage img, AffineTransform xform) { throw new UnsupportedOperationException(); }
drawRenderableImage
271,189
void (String str, int x, int y) { myResult += x; myResult += y; for (int i = 0; i < str.length(); i++) { myResult += str.charAt(i); } }
drawString
271,190
void (String str, float x, float y) { throw new UnsupportedOperationException(); }
drawString
271,191
void (AttributedCharacterIterator iterator, int x, int y) { throw new UnsupportedOperationException(); }
drawString
271,192
boolean (Image img, int x, int y, ImageObserver observer) { throw new UnsupportedOperationException(); }
drawImage
271,193
boolean (Image img, int x, int y, int width, int height, ImageObserver observer) { throw new UnsupportedOperationException(); }
drawImage
271,194
boolean (Image img, int x, int y, Color bgcolor, ImageObserver observer) { throw new UnsupportedOperationException(); }
drawImage
271,195
boolean (Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) { throw new UnsupportedOperationException(); }
drawImage
271,196
boolean (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { throw new UnsupportedOperationException(); }
drawImage
271,197
boolean (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) { throw new UnsupportedOperationException(); }
drawImage
271,198
void () { throw new UnsupportedOperationException(); }
dispose
271,199
void (AttributedCharacterIterator iterator, float x, float y) { throw new UnsupportedOperationException(); }
drawString