boolean (@NotNull ShRunConfiguration configuration, @NotNull ConfigurationContext context, @NotNull Ref<PsiElement> sourceElement) { PsiFile psiFile = sourceElement.get().getContainingFile(); if (!(psiFile instanceof ShFile)) return false; FileViewProvider viewProvider = psiFile.getViewProvider(); if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) return false; VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile == null || virtualFile instanceof LightVirtualFile) return false; String defaultShell = ShConfigurationType.getDefaultShell(psiFile.getProject()); String shebang = ShShebangParserUtil.getShebangExecutable((ShFile)psiFile); if (shebang != null) { Pair<String, String> result = parseInterpreterAndOptions(shebang); configuration.setInterpreterPath(result.first); configuration.setInterpreterOptions(result.second); } else { configuration.setInterpreterPath(defaultShell); } configuration.setScriptWorkingDirectory(virtualFile.getParent().getPath()); configuration.setName(virtualFile.getPresentableName()); configuration.setScriptPath(virtualFile.getPath()); return true; }