Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
14,800
boolean (@NotNull DataContext dataContext) { Editor editor = dataContext.getData(CommonDataKeys.EDITOR); ShFile file = ObjectUtils.tryCast(dataContext.getData(CommonDataKeys.PSI_FILE), ShFile.class); return editor != null && file != null && ShOccurrencesHighlightingSuppressor.isOccurrencesHighlightingEnabled(editor, fi...
isAvailableOnDataContext
14,801
boolean (@NotNull Editor editor, @NotNull ShFile file) { if (editor.getCaretModel().getPrimaryCaret().hasSelection()) return true; TextRange textRange = ShTextOccurrencesUtil.findTextRangeOfIdentifierAtCaret(editor); if (textRange != null) { PsiElement element = file.findElementAt(textRange.getStartOffset()); if (eleme...
isRenameAvailable
14,802
void (@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) { PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext); if (element instanceof ShFunctionDefinition) { PsiElementRenameHandler.invoke(element, project, file, editor); } else { ShRenameAllOccurrencesHandler.INSTANCE.exe...
invoke
14,803
void (@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext) { }
invoke
14,804
boolean () { return renamer.getEditor().getSettings().isPreselectRename(); }
shouldSelectAll
14,805
void () { close(DialogWrapper.OK_EXIT_CODE); myRenamer.renameTo(getNewName()); }
doAction
14,806
JComponent () { return myNameSuggestionsField.getFocusableComponent(); }
getPreferredFocusedComponent
14,807
JComponent () { JPanel panel = new JPanel(new GridBagLayout()); panel.add(myNameLabel, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insetsBottom(4), 0, 0 )); panel.add(myNameSuggestionsField.getComponent(), new GridBagConstraints( 0, 1, 1, 1, 1.0, 0.0, GridBagCo...
createNorthPanel
14,808
JComponent () { return null; }
createCenterPanel
14,809
boolean () { return false; }
hasPreviewButton
14,810
boolean () { return false; }
hasHelpAction
14,811
String () { return myNameSuggestionsField.getEnteredName().trim(); }
getNewName
14,812
String () { return myOldName; }
getOldName
14,813
Editor () { return myEditor; }
getEditor
14,814
void (@NotNull String newName) { Document document = myEditor.getDocument(); CharSequence documentText = document.getImmutableCharSequence(); if (document.getModificationStamp() != myInitialModificationStamp || !isValid(documentText)) { return; } String result = getNewDocumentText(documentText, newName); WriteAction.ru...
renameTo
14,815
String (@NotNull CharSequence documentText, @NotNull String newName) { TextRange prevOccurrence = null; StringBuilder result = new StringBuilder(documentText.length() + (newName.length() - myOldName.length()) * myOccurrences.size()); for (TextRange occurrence : myOccurrences) { result.append(documentText.subSequence(pr...
getNewDocumentText
14,816
boolean (@NotNull CharSequence text) { for (TextRange occurrence : myOccurrences) { if (!StringUtil.startsWith(text, occurrence.getStartOffset(), myOldName)) { return false; } } return true; }
isValid
14,817
String () { return ShLanguage.INSTANCE.getID(); }
getDisplayName
14,818
Icon () { return ShFileType.INSTANCE.getIcon(); }
getIcon
14,819
SyntaxHighlighter () { return SyntaxHighlighterFactory.getSyntaxHighlighter(ShLanguage.INSTANCE, null, null); }
getHighlighter
14,820
String () { return """ #!/usr/bin/env sh #Sample comment <generic>let</generic> "a=16 << 2"; <var>b</var>="Sample text"; function <function>foo</function>() { if [ $string1 == $string2 ]; then for url in `<generic>cat</generic> example.txt`; do <generic>curl</generic> $url > result.html done fi } <generic>rm</generic> ...
getDemoText
14,821
Lexer () { return new ShLexer(); }
getHighlightingLexer
14,822
String () { return ShBundle.message("sh.shell.script"); }
getFamilyName
14,823
boolean (@NotNull Project project, Editor editor, PsiFile file) { return timestamp == file.getModificationStamp(); }
isAvailable
14,824
boolean () { return true; }
startInWriteAction
14,825
String () { return message; }
getText
14,826
int (Document document, int line, int column) { return ShShellcheckUtil.calcOffset(document.getCharsSequence(), document.getLineStartOffset(line - 1), column); }
calcOffset
14,827
void (@Nullable Project project, @NotNull Runnable onSuccess, @NotNull Runnable onFailure) { download(project, onSuccess, onFailure, false); }
download
14,828
void (@Nullable Project project, @NotNull Runnable onSuccess, @NotNull Runnable onFailure, boolean withReplace) { File directory = new File(PathManager.getPluginsPath(), ShLanguage.INSTANCE.getID()); if (!directory.exists()) { //noinspection ResultOfMethodCallIgnored directory.mkdirs(); } File shellcheck = new File(dir...
download
14,829
void (@NotNull ProgressIndicator indicator) { try { List<Pair<File, DownloadableFileDescription>> pairs = downloader.download(directory); Pair<File, DownloadableFileDescription> first = ContainerUtil.getFirstItem(pairs); File file = first != null ? first.first : null; if (file != null) { String path = decompressShellch...
run
14,830
void (@NotNull File shellcheck, @NotNull Runnable onSuccess, @NotNull Runnable onFailure) { try { String path = ShSettings.getShellcheckPath(); String shellcheckPath = shellcheck.getPath(); if (StringUtil.isNotEmpty(path) && path.equals(shellcheckPath)) { LOG.debug("Shellcheck already downloaded"); } else { ShSettings....
setupShellcheckPath
14,831
boolean (@NotNull File shellcheck, @NotNull File oldShellcheck, @NotNull Runnable onFailure) { LOG.info("Rename shellcheck to the temporary filename"); try { FileUtil.rename(shellcheck, oldShellcheck); } catch (IOException e) { LOG.info("Can't rename shellcheck to the temporary filename", e); ApplicationManager.getAppl...
renameOldShellcheck
14,832
void (@NotNull File shellcheck, @NotNull File oldShellcheck) { LOG.info("Update failed, rollback"); try { FileUtil.rename(oldShellcheck, shellcheck); } catch (IOException e) { LOG.info("Can't rollback shellcheck after failed update", e); } FileUtil.delete(oldShellcheck); }
rollbackToOldShellcheck
14,833
boolean (@Nullable String path) { if (path == null || ShSettings.I_DO_MIND_SUPPLIER.get().equals(path)) return false; File file = new File(path); return file.canExecute() && file.getName().contains(SHELLCHECK); }
isExecutionValidPath
14,834
boolean (@Nullable String path) { if (path == null) return false; if (ShSettings.I_DO_MIND_SUPPLIER.get().equals(path)) return true; File file = new File(path); return file.canExecute() && file.getName().contains(SHELLCHECK); }
isValidPath
14,835
void (@NotNull Project project) { Application application = ApplicationManager.getApplication(); if (application.getUserData(UPDATE_NOTIFICATION_SHOWN) != null) return; application.putUserData(UPDATE_NOTIFICATION_SHOWN, true); if (application.isDispatchThread()) { application.executeOnPooledThread(() -> checkForUpdateI...
checkShellCheckForUpdate
14,836
void (@NotNull Project project) { ApplicationManager.getApplication().assertIsNonDispatchThread(); if (!isNewVersionAvailable()) return; Notification notification = NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.shellcheck.update.question"), NotificationType.INFORMATION); notification.set...
checkForUpdateInBackgroundThread
14,837
boolean () { String path = ShSettings.getShellcheckPath(); if (ShSettings.I_DO_MIND_SUPPLIER.get().equals(path)) return false; File file = new File(path); if (!file.canExecute()) return false; if (!file.getName().contains(SHELLCHECK)) return false; try { GeneralCommandLine commandLine = new GeneralCommandLine().withExe...
isNewVersionAvailable
14,838
int (CharSequence sequence, int startOffset, int column) { int i = 1; while (i < column) { int c = Character.codePointAt(sequence, startOffset); i += c == '\t' ? 8 : 1; startOffset++; } return startOffset; }
calcOffset
14,839
String () { return ShShellcheckInspection.SHORT_NAME; }
getPairedBatchInspectionShortName
14,840
CollectedInfo (@NotNull PsiFile file) { if (!(file instanceof ShFile)) return null; VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return null; VirtualFile parent = virtualFile.getParent(); if (parent == null) return null; return new CollectedInfo(file.getProject(), parent.getPath(), file.get...
collectInformation
14,841
ShellcheckResponse (@NotNull CollectedInfo fileInfo) { // Temporary solution to avoid execution under read action in dumb mode. Should be removed after IDEA-229905 will be fixed Application application = ApplicationManager.getApplication(); if (application != null && application.isReadAccessAllowed() && !application.is...
doAnnotate
14,842
void (@NotNull ProcessEvent event) { // The process ends up with code 1 Type type = TypeToken.getParameterized(List.class, Result.class).getType(); Collection<Result> results = new Gson().fromJson(getOutput().getStdout(), type); if (results != null) response.set(new ShellcheckResponse(results, timestamp)); }
processTerminated
14,843
void (@NotNull PsiFile file, ShellcheckResponse shellcheckResponse, @NotNull AnnotationHolder holder) { super.apply(file, shellcheckResponse, holder); Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file); if (document == null) { return; } Collection<OuterLanguageElement> outerElements...
apply
14,844
HighlightSeverity (@Nullable String level) { if ("error".equals(level)) { return HighlightSeverity.ERROR; } if ("warning".equals(level)) { return HighlightSeverity.WARNING; } return HighlightSeverity.WEAK_WARNING; }
severity
14,845
void (@NotNull Process process, @NotNull String content, @NotNull Charset charset) { try (OutputStream stdin = Objects.requireNonNull(process.getOutputStream())) { stdin.write(content.getBytes(charset)); stdin.flush(); } catch (IOException e) { LOG.debug("Failed to write file content to stdin\n\n" + content, e); } }
writeFileContentToStdin
14,846
String (@NotNull String originalMessage) { return originalMessage.endsWith(".") ? originalMessage.substring(0, originalMessage.length() - 1) : originalMessage; }
format
14,847
String (@NotNull String originalMessage) { return "'" + StringUtil.first(originalMessage, 60, true) + "'"; }
quote
14,848
String (@NotNull PsiFile file) { if (!(file instanceof ShFile)) return DEFAULT_SHELL; return ShShebangParserUtil.getInterpreter((ShFile)file, KNOWN_SHELLS, DEFAULT_SHELL); }
getInterpreter
14,849
void (@NotNull DocumentEvent documentEvent) { String shellcheckPath = myShellcheckSelector.getText(); ShSettings.setShellcheckPath(shellcheckPath); myWarningPanel.setVisible(!ShShellcheckUtil.isValidPath(shellcheckPath)); myErrorLabel.setVisible(false); }
textChanged
14,850
void () { myShellcheckDownloadLink = new ActionLink(ShBundle.message("sh.shellcheck.download.label.text"), e -> { ShShellcheckUtil.download(myProject, () -> myShellcheckSelector.setText(ShSettings.getShellcheckPath()), () -> myErrorLabel.setVisible(true)); EditorNotifications.getInstance(myProject).updateAllNotificatio...
createUIComponents
14,851
boolean (String optionName) { return myDisabledInspections.contains(optionName); }
getOption
14,852
void (String optionName, boolean optionValue) { myInspectionsChangeListener.accept(optionName, optionValue); }
setOption
14,853
String () { return SHORT_NAME; }
getShortName
14,854
void (@NotNull Element node) { String inspectionSettings = JDOMExternalizerUtil.readCustomField(node, SHELLCHECK_SETTINGS_TAG); if (StringUtil.isNotEmpty(inspectionSettings)) { myDisabledInspections.addAll(StringUtil.split(inspectionSettings, DELIMITER)); } }
readSettings
14,855
void (@NotNull Element node) { if (!myDisabledInspections.isEmpty()) { String joinedString = StringUtil.join(myDisabledInspections, DELIMITER); JDOMExternalizerUtil.writeCustomField(node, SHELLCHECK_SETTINGS_TAG, joinedString); } if (ApplicationManager.getApplication().isDispatchThread()) { Project project = ProjectUti...
writeSettings
14,856
JComponent () { myOptionsPanel = new ShellcheckOptionsPanel(getDisabledInspections(), this::onInspectionChange).getPanel(); return myOptionsPanel; }
createOptionsPanel
14,857
void (String inspectionCode) { if (StringUtil.isNotEmpty(inspectionCode)) myDisabledInspections.add(inspectionCode); }
disableInspection
14,858
void (@NotNull String inspectionCode, boolean selected) { if (selected) { myDisabledInspections.add(inspectionCode); } else { myDisabledInspections.remove(inspectionCode); } }
onInspectionChange
14,859
ShShellcheckInspection (@NotNull PsiElement element) { InspectionProfile profile = InspectionProjectProfileManager.getInstance(element.getProject()).getCurrentProfile(); ShShellcheckInspection tool = (ShShellcheckInspection)profile.getUnwrappedTool(SHORT_NAME, element); return tool == null ? new ShShellcheckInspection(...
findShShellcheckInspection
14,860
String () { return ShBundle.message("sh.suppress.inspection", myMessage); }
getText
14,861
String () { return ShBundle.message("sh.shell.script"); }
getFamilyName
14,862
boolean (@NotNull Project project, Editor editor, PsiFile file) { return true; }
isAvailable
14,863
boolean () { return true; }
startInWriteAction
14,864
String () { return ShBundle.message("sh.disable.inspection.text", myMessage); }
getText
14,865
String () { return ShBundle.message("sh.shell.script"); }
getFamilyName
14,866
boolean (@NotNull Project project, Editor editor, PsiFile file) { return true; }
isAvailable
14,867
boolean () { return true; }
startInWriteAction
14,868
Icon (int flags) { return AllIcons.Actions.Cancel; }
getIcon
14,869
WordsScanner () { return new DefaultWordsScanner(new ShLexer(), TokenSet.create(WORD), commentTokens, literals); }
getWordsScanner
14,870
boolean (@NotNull PsiElement psiElement) { return psiElement instanceof ShFunctionDefinition; }
canFindUsagesFor
14,871
String (@NotNull PsiElement psiElement) { return null; }
getHelpId
14,872
String (@NotNull PsiElement element) { return ShBundle.message("find.usages.type.function"); }
getType
14,873
String (@NotNull PsiElement element) { if (element instanceof PsiNamedElement) { String name = ((PsiNamedElement)element).getName(); if (name != null) return name; } return element.getText(); }
getDescriptiveName
14,874
String (@NotNull PsiElement element, boolean useFullName) { return element.getText(); }
getNodeText
14,875
boolean (@NotNull PsiElement parent) { return parent instanceof ShFunctionDefinition; }
isAcceptableNamedParent
14,876
PsiElement () { return CachedValuesManager.getCachedValue(myElement, new ShIncludeCommandCachedValueProvider(myElement)); }
resolve
14,877
PsiElement () { PsiElement parent = myElement.getParent(); if (!(parent instanceof ShIncludeCommandImpl includeCommand)) return null; List<ShSimpleCommandElement> commandList = includeCommand.getSimpleCommandElementList(); if (commandList.size() <= 0 || commandList.get(0) != myElement) return null; return ((ShIncludeCo...
resolveInner
14,878
PsiElement () { return CachedValuesManager.getCachedValue(myElement, new ShFunctionCachedValueProvider(myElement)); }
resolve
14,879
PsiElement () { ShFunctionDeclarationProcessor functionProcessor = new ShFunctionDeclarationProcessor(myElement.getText()); PsiTreeUtil.treeWalkUp(functionProcessor, myElement, myElement.getContainingFile(), ResolveState.initial()); return functionProcessor.getFunction(); }
resolveInner
14,880
boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (!(element instanceof ShFunctionDefinition functionDefinition)) return true; PsiElement identifier = functionDefinition.getWord(); if (identifier == null) return true; if (!identifier.getText().equals(myFunctionName)) return true; myResult = functi...
execute
14,881
ShFunctionDefinition () { return myResult; }
getFunction
14,882
boolean (@NotNull PsiElement element, @NotNull PsiScopeProcessor processor, @NotNull ResolveState substitutor, @Nullable PsiElement lastParent, @NotNull PsiElement place) { PsiElement[] children = element.getChildren(); if (children.length == 0) return true; TextRange placeTextRange = place.getTextRange(); for (int i =...
processChildren
14,883
boolean (@NotNull TextRange elementTextRange, @NotNull TextRange lastParentTextRange) { // If the element not in the range of parent or declared lower than called return !elementTextRange.contains(lastParentTextRange) && elementTextRange.getEndOffset() > lastParentTextRange.getStartOffset(); }
violateTextRangeRestrictions
14,884
boolean (@NotNull PsiElement element) { return element instanceof ShFunctionDefinition; }
violateRestrictions
14,885
FileType () { return ShFileType.INSTANCE; }
getFileType
14,886
boolean (@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) { return ResolveUtil.processChildren(this, processor, state, lastParent, place); }
processDeclarations
14,887
String () { return CachedValuesManager.getCachedValue(this, () -> CachedValueProvider.Result.create(findShebangInner(), this)); }
findShebang
14,888
String () { ASTNode shebang = getNode().findChildByType(ShTypes.SHEBANG); return shebang != null ? shebang.getText() : null; }
findShebangInner
14,889
ShLiteral (@NotNull Project project, @NotNull String command) { PsiFile file = createTempFile(project, command); ShLiteral literal = PsiTreeUtil.findChildOfType(file, ShLiteral.class); assert literal != null; return literal; }
createLiteral
14,890
PsiElement (@NotNull Project project, @NotNull String functionName) { PsiFile file = createTempFile(project, functionName + "() { }"); ShFunctionDefinition functionDefinition = PsiTreeUtil.findChildOfType(file, ShFunctionDefinition.class); assert functionDefinition != null; PsiElement word = functionDefinition.getWord(...
createFunctionIdentifier
14,891
PsiFile (@NotNull Project project, @NotNull String contents) { return PsiFileFactory.getInstance(project).createFileFromText("dummy_file." + ShFileType.INSTANCE.getDefaultExtension(), ShFileType.INSTANCE, contents); }
createTempFile
14,892
PsiElement () { return findNotNullChildByType(DO); }
getDo
14,893
PsiElement () { return findChildByElementType(DONE); }
getDone
14,894
int () { return getLeft().getNode().getStartOffset(); }
getTextOffset
14,895
PsiElement (@NotNull String name) { ElementManipulator<ShAssignmentExpression> manipulator = ElementManipulators.getManipulator(this); if (manipulator == null) return this; return manipulator.handleContentChange(this, name); }
setName
14,896
String () { PsiElement nameIdentifier = getNameIdentifier(); return nameIdentifier == null ? null : nameIdentifier.getText(); }
getName
14,897
PsiElement () { PsiElement left = getLeft(); if (!(left instanceof ShLiteralExpression)) return null; PsiElement first = left.getFirstChild(); if (first instanceof LeafPsiElement && first.getNextSibling() == null && first.getNode().getElementType() == ShTypes.WORD) return left; return null; }
getNameIdentifier
14,898
String () { return getNode().getElementType().toString(); }
toString
14,899
boolean (@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) { return processDeclarations(this, processor, state, lastParent, place); }
processDeclarations