Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
254,300
PsiFile (@NotNull LightVirtualFile virtualFile) { return myFileFactory.trySetupPsiForFile(virtualFile, myLanguage, true, false); }
createFile
254,301
void (@NotNull @TestDataFile String targetDataName, @NotNull PsiFile file) { StringBuffer buffer = new StringBuffer(); Arrays.stream(file.getNode().getChildren(TokenSet.ANY)).forEach(it -> printAstTypeNamesTree(it, buffer, 0)); try { Files.writeString(Paths.get(myFullDataPath, targetDataName + ".fleet.txt"), buffer); }...
printAstTypeNamesTree
254,302
void (ASTNode node, StringBuffer buffer, int indent) { buffer.append(" ".repeat(indent)); buffer.append(node.getElementType()).append("\n"); indent += 2; ASTNode childNode = node.getFirstChildNode(); while (childNode != null) { printAstTypeNamesTree(childNode, buffer, indent); childNode = childNode.getTreeNext(); } }
printAstTypeNamesTree
254,303
boolean () { return false; }
allTreesInSingleFile
254,304
void (@NotNull String testDataDir, @NotNull PsiFile file, boolean checkAllPsiRoots, @NotNull String targetDataName, boolean skipSpaces, boolean printRanges) { doCheckResult(testDataDir, file, checkAllPsiRoots, targetDataName, skipSpaces, printRanges, false); }
doCheckResult
254,305
void (@NotNull String testDataDir, @NotNull PsiFile file, boolean checkAllPsiRoots, @NotNull String targetDataName, boolean skipSpaces, boolean printRanges, boolean allTreesInSingleFile) { FileViewProvider provider = file.getViewProvider(); Set<Language> languages = provider.getLanguages(); if (!checkAllPsiRoots || lan...
doCheckResult
254,306
void (@NotNull String actual) { String name = getTestName(); doCheckResult(myFullDataPath, myFilePrefix + name + ".txt", actual); }
checkResult
254,307
void (@NotNull @TestDataFile String targetDataName, @NotNull String actual) { doCheckResult(myFullDataPath, targetDataName, actual); }
checkResult
254,308
void (@NotNull String fullPath, @NotNull String targetDataName, @NotNull String actual) { String expectedFileName = fullPath + File.separatorChar + targetDataName; UsefulTestCase.assertSameLinesWithFile(expectedFileName, actual); }
doCheckResult
254,309
String (@NotNull PsiElement file, boolean skipSpaces, boolean printRanges) { return DebugUtil.psiToString(file, !skipSpaces, printRanges); }
toParseTreeText
254,310
void (@NotNull PsiFile file) { file.accept(new PsiElementVisitor() { @Override public void visitElement(@NotNull PsiElement element) { element.acceptChildren(this); } }); }
ensureParsed
254,311
void (@NotNull PsiElement element) { element.acceptChildren(this); }
visitElement
254,312
void (@NotNull final PsiFile file) { final String psiToStringDefault = DebugUtil.psiToString(file, true, false); DebugUtil.performPsiModification("ensureCorrectReparse", () -> { final String fileText = file.getText(); final DiffLog diffLog = new BlockSupportImpl().reparseRange( file, file.getNode(), TextRange.allOf(fil...
ensureCorrectReparse
254,313
Font () { throw new UnsupportedOperationException(); }
getFont
254,314
FontRenderContext () { throw new UnsupportedOperationException(); }
getFontRenderContext
254,315
void () { throw new UnsupportedOperationException(); }
performDefaultLayout
254,316
int () { throw new UnsupportedOperationException(); }
getNumGlyphs
254,317
int (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphCode
254,318
int[] (int beginGlyphIndex, int numEntries, int[] codeReturn) { throw new UnsupportedOperationException(); }
getGlyphCodes
254,319
Rectangle2D () { throw new UnsupportedOperationException(); }
getLogicalBounds
254,320
Rectangle2D () { throw new UnsupportedOperationException(); }
getVisualBounds
254,321
Shape () { throw new UnsupportedOperationException(); }
getOutline
254,322
Shape (float x, float y) { throw new UnsupportedOperationException(); }
getOutline
254,323
Shape (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphOutline
254,324
Point2D (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphPosition
254,325
void (int glyphIndex, Point2D newPos) { throw new UnsupportedOperationException(); }
setGlyphPosition
254,326
AffineTransform (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphTransform
254,327
void (int glyphIndex, AffineTransform newTX) { throw new UnsupportedOperationException(); }
setGlyphTransform
254,328
float[] (int beginGlyphIndex, int numEntries, float[] positionReturn) { throw new UnsupportedOperationException(); }
getGlyphPositions
254,329
Shape (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphLogicalBounds
254,330
Shape (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphVisualBounds
254,331
GlyphMetrics (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphMetrics
254,332
GlyphJustificationInfo (int glyphIndex) { throw new UnsupportedOperationException(); }
getGlyphJustificationInfo
254,333
boolean (GlyphVector set) { throw new UnsupportedOperationException(); }
equals
254,334
void (@NotNull CodeInsightTestFixture codeInsightTestFixture, @NotNull String templateKey, @NotNull String templateGroup, @NotNull String answerFilePath) { TemplateImpl template = TemplateSettings.getInstance().getTemplate(templateKey, templateGroup); TestCase.assertNotNull("Unable to find template: " + templateKey + "...
doTestTemplateExpandingAvailability
254,335
void (@NotNull CodeInsightTestFixture fixture, @NotNull String templateKey, @NotNull String templateGroup, @NotNull String answerFilePath) { TemplateImpl template = TemplateSettings.getInstance().getTemplate(templateKey, templateGroup); String templateId = templateKey + "@" + templateGroup; TestCase.assertNotNull("Unab...
doTestTemplateSurroundingAvailability
254,336
void (@NotNull Editor editor, char c) { if (c == BACKSPACE_FAKE_CHAR) { executeAction(editor, IdeActions.ACTION_EDITOR_BACKSPACE); } else if (c == SMART_ENTER_FAKE_CHAR) { executeAction(editor, IdeActions.ACTION_EDITOR_COMPLETE_STATEMENT); } else if (c == SMART_LINE_SPLIT_CHAR) { executeAction(editor, IdeActions.ACTION...
performTypingAction
254,337
void (@NotNull Editor editor, @NotNull String actionId) { executeAction(editor, actionId, false); }
executeAction
254,338
void (@NotNull Editor editor, @NotNull String actionId, boolean assertActionIsEnabled) { ActionManagerEx actionManager = ActionManagerEx.getInstanceEx(); AnAction action = actionManager.getAction(actionId); assertNotNull(action); executeAction(editor, assertActionIsEnabled, action); }
executeAction
254,339
void (@NotNull Editor editor, boolean assertActionIsEnabled, @NotNull AnAction action) { AnActionEvent event = AnActionEvent.createFromAnAction(action, null, "", createEditorContext(editor)); if (ActionUtil.lastUpdateAndCheckDumb(action, event, false)) { ActionUtil.performActionDumbAwareWithCallbacks(action, event); } ...
executeAction
254,340
DataContext (@NotNull Editor editor) { Editor hostEditor = editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor; DataContext parent = DataManager.getInstance().getDataContext(editor.getContentComponent()); return SimpleDataContext.builder() .setParent(parent) .add(CommonDataKeys.HOST_EDITOR, h...
createEditorContext
254,341
void (Editor editor) { executeAction(editor, IdeActions.ACTION_COPY_REFERENCE, true); }
performReferenceCopy
254,342
void (Editor editor) { executeAction(editor, IdeActions.ACTION_EDITOR_PASTE, true); }
performPaste
254,343
List<IElementType> (EditorHighlighter highlighter) { List<IElementType> tokens = new ArrayList<>(); HighlighterIterator iterator = highlighter.createIterator(0); while (!iterator.atEnd()) { tokens.add(iterator.getTokenType()); iterator.advance(); } return tokens; }
getAllTokens
254,344
void (Project project, Editor editor) { if (!(editor instanceof EditorImpl)) return; HighlighterIterator editorIterator = editor.getHighlighter().createIterator(0); EditorHighlighter freshHighlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter( project, editor.getVirtualFile()); freshHighlighter.se...
checkEditorHighlighter
254,345
String (EditorHighlighter highlighter) { HighlighterIterator iterator = highlighter.createIterator(0); StringBuilder result = new StringBuilder(); int i = 0; while (!iterator.atEnd()) { result.append(i).append(": ").append(iterator.getTokenType()).append(" [").append(iterator.getStart()).append("-") .append(iterator.ge...
dumpHighlighter
254,346
int (@NotNull final String content) { return getCaretAndSelectionPosition(content)[0]; }
getCaretPosition
254,347
int[] (@NotNull final String content) { int caretPosInSourceFile = content.indexOf(CARET_TAG_PREFIX); int caretEndInSourceFile = content.indexOf(">", caretPosInSourceFile); int caretLength = caretEndInSourceFile - caretPosInSourceFile; int visualColumnOffset = 0; if (caretPosInSourceFile >= 0) { String visualOffsetStri...
getCaretAndSelectionPosition
254,348
boolean (Editor editor, final int charCountToWrapAt) { return configureSoftWraps(editor, charCountToWrapAt, true); }
configureSoftWraps
254,349
boolean (Editor editor, final int charCountToWrapAt, boolean useCustomSoftWrapIndent) { int charWidthInPixels = 10; // we're adding 1 to charCountToWrapAt, to account for wrap character width, and 1 to overall width to overcome wrapping logic subtleties return configureSoftWraps(editor, (charCountToWrapAt + 1) * charWi...
configureSoftWraps
254,350
boolean (Editor editor, int charCountToWrapAt, int visibleLineCount) { int charWidthInPixels = 10; // we're adding 1 to charCountToWrapAt, to account for wrap character width, and 1 to overall width to overcome wrapping logic subtleties return configureSoftWraps(editor, (charCountToWrapAt + 1) * charWidthInPixels + 1, ...
configureSoftWrapsAndViewport
254,351
boolean (Editor editor, final int visibleWidth, final int charWidthInPixels) { return configureSoftWraps(editor, visibleWidth, 1000, charWidthInPixels); }
configureSoftWraps
254,352
boolean (Editor editor, int visibleWidthInPixels, int visibleHeightInPixels, int charWidthInPixels) { return configureSoftWraps(editor, visibleWidthInPixels, visibleHeightInPixels, charWidthInPixels, true); }
configureSoftWraps
254,353
boolean (Editor editor, int visibleWidthInPixels, int visibleHeightInPixels, int charWidthInPixels, boolean useCustomSoftWrapIndent) { editor.getSettings().setUseSoftWraps(true); editor.getSettings().setUseCustomSoftWrapIndent(useCustomSoftWrapIndent); SoftWrapModelImpl model = (SoftWrapModelImpl)editor.getSoftWrapMode...
configureSoftWraps
254,354
int (@NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) { return charWidthInPixels; }
paint
254,355
int (@NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) { return charWidthInPixels; }
getDrawingHorizontalOffset
254,356
int (@NotNull SoftWrapDrawingType drawingType) { return charWidthInPixels; }
getMinDrawingWidth
254,357
boolean () { return true; }
canUse
254,358
void () {}
reinit
254,359
void (Editor editor, int widthInChars, int heightInChars) { setEditorVisibleSizeInPixels(editor, widthInChars * EditorUtil.getSpaceWidth(Font.PLAIN, editor), heightInChars * editor.getLineHeight()); }
setEditorVisibleSize
254,360
void (Editor editor, int widthInPixels, int heightInPixels) { Dimension size = new Dimension(widthInPixels, heightInPixels); ((EditorEx)editor).getScrollPane().getViewport().setExtentSize(size); }
setEditorVisibleSizeInPixels
254,361
CaretAndSelectionState (@NotNull Document document) { return extractCaretAndSelectionMarkers(document, true); }
extractCaretAndSelectionMarkers
254,362
CaretAndSelectionState (@NotNull Document document, final boolean processBlockSelection) { return WriteCommandAction.writeCommandAction(null).compute(() -> extractCaretAndSelectionMarkersImpl(document, processBlockSelection)); }
extractCaretAndSelectionMarkers
254,363
CaretAndSelectionState (@NotNull Document document, boolean processBlockSelection) { List<CaretInfo> carets = new ArrayList<>(); String fileText = document.getText(); RangeMarker blockSelectionStartMarker = null; RangeMarker blockSelectionEndMarker = null; if (processBlockSelection) { int blockSelectionStart = fileText...
extractCaretAndSelectionMarkersImpl
254,364
void (Editor editor, CaretAndSelectionState caretsState) { CaretModel caretModel = editor.getCaretModel(); List<CaretState> states = new ArrayList<>(caretsState.carets.size()); for (CaretInfo caret : caretsState.carets) { states.add(new CaretState(caret.position == null ? null : editor.offsetToLogicalPosition(caret.get...
setCaretsAndSelection
254,365
void (Editor editor, CaretAndSelectionState caretState) { verifyCaretAndSelectionState(editor, caretState, null); }
verifyCaretAndSelectionState
254,366
void (Editor editor, CaretAndSelectionState caretState, String message) { verifyCaretAndSelectionState(editor, caretState, message, null); }
verifyCaretAndSelectionState
254,367
void (Editor editor, CaretAndSelectionState caretState, String message, String expectedFilePath) { boolean hasChecks = false; for (int i = 0; i < caretState.carets.size(); i++) { EditorTestUtil.CaretInfo expected = caretState.carets.get(i); if (expected.position != null || expected.selection != null) { hasChecks = true...
verifyCaretAndSelectionState
254,368
void (Editor editor, CaretAndSelectionState caretState, String message) { String messageSuffix = message == null ? "" : (message + ": "); CaretModel caretModel = editor.getCaretModel(); List<Caret> allCarets = new ArrayList<>(caretModel.getAllCarets()); assertEquals(messageSuffix + " Unexpected number of carets", caret...
doVerifyCaretAndSelectionState
254,369
void (@NotNull PsiFile testFile, boolean allowUnhandledTokens, @NotNull String expected) { UsefulTestCase.assertTextEquals(expected, serializeHighlightingResults(testFile, allowUnhandledTokens)); }
testFileSyntaxHighlighting
254,370
void (@NotNull PsiFile testFile, @NotNull String answerFilePath, boolean allowUnhandledTokens) { UsefulTestCase.assertSameLinesWithFile(answerFilePath, serializeHighlightingResults(testFile, allowUnhandledTokens)); }
testFileSyntaxHighlighting
254,371
String (@NotNull PsiFile testFile, boolean allowUnhandledTokens) { TestCase.assertNotNull("Fixture has no file", testFile); final SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(testFile.getFileType(), testFile.getProject(), testFile.getVirtualFile()); TestCase.assertNotNull("Syntax ...
serializeHighlightingResults
254,372
String (@Nullable TextAttributesKey key) { if (key == null) { return ""; } final String keyName = key.getExternalName(); final TextAttributesKey fallbackKey = key.getFallbackAttributeKey(); TestCase.assertNotSame(fallbackKey, key); return fallbackKey == null ? keyName : (keyName + " => " + serializeTextAttributeKey(fal...
serializeTextAttributeKey
254,373
String (@NotNull Editor editor) { CaretAndSelectionMarkup markup = new CaretAndSelectionMarkup(); // There's no guarantee on the order the carets are enumerated, // and in any case we should be prepared that something might go wrong. for (Caret caret : editor.getCaretModel().getAllCarets()) { boolean hasSelection = car...
renderActualState
254,374
String (@NotNull Editor editor, @NotNull List<? extends CaretInfo> carets) { CaretAndSelectionMarkup markup = new CaretAndSelectionMarkup(); // The expected state is properly sorted already, so it doesn't require extra sorting, // but for sake of consistency we use the same approach as for the actual caret state. for (...
renderExpectedState
254,375
void (int offset, @NotNull String s) { Pair<Integer, String> mark = Pair.create(offset, s); marks.add(mark); }
addMark
254,376
String (@NotNull @NlsSafe CharSequence text) { StringBuilder sb = new StringBuilder(text); marks.sort(Comparator.comparingInt(mark -> mark.first)); for (int i = marks.size() - 1; i >= 0; i--) { Pair<Integer, String> mark = marks.get(i); int offset = mark.first; if (0 <= offset && offset <= sb.length()) { sb.insert(offs...
insertMarks
254,377
FoldRegion (@NotNull Editor editor, final int startOffset, final int endOffset, final String placeholder, final boolean collapse) { final FoldingModel foldingModel = editor.getFoldingModel(); final Ref<FoldRegion> ref = new Ref<>(); foldingModel.runBatchFoldingOperation(() -> { FoldRegion region = foldingModel.addFoldR...
addFoldRegion
254,378
Inlay (@NotNull Editor editor, int offset) { return addInlay(editor, offset, false); }
addInlay
254,379
Inlay (@NotNull Editor editor, int offset, boolean relatesToPrecedingText) { return addInlay(editor, offset, relatesToPrecedingText, 1); }
addInlay
254,380
Inlay (@NotNull Editor editor, int offset, boolean relatesToPrecedingText, int widthInPixels) { return editor.getInlayModel().addInlineElement(offset, relatesToPrecedingText, new EmptyInlayRenderer(widthInPixels)); }
addInlay
254,381
Inlay (@NotNull Editor editor, int offset, boolean relatesToPrecedingText, boolean showAbove, int widthInPixels, Integer heightInPixels) { return addBlockInlay(editor, offset, relatesToPrecedingText, showAbove, false, widthInPixels, heightInPixels); }
addBlockInlay
254,382
Inlay (@NotNull Editor editor, int offset, boolean relatesToPrecedingText, boolean showAbove, boolean showWhenFolded, int widthInPixels, Integer heightInPixels) { return editor.getInlayModel().addBlockElement(offset, new InlayProperties() .relatesToPrecedingText(relatesToPrecedingText) .showAbove(showAbove) .showWhenFo...
addBlockInlay
254,383
Inlay (@NotNull Editor editor, int offset, int widthInPixels) { return editor.getInlayModel().addAfterLineEndElement(offset, false, new EmptyInlayRenderer(widthInPixels)); }
addAfterLineEndInlay
254,384
void (@NotNull Editor editor, @NotNull Runnable runnable) { FileEditor fileEditor = TextEditorProvider.getInstance().getTextEditor(editor); Project project = editor.getProject(); assertNotNull(project); UndoManagerImpl undoManager = (UndoManagerImpl)UndoManager.getInstance(project); undoManager.setOverriddenEditorProvi...
testUndoInEditor
254,385
String (@NotNull Editor editor) { return getTextWithCaretsAndSelections(editor, true, true); }
getTextWithCaretsAndSelections
254,386
String (@NotNull Editor editor, boolean addCarets, boolean addSelections) { StringBuilder sb = new StringBuilder(editor.getDocument().getCharsSequence()); ContainerUtil.reverse(editor.getCaretModel().getAllCarets()).forEach( caret -> ContainerUtil.reverse(getCaretMacros(caret, addCarets, addSelections)).forEach( pair -...
getTextWithCaretsAndSelections
254,387
void (@NotNull CodeInsightTestFixture fixture, @NotNull String answersFilePath, @Nullable Set<String> acceptableKeyNames) { Editor editor = fixture.getEditor(); CaretModel caretModel = editor.getCaretModel(); List<Integer> offs = ContainerUtil.map(caretModel.getAllCarets(), Caret::getOffset); List<Integer> caretsOffset...
checkEditorHighlighting
254,388
String (@NotNull List<? extends HighlightInfo> highlightInfos, @NotNull CharSequence documentSequence, @Nullable Set<String> acceptableKeyNames) { List<Pair<Integer, String>> sortedMarkers = highlightInfos.stream() .flatMap(it -> { String keyText = it.type.getAttributesKey().toString(); if (acceptableKeyNames != null &...
renderTextWithHighlightingInfos
254,389
record (List<CaretInfo> carets, @Nullable TextRange blockSelection) { /** * Returns true if current CaretAndSelectionState contains at least one caret or selection explicitly specified */ public boolean hasExplicitCaret() { if(carets.isEmpty()) return false; if(blockSelection == null && carets.size() == 1) { CaretInfo ...
CaretAndSelectionState
254,390
boolean () { if(carets.isEmpty()) return false; if(blockSelection == null && carets.size() == 1) { CaretInfo caret = carets.get(0); return caret.position != null || caret.selection != null; } return true; }
hasExplicitCaret
254,391
int (Document document) { return position == null ? -1 : document.getLineStartOffset(position.line) + position.column; }
getCaretOffset
254,392
int (@NotNull Inlay inlay) { return width;}
calcWidthInPixels
254,393
int (@NotNull Inlay inlay) { return height == null ? EditorCustomElementRenderer.super.calcHeightInPixels(inlay) : height; }
calcHeightInPixels
254,394
int (@NotNull CustomFoldRegion region) { return myWidth; }
calcWidthInPixels
254,395
int (@NotNull CustomFoldRegion region) { return myHeight; }
calcHeightInPixels
254,396
void (@NotNull CustomFoldRegion region, @NotNull Graphics2D g, @NotNull Rectangle2D targetRegion, @NotNull TextAttributes textAttributes) {}
paint
254,397
int () { return myWidth; }
getVisibleAreaWidth
254,398
void (int width) { myWidth = width; }
setVisibleAreaWidth
254,399
void (@NotNull Editor editor) { ThreadingAssertions.assertEventDispatchThread(); assert !ApplicationManager.getApplication().isWriteAccessAllowed(); CodeFoldingState foldingState; try { foldingState = ReadAction.nonBlocking(() -> { Project project = editor.getProject(); if (project == null || editor.isDisposed()) { ret...
buildInitialFoldingsInBackground