diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c3fae71c..7abcbf30 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -30,10 +30,10 @@ jobs: - name: Build ktfmt_idea_plugin run: | pushd ktfmt_idea_plugin - ./gradlew build + ./gradlew build --no-daemon popd - name: Build the Online Formatter run: | pushd online_formatter - ./gradlew build + ./gradlew build --no-daemon popd diff --git a/.github/workflows/publish_artifacts_on_release.yaml b/.github/workflows/publish_artifacts_on_release.yaml index 371d3344..596b47c3 100644 --- a/.github/workflows/publish_artifacts_on_release.yaml +++ b/.github/workflows/publish_artifacts_on_release.yaml @@ -50,7 +50,7 @@ jobs: - name: Publish IntelliJ plugin to JetBrains Marketplace run: | pushd ktfmt_idea_plugin - ./gradlew publishPlugin --stacktrace + ./gradlew publishPlugin --stacktrace --no-daemon popd env: JETBRAINS_MARKETPLACE_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }} diff --git a/ktfmt_idea_plugin/build.gradle.kts b/ktfmt_idea_plugin/build.gradle.kts index dfc122b3..c5907fe0 100644 --- a/ktfmt_idea_plugin/build.gradle.kts +++ b/ktfmt_idea_plugin/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType.* + /* * Copyright (c) Meta Platforms, Inc. and affiliates. * @@ -66,3 +68,8 @@ intellijPlatform { } spotless { java { googleJavaFormat(libs.versions.googleJavaFormat.get()) } } + +val runIntellij242 by intellijPlatformTesting.runIde.registering { + type = IntellijIdeaCommunity + version = "2024.2" +} diff --git a/ktfmt_idea_plugin/src/main/java/com/facebook/ktfmt/intellij/InitialConfigurationStartupActivity.java b/ktfmt_idea_plugin/src/main/java/com/facebook/ktfmt/intellij/InitialConfigurationStartupActivity.java index 9b9387a2..00fe09ae 100644 --- a/ktfmt_idea_plugin/src/main/java/com/facebook/ktfmt/intellij/InitialConfigurationStartupActivity.java +++ b/ktfmt_idea_plugin/src/main/java/com/facebook/ktfmt/intellij/InitialConfigurationStartupActivity.java @@ -17,9 +17,10 @@ package com.facebook.ktfmt.intellij; import com.intellij.notification.Notification; -import com.intellij.notification.NotificationGroup; import com.intellij.notification.NotificationGroupManager; import com.intellij.notification.NotificationType; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; import org.jetbrains.annotations.NotNull; @@ -27,12 +28,9 @@ final class InitialConfigurationStartupActivity implements StartupActivity.Background { private static final String NOTIFICATION_TITLE = "Enable ktfmt"; - private static final NotificationGroup NOTIFICATION_GROUP = - NotificationGroupManager.getInstance().getNotificationGroup(NOTIFICATION_TITLE); @Override public void runActivity(@NotNull Project project) { - KtfmtSettings settings = KtfmtSettings.getInstance(project); if (settings.isUninitialized()) { @@ -42,16 +40,23 @@ public void runActivity(@NotNull Project project) { } private void displayNewUserNotification(Project project, KtfmtSettings settings) { - new Notification( - NOTIFICATION_GROUP.getDisplayId(), + Notification notification = + new Notification( + NotificationGroupManager.getInstance() + .getNotificationGroup(NOTIFICATION_TITLE) + .getDisplayId(), NOTIFICATION_TITLE, - "The ktfmt plugin is disabled by default. " - + "Enable for this project.", - NotificationType.INFORMATION) - .setListener( - (n, e) -> { - settings.setEnabled(true); - n.expire(); + "The ktfmt plugin is disabled by default.", + NotificationType.INFORMATION); + + notification + .addAction( + new AnAction("Enable for This Project") { + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + settings.setEnabled(true); + notification.expire(); + } }) .notify(project); }