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, file) && ShRenameAllOccurrencesHandler.INSTANCE.isEnabled(editor, editor.getCaretModel().getPrimaryCaret(), dataContext) && isRenameAvailable(editor, file) ; } | 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 (element != null && ShTokenTypes.keywords.contains(PsiUtilCore.getElementType(element))) { return false; } } return true; } | 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.execute(editor, editor.getCaretModel().getPrimaryCaret(), null); } } | 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, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insetsBottom(8), 0, 0 )); return panel; } | 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.run(() -> { int prevCount = (int)myOccurrences.stream() .filter(range -> range.getStartOffset() < myOccurrenceAtCaret.getStartOffset()) .count(); Caret caret = myEditor.getCaretModel().getPrimaryCaret(); int newCaretOffset = caret.getOffset() + (newName.length() - myOldName.length()) * prevCount; CommandProcessor.getInstance().executeCommand(myEditor.getProject(), () -> { document.setText(result); caret.moveToOffset(newCaretOffset); }, null, null, document); }); } | 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(prevOccurrence != null ? prevOccurrence.getEndOffset() : 0, occurrence.getStartOffset())); result.append(newName); prevOccurrence = occurrence; } result.append(documentText.subSequence(prevOccurrence != null ? prevOccurrence.getEndOffset() : 0, documentText.length())); return result.toString(); } | 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> -f $<subshell>(</subshell><generic>find</generic> / -name core<subshell>)</subshell> &> /dev/null <generic>mkdir</generic> -p "${<composed_var>AGENT_USER_HOME_</composed_var>${<composed_var>PLATFORM</composed_var>}}" <var>multiline</var>='first line second line third line' <generic>cat</generic> << EOF Sample text EOF"""; } | 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(directory, SHELLCHECK_BIN); File oldShellcheck = new File(directory, "old_" + SHELLCHECK_BIN); if (shellcheck.exists()) { if (withReplace) { boolean successful = renameOldShellcheck(shellcheck, oldShellcheck, onFailure); if (!successful) return; } else { setupShellcheckPath(shellcheck, onSuccess, onFailure); return; } } String url = getShellcheckDistributionLink(); if (StringUtil.isEmpty(url)) { LOG.debug("Unsupported OS for shellcheck"); return; } String downloadName = SHELLCHECK + SHELLCHECK_ARCHIVE_EXTENSION; DownloadableFileService service = DownloadableFileService.getInstance(); DownloadableFileDescription description = service.createFileDescription(url, downloadName); FileDownloader downloader = service.createDownloader(Collections.singletonList(description), downloadName); Task.Backgroundable task = new Task.Backgroundable(project, message("sh.shellcheck.download.label.text")) { @Override public void run(@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 = decompressShellcheck(file, directory); if (StringUtil.isNotEmpty(path)) { FileUtil.setExecutable(new File(path)); ShSettings.setShellcheckPath(path); if (withReplace) { LOG.debug("Remove old shellcheck"); FileUtil.delete(oldShellcheck); } ApplicationManager.getApplication().invokeLater(onSuccess); EXTERNAL_ANNOTATOR_DOWNLOADED_EVENT_ID.log(); } } } catch (IOException e) { LOG.warn("Can't download shellcheck", e); if (withReplace) rollbackToOldShellcheck(shellcheck, oldShellcheck); ApplicationManager.getApplication().invokeLater(onFailure); } } }; BackgroundableProcessIndicator processIndicator = new BackgroundableProcessIndicator(task); processIndicator.setIndeterminate(false); ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, processIndicator); } | 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 = decompressShellcheck(file, directory); if (StringUtil.isNotEmpty(path)) { FileUtil.setExecutable(new File(path)); ShSettings.setShellcheckPath(path); if (withReplace) { LOG.debug("Remove old shellcheck"); FileUtil.delete(oldShellcheck); } ApplicationManager.getApplication().invokeLater(onSuccess); EXTERNAL_ANNOTATOR_DOWNLOADED_EVENT_ID.log(); } } } catch (IOException e) { LOG.warn("Can't download shellcheck", e); if (withReplace) rollbackToOldShellcheck(shellcheck, oldShellcheck); ApplicationManager.getApplication().invokeLater(onFailure); } } | 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.setShellcheckPath(shellcheckPath); } if (!shellcheck.canExecute()) FileUtil.setExecutable(shellcheck); ApplicationManager.getApplication().invokeLater(onSuccess); } catch (IOException e) { LOG.warn("Can't evaluate shellcheck path or make it executable", e); ApplicationManager.getApplication().invokeLater(onFailure); } } | 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.getApplication().invokeLater(onFailure); return false; } return true; } | 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(() -> checkForUpdateInBackgroundThread(project)); } else { checkForUpdateInBackgroundThread(project); } } | 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.setDisplayId(ShNotificationDisplayIds.UPDATE_SHELLCHECK); notification.setSuggestionType(true); notification.addAction( NotificationAction.createSimple(messagePointer("sh.update"), () -> { notification.expire(); download(project, () -> Notifications.Bus .notify(NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.shellcheck.success.update"), NotificationType.INFORMATION) .setDisplayId(ShNotificationDisplayIds.UPDATE_SHELLCHECK_SUCCESS)), () -> Notifications.Bus .notify(NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.shellcheck.cannot.update"), NotificationType.ERROR) .setDisplayId(ShNotificationDisplayIds.UPDATE_SHELLCHECK_ERROR)), true); })); notification.addAction(NotificationAction.createSimple(messagePointer("sh.skip.version"), () -> { notification.expire(); ShSettings.setSkippedShellcheckVersion(SHELLCHECK_VERSION); })); Notifications.Bus.notify(notification, project); } | 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().withExePath(path).withParameters("--version"); ProcessOutput processOutput = ExecUtil.execAndGetOutput(commandLine, 3000); String stdout = processOutput.getStdout(); return !stdout.contains(SHELLCHECK_VERSION) && !ShSettings.getSkippedShellcheckVersion().equals(SHELLCHECK_VERSION); } catch (ExecutionException e) { LOG.debug("Exception in process execution", e); } return false; } | 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.getText(), file.getModificationStamp(), getShellcheckExecutionParams(file)); } | 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.isUnitTestMode()) return null; String shellcheckExecutable = ShSettings.getShellcheckPath(); if (!ShShellcheckUtil.isExecutionValidPath(shellcheckExecutable)) return null; ShShellcheckUtil.checkShellCheckForUpdate(fileInfo.project); try { GeneralCommandLine commandLine = new GeneralCommandLine() .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE) .withExePath(shellcheckExecutable) .withParameters(fileInfo.executionParams); if (!ApplicationManager.getApplication().isUnitTestMode()) commandLine.withWorkDirectory(fileInfo.workDirectory); long timestamp = fileInfo.modificationStamp; OSProcessHandler handler = new OSProcessHandler(commandLine); Ref<ShellcheckResponse> response = Ref.create(); handler.addProcessListener(new CapturingProcessAdapter() { @Override public void processTerminated(@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)); } }); handler.startNotify(); writeFileContentToStdin(handler.getProcess(), fileInfo.fileContent, commandLine.getCharset()); if (!handler.waitFor(TIMEOUT_IN_MILLISECONDS)) { LOG.debug("Execution timeout, process will be forcibly terminated"); handler.destroyProcess(); } return response.get(); } catch (ExecutionException e) { LOG.error(e); return null; } } | 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 = PsiTreeUtil.findChildrenOfType(file, OuterLanguageElement.class); List<TextRange> rangesOfOuterElements = ContainerUtil.map(outerElements, el -> el.getTextRange()); for (Result result : shellcheckResponse.results) { CharSequence sequence = document.getCharsSequence(); int startOffset = ShShellcheckUtil.calcOffset(sequence, document.getLineStartOffset(result.line - 1), result.column); int endOffset = ShShellcheckUtil.calcOffset(sequence, document.getLineStartOffset(result.endLine - 1), result.endColumn); TextRange range = TextRange.create(startOffset, endOffset == startOffset ? endOffset + 1 : endOffset); // We skip results which out of scope for current file or intersect with outer language elements if (!file.getTextRange().contains(range) || ContainerUtil.exists(rangesOfOuterElements, it -> it.contains(range))) continue; long code = result.code; String message = result.message; @NonNls String scCode = "SC" + code; @NonNls String html = "<html>" + "<p>" + StringUtil.escapeXmlEntities(message) + "</p>" + "<p>See <a href='https://github.com/koalaman/shellcheck/wiki/SC" + code + "'>" + scCode + "</a>.</p>" + "</html>"; AnnotationBuilder builder = holder.newAnnotation(severity(result.level), message).range(range).tooltip(html); String formattedMessage = format(message); Fix fix = result.fix; if (fix != null && !ArrayUtil.isEmpty(fix.replacements)) { builder = builder.withFix(new ShQuickFixIntention(formattedMessage, fix, shellcheckResponse.timestamp)); } String quotedMessage = quote(formattedMessage); builder.withFix(new ShSuppressInspectionIntention(quotedMessage, scCode, startOffset)) .withFix(new ShDisableInspectionIntention(quotedMessage, scCode)) .create(); } } | 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).updateAllNotifications(); }); myInspectionsCheckboxPanel = new MultipleCheckboxOptionsPanel(new OptionAccessor() { @Override public boolean getOption(String optionName) { return myDisabledInspections.contains(optionName); } @Override public void setOption(String optionName, boolean optionValue) { myInspectionsChangeListener.accept(optionName, optionValue); } }); } | 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 = ProjectUtil.guessCurrentProject(myOptionsPanel); EditorNotifications editorNotifications = EditorNotifications.getInstance(project); editorNotifications.updateAllNotifications(); } } | 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() : tool; } | 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 ((ShIncludeCommandImpl)parent).getReferencingFile(myElement); } | 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 = functionDefinition; return false; } | 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 = children.length - 1; i >= 0; i--) { PsiElement child = children[i]; if (violateRestrictions(element)) continue; if (violateTextRangeRestrictions(child.getTextRange(), placeTextRange)) continue; if (!child.processDeclarations(processor, substitutor, element, place)) return false; } return true; } | 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(); assert word != null; return word; } | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.