Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
14,600
|
void () { doFileTest("sh"); }
|
testIssue89
|
14,601
|
void () { doFileTest("sh"); }
|
testIssue320
|
14,602
|
void () { doFileTest("sh"); }
|
testIssue325
|
14,603
|
void () { doFileTest("sh"); }
|
testIssue327
|
14,604
|
void () { doFileTest("sh"); }
|
testIssue330
|
14,605
|
void () { doFileTest("sh"); }
|
testIssue330Var
|
14,606
|
void () { doFileTest("sh"); }
|
testIssue341
|
14,607
|
void () { doFileTest("sh"); }
|
testIssue343
|
14,608
|
void () { doFileTest("sh"); }
|
testIssue354
|
14,609
|
void () { doFileTest("sh"); }
|
testIssue389
|
14,610
|
void () { doFileTest("sh"); }
|
testTrapLexing
|
14,611
|
void () { doFileTest("sh"); }
|
testEvalLexing
|
14,612
|
void () { doFileTest("sh"); }
|
testIssue376
|
14,613
|
void () { doFileTest("sh"); }
|
testIssue367
|
14,614
|
void () { doFileTest("sh"); }
|
testIssue418
|
14,615
|
void () { doFileTest("sh"); }
|
testHereString
|
14,616
|
void () { doFileTest("sh"); }
|
testUnicode
|
14,617
|
void () { doFileTest("sh"); }
|
testLineContinuation
|
14,618
|
void () { doFileTest("sh"); }
|
testIssue358
|
14,619
|
void () { doFileTest("sh"); }
|
testIssue426
|
14,620
|
void () { doFileTest("sh"); }
|
testIssue431
|
14,621
|
void () { doFileTest("sh"); }
|
testIssue419
|
14,622
|
void () { doFileTest("sh"); }
|
testIssue401
|
14,623
|
void () { doFileTest("sh"); }
|
testIssue457
|
14,624
|
void () { doFileTest("sh"); }
|
testIssue458
|
14,625
|
void () { doFileTest("sh"); }
|
testIssue469
|
14,626
|
void () { doFileTest("sh"); }
|
testIssue474
|
14,627
|
void () { doFileTest("sh"); }
|
testIssue505
|
14,628
|
String () { return PluginPathManager.getPluginHomePath("sh") + "/core/testData/folding/"; }
|
getTestDataPath
|
14,629
|
void () { doTest(); }
|
testFunction
|
14,630
|
void () { doTest(); }
|
testHeredoc
|
14,631
|
void () { doTest(); }
|
testDoBlock
|
14,632
|
void () { doTest(); }
|
testComment
|
14,633
|
void () { doTest(); }
|
testShebang
|
14,634
|
void () { myFixture.testFoldingWithCollapseStatus(getTestDataPath() + "/" + getTestName(true) + ".sh"); }
|
doTest
|
14,635
|
void () { doTypingTest("<caret>", "\"", "\"<caret>\""); }
|
testString
|
14,636
|
void () { doTypingTest("<caret>", "'", "'<caret>'"); }
|
testRawString
|
14,637
|
void () { doTypingTest("<caret>", "`", "`<caret>`"); }
|
testBackQuote
|
14,638
|
void () { doTypingTest("<caret>foo", "\"", "\"<caret>foo"); }
|
testStringBeforeFoo
|
14,639
|
void () { doTypingTest("<caret>foo", "'", "'<caret>foo"); }
|
testRawStringBeforeFoo
|
14,640
|
void () { doTypingTest("<caret>foo", "`", "`<caret>foo"); }
|
testBackQuoteBeforeFoo
|
14,641
|
void () { doTypingTest("\"foo<caret>", "\"", "\"foo\"<caret>"); }
|
testQuoteAfterFoo
|
14,642
|
void () { doTypingTest("'foo<caret>", "'", "'foo'<caret>"); }
|
testRawStringAfterFoo
|
14,643
|
void () { doTypingTest("`foo<caret>", "`", "`foo`<caret>"); }
|
testBackQuoteAfterFoo
|
14,644
|
void () { doTypingTest("\"<caret>\"", "\"", "\"\"<caret>"); }
|
testStringAfter
|
14,645
|
void () { doTypingTest("'<caret>'", "'", "''<caret>"); }
|
testRawStringAfter
|
14,646
|
void () { doTypingTest("`<caret>`", "`", "``<caret>"); }
|
testBackQuoteAfter
|
14,647
|
void () { doBackspaceTest("\"<caret>\"", "<caret>"); }
|
testStringBackspace
|
14,648
|
void () { doBackspaceTest("'<caret>'", "<caret>"); }
|
testRawStringBackspace
|
14,649
|
void () { doBackspaceTest("`<caret>`", "<caret>"); }
|
testQuoteBackspace
|
14,650
|
void (String before, String forType, String after) { myFixture.configureByText("a.sh", before); myFixture.type(forType); myFixture.checkResult(after); }
|
doTypingTest
|
14,651
|
void (String before, String after) { myFixture.configureByText("a.sh", before); LightPlatformCodeInsightTestCase.backspace(myFixture.getEditor(), getProject()); myFixture.checkResult(after); }
|
doBackspaceTest
|
14,652
|
List<String> () { return List.of(INSTALL_FORMATTER, INSTALL_FORMATTER_SUCCESS, INSTALL_FORMATTER_ERROR, UPDATE_FORMATTER, UPDATE_FORMATTER_SUCCESS, UPDATE_FORMATTER_ERROR, UPDATE_SHELLCHECK, UPDATE_SHELLCHECK_SUCCESS, UPDATE_SHELLCHECK_ERROR); }
|
getNotificationIds
|
14,653
|
boolean (@NotNull final IElementType lbraceType, @Nullable final IElementType tokenType) { return true; }
|
isPairedBracesAllowedBeforeType
|
14,654
|
int (final PsiFile file, int openingBraceOffset) { return openingBraceOffset; }
|
getCodeConstructStart
|
14,655
|
void (@NotNull PsiElement o, @NotNull AnnotationHolder holder) { // todo comment in case of poor performance because of the issue with EditorGutterComponentImpl#updateSize() if (o instanceof ShGenericCommandDirective) { mark(o, holder, GENERIC_COMMAND); } else if (o instanceof ShAssignmentCommand) { PsiElement literal = ((ShAssignmentCommand)o).getLiteral(); mark(literal, holder, VARIABLE_DECLARATION); } else if (o instanceof ShShellParameterExpansion) { ASTNode[] children = o.getNode().getChildren(TokenSet.create(ShTypes.PARAM_SEPARATOR)); for (ASTNode node : children) { mark(node.getPsi(), holder, COMPOSED_VARIABLE); } } else if (o instanceof ShSubshellCommand subshellCommand) { mark(subshellCommand.getLeftParen(), holder, SUBSHELL_COMMAND); mark(subshellCommand.getRightParen(), holder, SUBSHELL_COMMAND); } ASTNode node = o.getNode(); IElementType elementType = node == null ? null : node.getElementType(); if (elementType == ShTypes.WORD) { PsiElement parent = o.getParent(); if (parent instanceof ShSimpleCommandElement) { holder.newSilentAnnotation(HighlightSeverity.INFORMATION).enforcedTextAttributes(TextAttributes.ERASE_MARKER).create(); } if (parent instanceof ShFunctionDefinition) { mark(o, holder, FUNCTION_DECLARATION); } } }
|
annotate
|
14,656
|
void (@Nullable PsiElement o, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) { if (o != null) { holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(o).textAttributes(key).create(); } }
|
mark
|
14,657
|
boolean (@NotNull PsiErrorElement element) { if (ApplicationManager.getApplication().isInternal()) return true; return !(element.getContainingFile() instanceof ShFile); }
|
shouldHighlightErrorElement
|
14,658
|
boolean (@NotNull HighlightInfo highlightInfo, @Nullable PsiFile file) { if (ApplicationManager.getApplication().isInternal()) return true; if (UpdateHighlightersUtil.isFileLevelOrGutterAnnotation(highlightInfo)) return true; if (!(file instanceof ShFile)) return true; return highlightInfo.getSeverity().compareTo(HighlightSeverity.WARNING) < 0; }
|
accept
|
14,659
|
boolean (HighlighterIterator iterator, int offset) { final IElementType tokenType = iterator.getTokenType(); return tokenType != OPEN_QUOTE && tokenType != OPEN_BACKQUOTE && super.isClosingQuote(iterator, offset); }
|
isClosingQuote
|
14,660
|
boolean (HighlighterIterator iterator, int offset) { final IElementType tokenType = iterator.getTokenType(); return tokenType != CLOSE_QUOTE && tokenType != CLOSE_BACKQUOTE && super.isOpeningQuote(iterator, offset); }
|
isOpeningQuote
|
14,661
|
SmartBackspaceMode (@NotNull SmartBackspaceMode modeFromSettings) { return SmartBackspaceMode.INDENT; }
|
getBackspaceMode
|
14,662
|
StructureViewBuilder (@NotNull PsiFile psiFile) { if (!(psiFile instanceof ShFile)) return null; return new TreeBasedStructureViewBuilder() { @NotNull @Override public StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new Model(psiFile); } }; }
|
getStructureViewBuilder
|
14,663
|
StructureViewModel (@Nullable Editor editor) { return new Model(psiFile); }
|
createStructureViewModel
|
14,664
|
boolean (StructureViewTreeElement structureViewTreeElement) { return false; }
|
isAlwaysShowsPlus
|
14,665
|
boolean (StructureViewTreeElement structureViewTreeElement) { return false; }
|
isAlwaysLeaf
|
14,666
|
Object () { return myElement; }
|
getValue
|
14,667
|
void (boolean requestFocus) { ((Navigatable) myElement).navigate(requestFocus); }
|
navigate
|
14,668
|
boolean () { return ((Navigatable) myElement).canNavigate(); }
|
canNavigate
|
14,669
|
boolean () { return ((Navigatable) myElement).canNavigateToSource(); }
|
canNavigateToSource
|
14,670
|
String () { return myElement instanceof ShFunctionDefinition ? getFunctionName((ShFunctionDefinition) myElement) : null; }
|
getName
|
14,671
|
String (ShFunctionDefinition myElement) { String name = myElement.getName(); return name == null ? ShBundle.message("sh.unnamed.element.presentable.name") : name; }
|
getFunctionName
|
14,672
|
ItemPresentation () { return this; }
|
getPresentation
|
14,673
|
String () { if (myElement instanceof ShFunctionDefinition) { return getFunctionName((ShFunctionDefinition) myElement); } else if (myElement instanceof ShFile) { return ((ShFile) myElement).getName(); } else if (myElement instanceof PsiNamedElement) return ((PsiNamedElement) myElement).getName(); throw new AssertionError(myElement.getClass().getName()); }
|
getPresentableText
|
14,674
|
Icon (boolean open) { if (!myElement.isValid()) return null; if (myElement instanceof ShFunctionDefinition) { return AllIcons.Nodes.Lambda; } return myElement.getIcon(0); }
|
getIcon
|
14,675
|
void (@NotNull PsiReferenceRegistrar registrar) { PsiReferenceProvider provider = CommentsReferenceContributor.COMMENTS_REFERENCE_PROVIDER_TYPE.getProvider(); registrar.registerReferenceProvider(new PsiElementPattern.Capture<>(ShLiteral.class) {}, provider, PsiReferenceRegistrar.LOWER_PRIORITY); }
|
registerReferenceProviders
|
14,676
|
String () { return getText(); }
|
getFamilyName
|
14,677
|
String () { return ShBundle.message("sh.explain.inspection.text"); }
|
getText
|
14,678
|
boolean () { return false; }
|
startInWriteAction
|
14,679
|
boolean (@NotNull Project project, Editor editor, PsiFile file) { if (!(file instanceof ShFile)) return false; SelectionModel selectionModel = editor.getSelectionModel(); if (selectionModel.hasSelection()) { String selectedText = selectionModel.getSelectedText(); if (StringUtil.isEmptyOrSpaces(selectedText)) return false; if (selectedText.trim().contains("\n")) return false; } Caret caret = editor.getCaretModel().getPrimaryCaret(); int offset = caret.getOffset(); PsiElement at = file.findElementAt(offset); if (at == null) return false; //noinspection RedundantIfStatement if (at instanceof LeafPsiElement && at.getParent() instanceof ShFile) return false; return true; }
|
isAvailable
|
14,680
|
void (@NotNull PsiElement psiElement) { explain(psiElement.getText()); }
|
pass
|
14,681
|
void (@NotNull String text) { String encodedText = URLEncoder.encode(text, StandardCharsets.UTF_8); BrowserUtil.browse("https://explainshell.com/explain?cmd=" + encodedText); }
|
explain
|
14,682
|
boolean (@Nullable PsiElement o) { return o instanceof LeafPsiElement && ((LeafPsiElement) o).getElementType() == ShTypes.WORD && (o.getParent() instanceof ShLiteral) && (o.getParent().getParent() instanceof ShGenericCommandDirective); }
|
wordWithDocumentation
|
14,683
|
PsiElement (@NotNull Editor editor, @NotNull PsiFile file, @Nullable PsiElement contextElement, int targetOffset) { ASTNode node = contextElement == null ? null : contextElement.getNode(); if (node == null || (TreeUtil.isWhitespaceOrComment(node) || node.getElementType() == ShTypes.LINEFEED)) { PsiElement at = targetOffset > 0 ? file.findElementAt(targetOffset - 1) : null; if (wordWithDocumentation(at)) return at; } return contextElement; }
|
getCustomDocumentationElement
|
14,684
|
String (@Nullable String s) { if (s == null) return null; @NonNls StringBuilder sb = new StringBuilder("<html><body><pre>"); try { @NonNls Matcher m = URLUtil.URL_PATTERN.matcher(StringUtil.escapeXmlEntities(s)); while (m.find()) { if (m.groupCount() > 0) { String url = m.group(0); m.appendReplacement(sb, HtmlChunk.link(url, url).toString()); } } m.appendTail(sb); } catch (Exception e) { LOG.warn(e); } sb.append("</pre></body></html>"); return sb.toString(); }
|
wrapIntoHtml
|
14,685
|
Result (char charTyped, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (!(file instanceof ShFile)) return Result.CONTINUE; int currentLine = editor.getCaretModel().getPrimaryCaret().getLogicalPosition().line; if ((currentLine == 0 && charTyped == '!') || charTyped == '/') { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); return Result.STOP; } return Result.CONTINUE; }
|
checkAutoPopup
|
14,686
|
String () { return "Shell Script"; }
|
getName
|
14,687
|
String () { return ShBundle.message("filetype.sh.shell.script.description"); }
|
getDescription
|
14,688
|
String () { return "sh"; }
|
getDefaultExtension
|
14,689
|
Icon () { return AllIcons.Nodes.Console; }
|
getIcon
|
14,690
|
List<String> (char[] arr, Character prefix) { return IntStream.range(0, arr.length) .mapToObj(i -> { String v = String.valueOf(arr[i]); return prefix != null ? prefix + v : v; }) .collect(Collectors.toList()); }
|
toStr
|
14,691
|
String (String name) { return StringUtil.replace(name, ORIGINS, ENCODED); }
|
quote
|
14,692
|
String (String afterSlash) { return StringUtil.replace(afterSlash, ENCODED, ORIGINS); }
|
unquote
|
14,693
|
boolean (@NotNull CompletionParameters parameters) { PsiElement original = parameters.getOriginalPosition(); return original != null && original.getText().endsWith("."); }
|
endsWithDot
|
14,694
|
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiElement original = parameters.getOriginalPosition(); if (original == null) return; int textLength = parameters.getOffset() - parameters.getPosition().getTextRange().getStartOffset(); String originalText = original.getText().substring(0, textLength); CompletionResultSet resultSet = result.withPrefixMatcher(originalText); String defaultShell = EnvironmentUtil.getValue("SHELL"); if (defaultShell != null) { String defaultShebang = SHEBANG_PREFIX + defaultShell; if (defaultShebang.startsWith(originalText)) { resultSet.addElement(createLookupElement(defaultShebang, parameters, 10)); } } ACCEPTABLE_SHELLS.stream().map(shell -> SHEBANG_PREFIX + shell) .filter(shebang -> shebang.startsWith(originalText)) .forEach(shebang -> resultSet.addElement(createLookupElement(shebang, parameters, 0))); resultSet.stopHere(); }
|
addCompletions
|
14,695
|
LookupElement (@NotNull String lookupString, @NotNull CompletionParameters parameters, int priority) { return PrioritizedLookupElement.withPriority(LookupElementBuilder.create(lookupString).bold(), priority); }
|
createLookupElement
|
14,696
|
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { if (endsWithDot(parameters)) return; Project project = parameters.getOriginalFile().getProject(); for (String keyword : myKeywords) { result.addElement(createKeywordLookupElement(project, keyword)); } }
|
addCompletions
|
14,697
|
LookupElement (@NotNull Project project, @NotNull final String keyword) { TemplateManagerImpl templateManager = (TemplateManagerImpl) TemplateManager.getInstance(project); Template template = TemplateSettings.getInstance().getTemplateById("shell_" + keyword); InsertHandler<LookupElement> insertHandler = createTemplateBasedInsertHandler(templateManager, template, myEventId); return PrioritizedLookupElement.withPriority(LookupElementBuilder .create(keyword) .withTypeText(template != null && myWithDescription ? template.getDescription() : "") .withBoldness(true) .withInsertHandler(insertHandler), PRIORITY); }
|
createKeywordLookupElement
|
14,698
|
InsertHandler<LookupElement> (@NotNull TemplateManagerImpl templateManager, @Nullable Template template, @NotNull EventId eventId) { return (context, item) -> { Editor editor = context.getEditor(); if (template != null) { editor.getDocument().deleteString(context.getStartOffset(), context.getTailOffset()); templateManager.startTemplate(editor, template); } else { EditorModificationUtil.insertStringAtCaret(editor, " "); } eventId.log(); }; }
|
createTemplateBasedInsertHandler
|
14,699
|
void (@NotNull CompletionInitializationContext context) { super.duringCompletion(context); Caret caret = context.getCaret(); Editor editor = context.getEditor(); context.setReplacementOffset(calcDefaultIdentifierEnd(editor, calcSelectionEnd(caret))); }
|
duringCompletion
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.