diff --git a/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java b/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java index fa1e03983fde..b013af66a280 100644 --- a/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java +++ b/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java @@ -8,7 +8,6 @@ import com.intellij.execution.util.ExecUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationAction; import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; @@ -204,21 +203,19 @@ public final class ShShfmtFormatterUtil { NotificationAction.createSimple(messagePointer("sh.update"), () -> { notification.expire(); download(project, - () -> Notifications.Bus - .notify(NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.fmt.success.update"), - NotificationType.INFORMATION) - .setDisplayId(ShNotificationDisplayIds.UPDATE_FORMATTER_SUCCESS)), - () -> Notifications.Bus - .notify(NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.fmt.cannot.update"), - NotificationType.ERROR) - .setDisplayId(ShNotificationDisplayIds.UPDATE_FORMATTER_ERROR)), + () -> NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.fmt.success.update"), + NotificationType.INFORMATION) + .setDisplayId(ShNotificationDisplayIds.UPDATE_FORMATTER_SUCCESS).notify(project), + () -> NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.fmt.cannot.update"), + NotificationType.ERROR) + .setDisplayId(ShNotificationDisplayIds.UPDATE_FORMATTER_ERROR).notify(project), true); })); notification.addAction(NotificationAction.createSimple(messagePointer("sh.skip.version"), () -> { notification.expire(); ShSettings.setSkippedShfmtVersion(SHFMT_VERSION); })); - Notifications.Bus.notify(notification, project); + notification.notify(project); } /** diff --git a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java index 832c0943ab35..4079ea2520f0 100644 --- a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java +++ b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java @@ -8,7 +8,6 @@ import com.intellij.execution.util.ExecUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationAction; import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; @@ -52,7 +51,7 @@ public final class ShShellcheckUtil { private static final Key UPDATE_NOTIFICATION_SHOWN = Key.create("SHELLCHECK_UPDATE"); static final @NlsSafe String SHELLCHECK = "shellcheck"; static final @NlsSafe String SHELLCHECK_BIN = SystemInfo.isWindows ? SHELLCHECK + ".exe" : SHELLCHECK; - private static final String SHELLCHECK_VERSION = "0.7.1"; + private static final String SHELLCHECK_VERSION = "0.10.0"; private static final String SHELLCHECK_ARTIFACT_VERSION = SHELLCHECK_VERSION + "-1"; private static final String SHELLCHECK_ARCHIVE_EXTENSION = ".tar.gz"; private static final String SHELLCHECK_URL = @@ -212,21 +211,21 @@ public final class ShShellcheckUtil { 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)), + () -> NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.shellcheck.success.update"), + NotificationType.INFORMATION) + .setDisplayId(ShNotificationDisplayIds.UPDATE_SHELLCHECK_SUCCESS) + .notify(project), + () -> NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), message("sh.shellcheck.cannot.update"), + NotificationType.ERROR) + .setDisplayId(ShNotificationDisplayIds.UPDATE_SHELLCHECK_ERROR) + .notify(project), true); })); notification.addAction(NotificationAction.createSimple(messagePointer("sh.skip.version"), () -> { notification.expire(); ShSettings.setSkippedShellcheckVersion(SHELLCHECK_VERSION); })); - Notifications.Bus.notify(notification, project); + notification.notify(project); } /** @@ -289,7 +288,14 @@ public final class ShShellcheckUtil { static @NlsSafe @Nullable String getShellcheckDistributionLink() { String platform = SystemInfo.isMac ? "mac" : SystemInfo.isWindows ? "windows" : SystemInfo.isLinux ? "linux" : null; if (platform == null) return null; - return SHELLCHECK_URL + SHELLCHECK_ARTIFACT_VERSION + "/shellcheck-" + SHELLCHECK_ARTIFACT_VERSION + '-' + platform + SHELLCHECK_ARCHIVE_EXTENSION; + String arch = SystemInfo.isAarch64 ? "arm64" : "amd64"; + if (platform.equals("windows") && arch.equals("arm64")) { + // Unsupported OS + Arch + return null; + } + return SHELLCHECK_URL + + SHELLCHECK_ARTIFACT_VERSION + + "/shellcheck-" + SHELLCHECK_ARTIFACT_VERSION + '-' + platform + '-' + arch + SHELLCHECK_ARCHIVE_EXTENSION; } @SuppressWarnings("SpellCheckingInspection") diff --git a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java index 50aa23ee619a..416a42d209fe 100644 --- a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java +++ b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java @@ -2,9 +2,7 @@ package com.intellij.sh.shellcheck; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; -import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; @@ -22,6 +20,7 @@ import javax.swing.*; import java.util.function.Function; import static com.intellij.sh.ShBundle.message; +import static com.intellij.sh.ShLanguage.NOTIFICATION_GROUP; import static com.intellij.sh.shellcheck.ShShellcheckUtil.isValidPath; public class ShellcheckSetupNotificationProvider implements EditorNotificationProvider { @@ -37,14 +36,14 @@ public class ShellcheckSetupNotificationProvider implements EditorNotificationPr EditorNotifications.getInstance(project).updateAllNotifications(); PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (psiFile != null) DaemonCodeAnalyzer.getInstance(project).restart(psiFile); - Notifications.Bus.notify(new Notification(message("sh.shell.script"), message("sh.shell.script"), message("sh.shellcheck.success.install"), - NotificationType.INFORMATION)); + NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), + message("sh.shellcheck.success.install"), + NotificationType.INFORMATION).notify(project); }; - Runnable onFailure = () -> Notifications.Bus.notify(new Notification(message("sh.shell.script"), message("sh.shell.script"), - message("sh.shellcheck.cannot.download"), - NotificationType.ERROR)); + Runnable onFailure = () -> NOTIFICATION_GROUP.createNotification(message("sh.shell.script"), + message("sh.shellcheck.cannot.download"), + NotificationType.ERROR).notify(project); panel.createActionLabel(message("sh.install"), () -> ShShellcheckUtil.download(project, onSuccess, onFailure)); - //noinspection DialogTitleCapitalization panel.createActionLabel(message("sh.no.thanks"), () -> { ShSettings.setShellcheckPath(ShSettings.I_DO_MIND_SUPPLIER.get()); EditorNotifications.getInstance(project).updateAllNotifications();