Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
7,200
void () { doTest(" a b c"); }
testWrapInList
7,201
void () { doTest("synchronization"); }
testWrapInQuotes
7,202
void () { doTest("a b c"); }
testWrapInCodeFence
7,203
void () { doTest("a b c d e f"); }
testWrapInCodeFenceInQuotes
7,204
void () { doTest("synchronization"); }
testWrapInCodeFenceInList
7,205
void () { doTest("synchronization"); }
testWrapInHeader
7,206
void () { doTest("synchronization"); }
testWrapInTable
7,207
void () { final CodeStyleSettings settings = CodeStyle.getSettings(myFixture.getProject()); final CommonCodeStyleSettings commonCodeStyleSettings = settings.getCommonSettings(MarkdownLanguage.INSTANCE); int oldValue = commonCodeStyleSettings.RIGHT_MARGIN; boolean oldMarginValue = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN; commonCodeStyleSettings.RIGHT_MARGIN = 100; settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true; try { final String testName = getTestName(true); myFixture.configureByFile(testName + ".md"); for (int i = 0; i != 45; ++i) { myFixture.type(' '); } myFixture.checkResultByFile(testName + ".after.md"); } finally { commonCodeStyleSettings.RIGHT_MARGIN = oldValue; settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = oldMarginValue; } }
testWrapRightMargin
7,208
void (@NotNull String textToType) { String testName = getTestName(true); myFixture.configureByFile(testName + ".md"); myFixture.type(textToType); myFixture.checkResultByFile(testName + ".after.md"); }
doTest
7,209
void () { doTest("ruby", "a = 1", "```ruby\na = 1\n```"); }
testCreateNewCodeFence
7,210
void () { doTest(null, "a = 1", "```\na = 1\n```"); }
testNoLanguage
7,211
void () { doTest("js", "", "```js\n```"); }
testEmptyContent
7,212
void () { doTest("ruby", "```", "```ruby\n```"); }
testTicks
7,213
void () { Pair<PsiElement, PsiElement> codeFence = MarkdownPsiElementFactory.createLinkDeclarationAndReference(myFixture.getProject(), "https://jetbrains.com", "link", "title", "reference"); assertNotNull(codeFence.getFirst()); assertNotNull(codeFence.getSecond()); }
testReference
7,214
void () { Pair<PsiElement, PsiElement> codeFence = MarkdownPsiElementFactory.createLinkDeclarationAndReference(myFixture.getProject(), "https://jetbrains.com", "link", null, "reference"); assertNotNull(codeFence.getFirst()); assertNotNull(codeFence.getSecond()); }
testReferenceWithoutTitle
7,215
void (@Nullable String language, @NotNull String text, @NotNull String expectedText) { MarkdownCodeFence codeFence = MarkdownPsiElementFactory.createCodeFence(myFixture.getProject(), language, text); assertNotNull(codeFence); assertEquals(codeFence.getText(), expectedText); }
doTest
7,216
void (@NotNull String text, char charToType, @NotNull String expectedResult) { final PsiFile file = myFixture.configureByText("test.md", text); assertInstanceOf(file, MarkdownFile.class); myFixture.type(charToType); myFixture.checkResult(expectedResult); }
doTest
7,217
void () { doTest("Hello <caret> world", '\'', "Hello '<caret>' world"); }
testSingleQuote
7,218
void () { doTest("Hello <caret>world", '\'', "Hello '<caret>world"); }
testSingleQuoteBeforeWord
7,219
void () { doTest("Hello <caret>", '\'', "Hello '<caret>'"); }
testSingleQuoteAtEof
7,220
void () { doTest("Hello <caret> world", '"', "Hello \"<caret>\" world"); }
testDoubleQuote
7,221
void () { doTest("Hello <caret> world", '`', "Hello `<caret>` world"); }
testBacktick
7,222
void () { doTest("Hello <caret> world", '*', "Hello *<caret> world"); }
testEmphAsterisk
7,223
void () { doTest("Hello <caret> world", '_', "Hello _<caret> world"); }
testEmphUnderscore
7,224
void () { doTest("Hello dear<caret> world", '\'', "Hello dear'<caret> world"); }
testSingleQuoteAsApostrophe
7,225
void () { doTest("Hello dear<caret> world", '`', "Hello dear`<caret> world"); }
testBacktickAsAccent
7,226
void () { doTest("Hello '<caret>' world", '\'', "Hello ''<caret> world"); }
testClosingQuote
7,227
void () { doTest("Hello 'cool<caret>' world", '\'', "Hello 'cool'<caret> world"); }
testClosingQuoteWithWord
7,228
void () { final PsiFile file = myFixture.configureByText("test.md", "Hello <caret> world"); assertInstanceOf(file, MarkdownFile.class); myFixture.type('`'); myFixture.checkResult("Hello `<caret>` world"); myFixture.type('`'); myFixture.checkResult("Hello ``<caret>`` world"); myFixture.type('`'); myFixture.checkResult("Hello ```<caret>``` world"); }
testBacktickShouldBeAdded
7,229
void () { final PsiFile file = myFixture.configureByText("test.md", "<caret>"); assertInstanceOf(file, MarkdownFile.class); myFixture.type('`'); myFixture.checkResult("`<caret>`"); myFixture.type('`'); myFixture.checkResult("``<caret>``"); myFixture.type('`'); myFixture.checkResult("```<caret>```"); }
testBacktickShouldBeAddedStartOfLine
7,230
void () { doTest("Hello ``code<caret>`` world", '`', "Hello ``code`<caret>` world"); }
testBackticksGoodBalance
7,231
void () { doTest("Hello ``code`<caret>` world", '`', "Hello ``code``<caret> world"); }
testBackticksGoodBalance2
7,232
void () { doTest("Hello ``code<caret>` world", '`', "Hello ``code`<caret>` world"); }
testBackticksBadBalance
7,233
void () { checkBidiRunBoundaries(SAMPLE_TEXT, "md"); }
testBasicCase
7,234
void () { doTest(""" ```text Runti<caret>me ```""", "singleton_class", """ ```text singleton_class ```"""); }
testSimpleCodeFence
7,235
void () { doTest(""" ```text Runti<caret>me ```""", "\nRuntime", """ ```text Runtime ```"""); }
testSimpleCodeFenceNewLineBefore
7,236
void () { doTest(""" ```text Runt<caret>ime ```""", "Runtime\n", """ ```text Runtime ```"""); }
testSimpleCodeFenceNewLineAfter
7,237
void () { doTest(""" * ```text <caret>singleton_class ```""", "singleton", """ ```text singleton ```"""); }
testCodeFenceInList
7,238
void () { doTest(""" * ```text <caret>singleton_class ```""", "\nsingleton_class", """ ```text \s singleton_class ```"""); }
testCodeFenceInListNewLineBefore
7,239
void () { doTest(""" * ```text <caret>singleton_class ```""", "singleton_class\n", """ ```text singleton_class \s ```"""); }
testCodeFenceInListNewLineAfter
7,240
void () { doTest( """ * A * ```text <caret>setup ``` * C *D""", "singleton_class\n", """ ```text singleton_class \s ```"""); }
testCodeFenceInNestedList
7,241
void () { doTest(""" >```text ><caret>setup >```""", "singleton_class\n", """ ```text >singleton_class > >```"""); }
testCodeFenceInQuotes
7,242
void () { doTest(""" * C * B\s > * A\s > \s > * D \s - > - > ```text > > <caret>$LAST_MATCH_INFO > > ``` """, "singleton_class", """ ```text > > singleton_class > > ```"""); }
testInQuotesInListComplex
7,243
void () { doTest(""" * C * B\s > * A\s > \s > * D \s - > - > ```text > > <caret>$LAST_MATCH_INFO > > ``` """, "\nsingleton_class", """ ```text > >\s > > singleton_class > > ```"""); }
testInQuotesInListNewLineBefore
7,244
void () { doTest(""" * C * B\s > * A\s > \s > * D \s - > - > ```text > > <caret>$LAST_MATCH_INFO > > ``` """, "singleton_class\n", """ ```text > > singleton_class > >\s > > ```"""); }
testInQuotesInListNewLineAfter
7,245
void () { doTest(""" ```text Runti<caret>me ```""", "```singleton_class", "```singleton_class"); }
testThreeBackticksCodeFence
7,246
void () { doTest(""" ```text Runti<caret>me ```""", "~~~singleton_class", "~~~singleton_class"); }
testThreeTildaCodeFence
7,247
void (String text, String newContent, String expectedText) { myFixture.configureByText(MarkdownFileType.INSTANCE, text); int offset = myFixture.getCaretOffset(); PsiElement element = myFixture.getFile().findElementAt(offset); MarkdownCodeFence codeFence = (MarkdownCodeFence)InjectedLanguageManager.getInstance(getProject()).getInjectionHost(element); assertNotNull("Failed to find fence element", codeFence); final var manipulator = ElementManipulators.getNotNullManipulator(codeFence); final var newCodeFence = WriteCommandAction.runWriteCommandAction(myFixture.getProject(), (Computable<MarkdownCodeFence>)() -> { return manipulator.handleContentChange(codeFence, TextRange.from(element.getTextOffset(), element.getTextLength()), newContent); }); assertEquals(expectedText, newCodeFence != null ? newCodeFence.getText() : codeFence.getText()); }
doTest
7,248
String () { return null; }
getPresentableText
7,249
boolean () { return getElement() instanceof NavigationItem && ((NavigationItem)getElement()).canNavigate(); }
canNavigate
7,250
boolean () { return getElement() instanceof NavigationItem && ((NavigationItem)getElement()).canNavigateToSource(); }
canNavigateToSource
7,251
void (boolean requestFocus) { if (getElement() instanceof NavigationItem) { ((NavigationItem)getElement()).navigate(requestFocus); } }
navigate
7,252
String () { return StringUtil.notNullize(getElement() instanceof NavigationItem ? ((NavigationItem)getElement()).getName() : null); }
getAlphaSortKey
7,253
boolean () { return true; }
isSearchInLocationString
7,254
String () { final PsiElement tag = getElement(); if (tag == null) { return StructureViewBundle.message("node.structureview.invalid"); } return getPresentation().getPresentableText(); }
getPresentableText
7,255
String () { return getPresentation().getLocationString(); }
getLocationString
7,256
ItemPresentation () { if (getElement() instanceof PsiFileImpl) { ItemPresentation filePresent = ((PsiFileImpl)getElement()).getPresentation(); return filePresent != null ? filePresent : DUMMY_PRESENTATION; } if (getElement() instanceof NavigationItem) { final ItemPresentation itemPresent = ((NavigationItem)getElement()).getPresentation(); if (itemPresent != null) { return itemPresent; } } return DUMMY_PRESENTATION; }
getPresentation
7,257
Collection<StructureViewTreeElement> () { final ArrayList<StructureViewTreeElement> elements = new ArrayList<>(); MarkdownPsiStructureUtil.processContainer(getElement(), element -> elements.add(new MarkdownStructureElement(element))); return elements; }
getChildrenBase
7,258
String () { return " "; }
getLocationPrefix
7,259
String () { return ""; }
getLocationSuffix
7,260
void (@NotNull Map<? super String, ? super String> info) { info.put("text", getPresentableText()); if (!(getElement() instanceof PsiFileImpl)) { info.put("location", getLocationString()); } }
putInfo
7,261
Icon (boolean unused) { return PlatformIcons.XML_TAG_ICON; }
getIcon
7,262
StructureViewBuilder (@NotNull final PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new MarkdownStructureViewModel(psiFile, editor); } @Override public boolean isRootNodeShown() { return false; } }; }
getStructureViewBuilder
7,263
StructureViewModel (@Nullable Editor editor) { return new MarkdownStructureViewModel(psiFile, editor); }
createStructureViewModel
7,264
boolean () { return false; }
isRootNodeShown
7,265
Object (PsiElement element) { // walk up the psi-tree until we find an element from the structure view while (element != null && !(element instanceof PsiFile) && !PRESENTABLE_TYPES.contains(PsiUtilCore.getElementType(element))) { IElementType parentType = PsiUtilCore.getElementType(element.getParent()); final PsiElement previous = element.getPrevSibling(); if (previous == null || !TRANSPARENT_CONTAINERS.contains(parentType)) { element = element.getParent(); } else { element = previous; } } return element; }
findAcceptableElement
7,266
boolean (StructureViewTreeElement element) { return false; }
isAlwaysShowsPlus
7,267
boolean (StructureViewTreeElement element) { return MarkdownTokenTypeSets.HEADER_LEVEL_6_SET.contains(PsiUtilCore.getElementType((PsiElement)element.getValue())); }
isAlwaysLeaf
7,268
boolean () { return myCustomStylesheetEnabled; }
isCustomStylesheetEnabled
7,269
String () { return myCustomStylesheetPath; }
getCustomStylesheetPath
7,270
boolean () { return myTextEnabled; }
isTextEnabled
7,271
String () { return myStylesheetText; }
getCustomStylesheetText
7,272
Integer () { return myFontSize; }
getFontSize
7,273
void (@NotNull Integer fontSize) { myFontSize = fontSize; }
setFontSize
7,274
String () { return myFontFamily; }
getFontFamily
7,275
void (@NotNull String fontFamily) { myFontFamily = fontFamily; }
setFontFamily
7,276
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MarkdownCssSettings settings = (MarkdownCssSettings)o; if (myCustomStylesheetEnabled != settings.myCustomStylesheetEnabled) return false; if (myTextEnabled != settings.myTextEnabled) return false; if (!myCustomStylesheetPath.equals(settings.myCustomStylesheetPath)) return false; if (!myStylesheetText.equals(settings.myStylesheetText)) return false; if (!myFontSize.equals(settings.myFontSize)) return false; if (!myFontFamily.equals(settings.myFontFamily)) return false; return true; }
equals
7,277
int () { return Objects.hash(myCustomStylesheetEnabled, myCustomStylesheetPath, myTextEnabled, myStylesheetText, myFontSize, myFontFamily); }
hashCode
7,278
boolean () { return myIsAutoScrollPreview; }
isAutoScrollPreview
7,279
boolean () { return myIsVerticalSplit; }
isVerticalSplit
7,280
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MarkdownPreviewSettings settings = (MarkdownPreviewSettings)o; if (myIsAutoScrollPreview != settings.myIsAutoScrollPreview) return false; if (myIsVerticalSplit != settings.myIsVerticalSplit) return false; if (mySplitEditorLayout != settings.mySplitEditorLayout) return false; if (!myHtmlPanelProviderInfo.equals(settings.myHtmlPanelProviderInfo)) return false; return true; }
equals
7,281
int () { int result = mySplitEditorLayout.hashCode(); result = 31 * result + myHtmlPanelProviderInfo.hashCode(); result = 31 * result + (myIsAutoScrollPreview ? 1 : 0); result = 31 * result + (myIsVerticalSplit ? 1 : 0); return result; }
hashCode
7,282
MarkdownApplicationSettings () { return ApplicationManager.getApplication().getService(MarkdownApplicationSettings.class); }
getInstance
7,283
State () { return myState; }
getState
7,284
void (@NotNull State state) { myState = state; }
loadState
7,285
void (@NotNull MarkdownCssSettings settings) { ApplicationManager.getApplication().getMessageBus().syncPublisher(SettingsChangedListener.TOPIC).beforeSettingsChanged(this); myState.myCssSettings = settings; }
setMarkdownCssSettings
7,286
MarkdownCssSettings () { if (MarkdownCssSettings.DEFAULT.getCustomStylesheetPath().equals(myState.myCssSettings.getCustomStylesheetPath())) { return new MarkdownCssSettings(false, "", myState.myCssSettings.isTextEnabled(), myState.myCssSettings.getCustomStylesheetText(), myState.myCssSettings.getFontSize(), myState.myCssSettings.getFontFamily()); } return myState.myCssSettings; }
getMarkdownCssSettings
7,287
void (@NotNull MarkdownPreviewSettings settings) { ApplicationManager.getApplication().getMessageBus().syncPublisher(SettingsChangedListener.TOPIC).beforeSettingsChanged(this); myState.myPreviewSettings = settings; }
setMarkdownPreviewSettings
7,288
MarkdownPreviewSettings () { return myState.myPreviewSettings; }
getMarkdownPreviewSettings
7,289
void (boolean disableInjections) { myState.myDisableInjections = disableInjections; }
setDisableInjections
7,290
boolean () { return myState.myDisableInjections; }
isDisableInjections
7,291
void (boolean hideErrors) { myState.myHideErrors = hideErrors; }
setHideErrors
7,292
boolean () { return myState.myHideErrors; }
isHideErrors
7,293
void (boolean value) { myState.myEnhancedEditingEnabled = value; }
setEnhancedEditingEnabled
7,294
boolean () { return myState.myEnhancedEditingEnabled; }
isEnhancedEditingEnabled
7,295
boolean (String extensionId) { Boolean value = myState.myEnabledExtensions.get(extensionId); return value != null ? value : false; }
isExtensionsEnabled
7,296
void (String extensionId) { myState.myEnabledExtensions.put(extensionId, true); }
enableExtension
7,297
void (@NotNull Map<String, Boolean> state) { myState.myEnabledExtensions = state; }
setExtensionsEnabledState
7,298
String () { return MessageFormat.format("Markdown:{0}", super.toString()); }
toString
7,299
IElementType (@Nullable org.intellij.markdown.IElementType markdownType) { if (markdownType == null) { return null; } if (markdownToPlatformTypeMap.containsKey(markdownType)) { return markdownToPlatformTypeMap.get(markdownType); } synchronized (platformToMarkdownTypeMap) { return markdownToPlatformTypeMap.computeIfAbsent(markdownType, type -> { final IElementType result; if (type == MarkdownElementTypes.PARAGRAPH || type == MarkdownTokenTypes.ATX_CONTENT || type == MarkdownTokenTypes.SETEXT_CONTENT || type == GFMTokenTypes.CELL) { result = new MarkdownLazyElementType(type.toString()); } else if (isHeaderElementType(type)) { result = new MarkdownHeaderStubElementType(type.toString()); } else { result = new MarkdownElementType(type.toString()); } platformToMarkdownTypeMap.put(result, type); return result; }); } }
platformType