├── settings.gradle.kts ├── src ├── main │ ├── resources │ │ ├── messages │ │ │ └── MyBundle.properties │ │ └── META-INF │ │ │ └── plugin.xml │ └── kotlin │ │ └── com │ │ └── github │ │ └── theapache64 │ │ └── rebuggerplugin │ │ ├── MyBundle.kt │ │ ├── PluginUtil.kt │ │ ├── GeneratePrintLnHereAction.kt │ │ └── AddRebuggerHereAction.kt └── test │ ├── testData │ ├── func_param │ │ ├── FuncParam.kt │ │ └── FuncParamAfter.kt │ ├── internal_param │ │ ├── InternalParam.kt │ │ └── InternalParamAfter.kt │ └── external_param │ │ ├── ExternalParam.kt │ │ └── ExternalParamAfter.kt │ └── kotlin │ └── com │ └── github │ └── theapache64 │ └── rebuggerplugin │ ├── FuncParamTest.kt │ ├── ExternalVarsTest.kt │ └── InternalVarsTest.kt ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── qodana.yml ├── .github ├── dependabot.yml └── workflows │ ├── run-ui-tests.yml │ ├── release.yml │ └── build.yml ├── .idea └── gradle.xml ├── CHANGELOG.md ├── .run ├── Run IDE for UI Tests.run.xml ├── Run IDE with Plugin.run.xml ├── Run Plugin Tests.run.xml ├── Run Qodana.run.xml └── Run Plugin Verification.run.xml ├── README.md ├── gradle.properties ├── gradlew.bat ├── .gitignore └── gradlew /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "rebugger-plugin" 2 | -------------------------------------------------------------------------------- /src/main/resources/messages/MyBundle.properties: -------------------------------------------------------------------------------- 1 | name=Rebugger 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theapache64/rebugger-plugin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /qodana.yml: -------------------------------------------------------------------------------- 1 | # Qodana configuration: 2 | # https://www.jetbrains.com/help/qodana/qodana-yaml.html 3 | 4 | version: 1.0 5 | profile: 6 | name: qodana.recommended 7 | exclude: 8 | - name: All 9 | paths: 10 | - .qodana 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /src/test/testData/func_param/FuncParam.kt: -------------------------------------------------------------------------------- 1 | package com.theapache64.rebuggersample 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.material.Text 5 | import androidx.compose.runtime.Composable 6 | 7 | @Composable 8 | fun MyFunction( 9 | param1: String, 10 | param2: Int 11 | ) { 12 | 13 | Column { 14 | Text(text = "Param 1 is $param1 and Params 2 is $param2") 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/testData/internal_param/InternalParam.kt: -------------------------------------------------------------------------------- 1 | package com.theapache64.rebuggersample 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.material.Text 5 | import androidx.compose.runtime.Composable 6 | 7 | @Composable 8 | fun MyFunction( 9 | param1: String, 10 | param2: Int 11 | ) { 12 | val state0 by remember { mutableStateOf("") } 13 | Column { 14 | var state1 by remember { mutableStateOf(0) } 15 | 16 | Text(text = "Param 1 is $param1 and Params 2 is $param2") 17 | } 18 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Dependabot configuration: 2 | # https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates 3 | 4 | version: 2 5 | updates: 6 | # Maintain dependencies for Gradle dependencies 7 | - package-ecosystem: "gradle" 8 | directory: "/" 9 | target-branch: "next" 10 | schedule: 11 | interval: "daily" 12 | # Maintain dependencies for GitHub Actions 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | target-branch: "next" 16 | schedule: 17 | interval: "daily" 18 | -------------------------------------------------------------------------------- /src/test/testData/func_param/FuncParamAfter.kt: -------------------------------------------------------------------------------- 1 | package com.theapache64.rebuggersample 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.material.Text 5 | import com.theapache64.rebugger.Rebugger 6 | import androidx.compose.runtime.Composable 7 | 8 | @Composable 9 | fun MyFunction( 10 | param1: String, 11 | param2: Int 12 | ) { 13 | Rebugger( 14 | trackMap = mapOf( 15 | "param1" to param1, 16 | "param2" to param2, 17 | ), 18 | ) 19 | Column { 20 | Text(text = "Param 1 is $param1 and Params 2 is $param2") 21 | } 22 | } -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/testData/external_param/ExternalParam.kt: -------------------------------------------------------------------------------- 1 | package com.theapache64.rebuggersample 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.material.Text 5 | import androidx.compose.runtime.Composable 6 | 7 | @Composable 8 | fun MyFunction( 9 | param1: String, 10 | param2: Int, 11 | myClass: MyClass = MyClass() 12 | ) { 13 | val state0 by remember { mutableStateOf("") } 14 | Text(text = "myDirectState is ${myClass.state1}") 15 | val state2 = myClass.state2 + myClass.state3 16 | 17 | Column { 18 | Text(text = "Param 1 is $param1 and Params 2 is $param2") 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/github/theapache64/rebuggerplugin/MyBundle.kt: -------------------------------------------------------------------------------- 1 | package com.github.theapache64.rebuggerplugin 2 | 3 | import com.intellij.DynamicBundle 4 | import org.jetbrains.annotations.NonNls 5 | import org.jetbrains.annotations.PropertyKey 6 | 7 | @NonNls 8 | private const val BUNDLE = "messages.MyBundle" 9 | 10 | object MyBundle : DynamicBundle(BUNDLE) { 11 | 12 | @Suppress("SpreadOperator") 13 | @JvmStatic 14 | fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = 15 | getMessage(key, *params) 16 | 17 | @Suppress("SpreadOperator", "unused") 18 | @JvmStatic 19 | fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = 20 | getLazyMessage(key, *params) 21 | } 22 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | # libraries 3 | annotations = "24.0.1" 4 | 5 | # plugins 6 | dokka = "1.8.10" 7 | kotlin = "1.9.22" 8 | changelog = "2.0.0" 9 | gradleIntelliJPlugin = "1.17.2" 10 | qodana = "0.1.13" 11 | kover = "0.6.1" 12 | 13 | [libraries] 14 | annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } 15 | 16 | [plugins] 17 | changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } 18 | dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } 19 | gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } 20 | kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } 21 | kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } 22 | qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } 23 | -------------------------------------------------------------------------------- /src/test/testData/internal_param/InternalParamAfter.kt: -------------------------------------------------------------------------------- 1 | package com.theapache64.rebuggersample 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.material.Text 5 | import com.theapache64.rebugger.Rebugger 6 | import androidx.compose.runtime.Composable 7 | 8 | @Composable 9 | fun MyFunction( 10 | param1: String, 11 | param2: Int 12 | ) { 13 | val state0 by remember { mutableStateOf("") } 14 | Column { 15 | var state1 by remember { mutableStateOf(0) } 16 | Rebugger( 17 | trackMap = mapOf( 18 | "param1" to param1, 19 | "param2" to param2, 20 | "state0" to state0, 21 | "state1" to state1, 22 | ), 23 | ) 24 | Text(text = "Param 1 is $param1 and Params 2 is $param2") 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/kotlin/com/github/theapache64/rebuggerplugin/FuncParamTest.kt: -------------------------------------------------------------------------------- 1 | package com.github.theapache64.rebuggerplugin 2 | 3 | import com.intellij.testFramework.TestDataPath 4 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 5 | import com.intellij.util.PsiErrorElementUtil 6 | import org.jetbrains.kotlin.idea.KotlinFileType 7 | import org.jetbrains.kotlin.psi.KtFile 8 | import org.junit.Test 9 | 10 | @TestDataPath("\$CONTENT_ROOT/src/test/testData") 11 | class FuncParamTest : BasePlatformTestCase() { 12 | 13 | 14 | @Test 15 | fun testInternalParam() { 16 | // loading file 17 | myFixture.configureByFile("FuncParam.kt") 18 | myFixture.testAction(AddRebuggerHereAction()) 19 | myFixture.checkResultByFile("FuncParamAfter.kt") 20 | } 21 | 22 | override fun getTestDataPath() = "src/test/testData/func_param" 23 | } 24 | -------------------------------------------------------------------------------- /src/test/kotlin/com/github/theapache64/rebuggerplugin/ExternalVarsTest.kt: -------------------------------------------------------------------------------- 1 | package com.github.theapache64.rebuggerplugin 2 | 3 | import com.intellij.testFramework.TestDataPath 4 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 5 | import com.intellij.util.PsiErrorElementUtil 6 | import org.jetbrains.kotlin.idea.KotlinFileType 7 | import org.jetbrains.kotlin.psi.KtFile 8 | import org.junit.Test 9 | 10 | @TestDataPath("\$CONTENT_ROOT/src/test/testData") 11 | class ExternalVarsTest : BasePlatformTestCase() { 12 | 13 | @Test 14 | fun testExternalParam() { 15 | // loading file 16 | myFixture.configureByFile("ExternalParam.kt") 17 | myFixture.testAction(AddRebuggerHereAction()) 18 | myFixture.checkResultByFile("ExternalParamAfter.kt") 19 | } 20 | 21 | override fun getTestDataPath() = "src/test/testData/external_param" 22 | } 23 | -------------------------------------------------------------------------------- /src/test/kotlin/com/github/theapache64/rebuggerplugin/InternalVarsTest.kt: -------------------------------------------------------------------------------- 1 | package com.github.theapache64.rebuggerplugin 2 | 3 | import com.intellij.testFramework.TestDataPath 4 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 5 | import com.intellij.util.PsiErrorElementUtil 6 | import org.jetbrains.kotlin.idea.KotlinFileType 7 | import org.jetbrains.kotlin.psi.KtFile 8 | import org.junit.Test 9 | 10 | @TestDataPath("\$CONTENT_ROOT/src/test/testData") 11 | class InternalVarsTest : BasePlatformTestCase() { 12 | 13 | @Test 14 | fun testInternalParam() { 15 | // loading file 16 | myFixture.configureByFile("InternalParam.kt") 17 | myFixture.testAction(AddRebuggerHereAction()) 18 | myFixture.checkResultByFile("InternalParamAfter.kt") 19 | } 20 | 21 | override fun getTestDataPath() = "src/test/testData/internal_param" 22 | } 23 | -------------------------------------------------------------------------------- /src/test/testData/external_param/ExternalParamAfter.kt: -------------------------------------------------------------------------------- 1 | package com.theapache64.rebuggersample 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.material.Text 5 | import com.theapache64.rebugger.Rebugger 6 | import androidx.compose.runtime.Composable 7 | 8 | @Composable 9 | fun MyFunction( 10 | param1: String, 11 | param2: Int, 12 | myClass: MyClass = MyClass() 13 | ) { 14 | val state0 by remember { mutableStateOf("") } 15 | Text(text = "myDirectState is ${myClass.state1}") 16 | val state2 = myClass.state2 + myClass.state3 17 | Rebugger( 18 | trackMap = mapOf( 19 | "param1" to param1, 20 | "param2" to param2, 21 | "myClass" to myClass, 22 | "state0" to state0, 23 | "myClass.state1" to myClass.state1, 24 | "state2" to state2, 25 | ), 26 | ) 27 | Column { 28 | Text(text = "Param 1 is $param1 and Params 2 is $param2") 29 | } 30 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # rebugger-plugin Changelog 4 | 5 | ## [Unreleased] 6 | 7 | ## [0.0.5] - 2023-11-05 8 | - Support all IDE versions 9 | 10 | ## [0.0.4] - 2023-05-07 11 | 12 | ### Added 13 | - Generate `println()` 14 | 15 | ## [0.0.3] - 2023-05-03 16 | 17 | ### Changed 18 | - Code refactor 19 | 20 | ## [0.0.2] - 2023-05-02 21 | 22 | ### Removed 23 | - Unused resources 24 | 25 | ## [0.0.1] - 2023-05-01 26 | 27 | ### Added 28 | - Add `KtCallExpression` support 29 | - Add `KtProperty` support 30 | 31 | [Unreleased]: https://github.com/theapache64/rebugger-plugin/compare/v0.0.5...HEAD 32 | [0.0.5]: https://github.com/theapache64/rebugger-plugin/compare/v0.0.4...v0.0.5 33 | [0.0.4]: https://github.com/theapache64/rebugger-plugin/compare/v0.0.3...v0.0.4 34 | [0.0.3]: https://github.com/theapache64/rebugger-plugin/compare/v0.0.2...v0.0.3 35 | [0.0.2]: https://github.com/theapache64/rebugger-plugin/compare/v0.0.1...v0.0.2 36 | [0.0.1]: https://github.com/theapache64/rebugger-plugin/commits/v0.0.1 37 | -------------------------------------------------------------------------------- /.run/Run IDE for UI Tests.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 15 | 17 | true 18 | true 19 | false 20 | 21 | 22 | -------------------------------------------------------------------------------- /.run/Run IDE with Plugin.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 17 | 19 | true 20 | true 21 | false 22 | 23 | 24 | -------------------------------------------------------------------------------- /.run/Run Plugin Tests.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 17 | 19 | true 20 | true 21 | false 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /.run/Run Qodana.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 16 | 19 | 21 | true 22 | true 23 | false 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/kotlin/com/github/theapache64/rebuggerplugin/PluginUtil.kt: -------------------------------------------------------------------------------- 1 | package com.github.theapache64.rebuggerplugin 2 | 3 | import com.intellij.openapi.application.ApplicationManager 4 | import com.intellij.openapi.command.CommandProcessor 5 | import com.intellij.openapi.command.UndoConfirmationPolicy 6 | import com.intellij.openapi.editor.Document 7 | import com.intellij.openapi.project.Project 8 | import com.intellij.openapi.util.Computable 9 | import java.util.concurrent.atomic.AtomicReference 10 | 11 | 12 | inline fun runOnEdtWithWriteLock(crossinline f: () -> T): T = 13 | runOnEdt { 14 | ApplicationManager.getApplication().runWriteAction(Computable { f() }) 15 | } 16 | 17 | 18 | fun Document.executeCommand(project: Project, description: String? = null, callback: Document.() -> Unit) { 19 | runOnEdtWithWriteLock { 20 | val command = { callback(this) } 21 | CommandProcessor.getInstance().executeCommand(project, command, description, null, 22 | UndoConfirmationPolicy.DEFAULT, this) 23 | } 24 | } 25 | 26 | 27 | inline fun runOnEdt(crossinline f: () -> T): T { 28 | val result = AtomicReference() 29 | ApplicationManager.getApplication().invokeAndWait { 30 | result.set(f()) 31 | } 32 | return result.get() 33 | } -------------------------------------------------------------------------------- /.run/Run Plugin Verification.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 17 | 19 | true 20 | true 21 | false 22 | 23 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.github.theapache64.rebuggerplugin 4 | Rebugger 5 | theapache64 6 | 7 | com.intellij.modules.platform 8 | org.jetbrains.kotlin 9 | 10 | messages.MyBundle 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🔌 rebugger-plugin 2 | 3 | ![Build](https://github.com/theapache64/rebugger-plugin/workflows/Build/badge.svg) 4 | [![Version](https://img.shields.io/jetbrains/plugin/v/21633-rebugger.svg)](https://plugins.jetbrains.com/plugin/21633-rebugger) 5 | [![Downloads](https://img.shields.io/jetbrains/plugin/d/21633-rebugger.svg)](https://plugins.jetbrains.com/plugin/21633-rebugger) 6 | 7 | 8 | IDE plugin to assist [Rebugger](https://github.com/theapache64/rebugger). Read more about it [here](https://github.com/theapache64/rebugger/issues/1) 9 | 10 | 11 | 12 | ## 🎥 Demo 13 | 14 | https://user-images.githubusercontent.com/9678279/235495156-445e7ced-30fa-41dd-9b37-84b80502187f.mov 15 | 16 | ## 📝 License 17 | 18 | ``` 19 | Copyright © 2023 - theapache64 20 | 21 | Licensed under the Apache License, Version 2.0 (the "License"); 22 | you may not use this file except in compliance with the License. 23 | You may obtain a copy of the License at 24 | 25 | http://www.apache.org/licenses/LICENSE-2.0 26 | 27 | Unless required by applicable law or agreed to in writing, software 28 | distributed under the License is distributed on an "AS IS" BASIS, 29 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 30 | See the License for the specific language governing permissions and 31 | limitations under the License. 32 | ``` 33 | 34 | _This README was generated by [readgen](https://github.com/theapache64/readgen)_ ❤ 35 | -------------------------------------------------------------------------------- /.github/workflows/run-ui-tests.yml: -------------------------------------------------------------------------------- 1 | # GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps: 2 | # - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI 3 | # - wait for IDE to start 4 | # - run UI tests with separate Gradle task 5 | # 6 | # Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform 7 | # 8 | # Workflow is triggered manually. 9 | 10 | name: Run UI Tests 11 | on: 12 | workflow_dispatch 13 | 14 | jobs: 15 | 16 | testUI: 17 | runs-on: ${{ matrix.os }} 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | include: 22 | - os: ubuntu-latest 23 | runIde: | 24 | export DISPLAY=:99.0 25 | Xvfb -ac :99 -screen 0 1920x1080x16 & 26 | gradle runIdeForUiTests & 27 | - os: windows-latest 28 | runIde: start gradlew.bat runIdeForUiTests 29 | - os: macos-latest 30 | runIde: ./gradlew runIdeForUiTests & 31 | 32 | steps: 33 | 34 | # Check out current repository 35 | - name: Fetch Sources 36 | uses: actions/checkout@v4 37 | 38 | # Setup Java 11 environment for the next steps 39 | - name: Setup Java 40 | uses: actions/setup-java@v4 41 | with: 42 | distribution: zulu 43 | java-version: 11 44 | 45 | # Run IDEA prepared for UI testing 46 | - name: Run IDE 47 | run: ${{ matrix.runIde }} 48 | 49 | # Wait for IDEA to be started 50 | - name: Health Check 51 | uses: jtalk/url-health-check-action@v4 52 | with: 53 | url: http://127.0.0.1:8082 54 | max-attempts: 15 55 | retry-delay: 30s 56 | 57 | # Run tests 58 | - name: Tests 59 | run: ./gradlew test 60 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html 2 | 3 | pluginGroup = com.github.theapache64.rebuggerplugin 4 | pluginName = Rebugger 5 | pluginRepositoryUrl = https://github.com/theapache64/rebugger-plugin 6 | # SemVer format -> https://semver.org 7 | # [latest version - i promise!] 8 | pluginVersion = 0.0.8 9 | 10 | # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 11 | pluginSinceBuild = 221 12 | 13 | # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension 14 | platformType = IC 15 | platformVersion = 2022.1.4 16 | 17 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 18 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 19 | platformPlugins =org.jetbrains.kotlin 20 | 21 | # Gradle Releases -> https://github.com/gradle/gradle/releases 22 | gradleVersion = 8.1 23 | 24 | # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib 25 | kotlin.stdlib.default.dependency = false 26 | 27 | # Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html 28 | org.gradle.configuration-cache = true 29 | 30 | # Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html 31 | org.gradle.caching = true 32 | 33 | # Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment 34 | systemProp.org.gradle.unsafe.kotlin.assignment = true 35 | 36 | # Temporary workaround for Kotlin Compiler OutOfMemoryError -> https://jb.gg/intellij-platform-kotlin-oom 37 | kotlin.incremental.useClasspathSnapshot = false 38 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | # GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow. 2 | # Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN. 3 | # See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information. 4 | 5 | name: Release 6 | on: 7 | release: 8 | types: [prereleased, released] 9 | 10 | jobs: 11 | 12 | # Prepare and publish the plugin to the Marketplace repository 13 | release: 14 | name: Publish Plugin 15 | runs-on: ubuntu-latest 16 | permissions: 17 | contents: write 18 | pull-requests: write 19 | steps: 20 | 21 | # Check out current repository 22 | - name: Fetch Sources 23 | uses: actions/checkout@v4 24 | with: 25 | ref: ${{ github.event.release.tag_name }} 26 | 27 | # Setup Java 11 environment for the next steps 28 | - name: Setup Java 29 | uses: actions/setup-java@v4 30 | with: 31 | distribution: zulu 32 | java-version: 11 33 | 34 | # Set environment variables 35 | - name: Export Properties 36 | id: properties 37 | shell: bash 38 | run: | 39 | CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' 40 | ${{ github.event.release.body }} 41 | EOM 42 | )" 43 | 44 | echo "changelog<> $GITHUB_OUTPUT 45 | echo "$CHANGELOG" >> $GITHUB_OUTPUT 46 | echo "EOF" >> $GITHUB_OUTPUT 47 | 48 | # Update Unreleased section with the current release note 49 | - name: Patch Changelog 50 | if: ${{ steps.properties.outputs.changelog != '' }} 51 | env: 52 | CHANGELOG: ${{ steps.properties.outputs.changelog }} 53 | run: | 54 | ./gradlew patchChangelog --release-note="$CHANGELOG" 55 | 56 | # Publish the plugin to the Marketplace 57 | - name: Publish Plugin 58 | env: 59 | PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} 60 | CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} 61 | PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} 62 | PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} 63 | run: ./gradlew publishPlugin 64 | 65 | # Upload artifact as a release asset 66 | - name: Upload Release Asset 67 | env: 68 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 69 | run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* 70 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /src/main/kotlin/com/github/theapache64/rebuggerplugin/GeneratePrintLnHereAction.kt: -------------------------------------------------------------------------------- 1 | package com.github.theapache64.rebuggerplugin 2 | 3 | import com.intellij.openapi.actionSystem.AnAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.actionSystem.CommonDataKeys 6 | import com.intellij.openapi.editor.Caret 7 | import com.intellij.openapi.util.TextRange 8 | import com.intellij.psi.impl.source.tree.LeafPsiElement 9 | import com.intellij.psi.util.childrenOfType 10 | import org.jetbrains.kotlin.psi.KtFile 11 | import org.jetbrains.kotlin.psi.KtParameter 12 | import org.jetbrains.kotlin.psi.KtParameterList 13 | import org.jetbrains.kotlin.psi.KtProperty 14 | import org.jetbrains.kotlin.psi.psiUtil.elementsInRange 15 | 16 | 17 | private val Caret.selectionRange: TextRange 18 | get() { 19 | return TextRange.create(this.selectionStart, this.selectionEnd); 20 | } 21 | 22 | /** 23 | * A common utility for routine debugging. Not related to compose. 24 | * This action extracts variables from selected code and generates a `println` statement (similar to Rebugger). 25 | * 26 | * Enjoy :) 27 | */ 28 | class GeneratePrintLnHereAction : AnAction() { 29 | 30 | override fun actionPerformed(event: AnActionEvent) { 31 | val project = event.project ?: return 32 | val editor = event.getData(CommonDataKeys.EDITOR) ?: return 33 | val ktFile = event.getData(CommonDataKeys.PSI_FILE) as? KtFile ?: return 34 | val offset = editor.caretModel.currentCaret.selectionEnd 35 | 36 | val trackSet = mutableSetOf() 37 | ktFile.elementsInRange(editor.caretModel.currentCaret.selectionRange).forEach { 38 | when (it) { 39 | is KtParameterList ->{ 40 | it.parameters.mapNotNull { arg -> arg.name }.forEach { argName -> 41 | trackSet.add(argName) 42 | } 43 | } 44 | 45 | is KtParameter -> { 46 | it.name?.let { paramName -> trackSet.add(paramName) } 47 | } 48 | 49 | is KtProperty -> { 50 | it.childrenOfType().find { leafPsiElement -> 51 | leafPsiElement.elementType.toString() == "IDENTIFIER" 52 | }?.text?.let { valName -> 53 | trackSet.add(valName) 54 | } 55 | } 56 | } 57 | } 58 | 59 | // Adding code block 60 | editor.document.executeCommand(project, description = "Generate println()") { 61 | 62 | // Write code block 63 | val trackMap = StringBuilder().apply { 64 | for (varName in trackSet) { 65 | this.append("\"$varName\" to $varName,\n") 66 | } 67 | } 68 | 69 | val println = "\nprintln(mapOf($trackMap))" 70 | insertString(offset, println) 71 | val codeStyleManager = com.intellij.psi.codeStyle.CodeStyleManager.getInstance(project) 72 | codeStyleManager.reformatText(ktFile, offset, offset + println.length) 73 | } 74 | } 75 | 76 | override fun update(event: AnActionEvent) { 77 | val file = event.getData(CommonDataKeys.VIRTUAL_FILE) 78 | val isKotlinFile = file?.extension == "kt" 79 | val editor = event.getData(CommonDataKeys.EDITOR) ?: return 80 | val hasSelection = editor.caretModel.currentCaret.let { 81 | it.selectionStart != it.selectionEnd 82 | } 83 | event.presentation.isEnabledAndVisible = isKotlinFile && hasSelection 84 | } 85 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/kotlin,intellij,gradle 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=kotlin,intellij,gradle 3 | 4 | ### Intellij ### 5 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 6 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 7 | 8 | # User-specific stuff 9 | .idea/**/workspace.xml 10 | .idea/**/tasks.xml 11 | .idea/**/usage.statistics.xml 12 | .idea/**/dictionaries 13 | .idea/**/shelf 14 | 15 | # AWS User-specific 16 | .idea/**/aws.xml 17 | 18 | # Generated files 19 | .idea/**/contentModel.xml 20 | 21 | # Sensitive or high-churn files 22 | .idea/**/dataSources/ 23 | .idea/**/dataSources.ids 24 | .idea/**/dataSources.local.xml 25 | .idea/**/sqlDataSources.xml 26 | .idea/**/dynamic.xml 27 | .idea/**/uiDesigner.xml 28 | .idea/**/dbnavigator.xml 29 | 30 | # Gradle 31 | .idea/**/gradle.xml 32 | .idea/**/libraries 33 | 34 | # Gradle and Maven with auto-import 35 | # When using Gradle or Maven with auto-import, you should exclude module files, 36 | # since they will be recreated, and may cause churn. Uncomment if using 37 | # auto-import. 38 | # .idea/artifacts 39 | # .idea/compiler.xml 40 | # .idea/jarRepositories.xml 41 | # .idea/modules.xml 42 | # .idea/*.iml 43 | # .idea/modules 44 | # *.iml 45 | # *.ipr 46 | 47 | # CMake 48 | cmake-build-*/ 49 | 50 | # Mongo Explorer plugin 51 | .idea/**/mongoSettings.xml 52 | 53 | # File-based project format 54 | *.iws 55 | 56 | # IntelliJ 57 | out/ 58 | 59 | # mpeltonen/sbt-idea plugin 60 | .idea_modules/ 61 | 62 | # JIRA plugin 63 | atlassian-ide-plugin.xml 64 | 65 | # Cursive Clojure plugin 66 | .idea/replstate.xml 67 | 68 | # SonarLint plugin 69 | .idea/sonarlint/ 70 | 71 | # Crashlytics plugin (for Android Studio and IntelliJ) 72 | com_crashlytics_export_strings.xml 73 | crashlytics.properties 74 | crashlytics-build.properties 75 | fabric.properties 76 | 77 | # Editor-based Rest Client 78 | .idea/httpRequests 79 | 80 | # Android studio 3.1+ serialized cache file 81 | .idea/caches/build_file_checksums.ser 82 | 83 | ### Intellij Patch ### 84 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 85 | 86 | # *.iml 87 | # modules.xml 88 | # .idea/misc.xml 89 | # *.ipr 90 | 91 | # Sonarlint plugin 92 | # https://plugins.jetbrains.com/plugin/7973-sonarlint 93 | .idea/**/sonarlint/ 94 | 95 | # SonarQube Plugin 96 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin 97 | .idea/**/sonarIssues.xml 98 | 99 | # Markdown Navigator plugin 100 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced 101 | .idea/**/markdown-navigator.xml 102 | .idea/**/markdown-navigator-enh.xml 103 | .idea/**/markdown-navigator/ 104 | 105 | # Cache file creation bug 106 | # See https://youtrack.jetbrains.com/issue/JBR-2257 107 | .idea/$CACHE_FILE$ 108 | 109 | # CodeStream plugin 110 | # https://plugins.jetbrains.com/plugin/12206-codestream 111 | .idea/codestream.xml 112 | 113 | # Azure Toolkit for IntelliJ plugin 114 | # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij 115 | .idea/**/azureSettings.xml 116 | 117 | ### Kotlin ### 118 | # Compiled class file 119 | *.class 120 | 121 | # Log file 122 | *.log 123 | 124 | # BlueJ files 125 | *.ctxt 126 | 127 | # Mobile Tools for Java (J2ME) 128 | .mtj.tmp/ 129 | 130 | # Package Files # 131 | *.jar 132 | *.war 133 | *.nar 134 | *.ear 135 | *.zip 136 | *.tar.gz 137 | *.rar 138 | 139 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 140 | hs_err_pid* 141 | replay_pid* 142 | 143 | ### Gradle ### 144 | .gradle 145 | **/build/ 146 | !src/**/build/ 147 | 148 | # Ignore Gradle GUI config 149 | gradle-app.setting 150 | 151 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 152 | !gradle-wrapper.jar 153 | 154 | # Avoid ignore Gradle wrappper properties 155 | !gradle-wrapper.properties 156 | 157 | # Cache of project 158 | .gradletasknamecache 159 | 160 | # Eclipse Gradle plugin generated files 161 | # Eclipse Core 162 | .project 163 | # JDT-specific (Eclipse Java Development Tools) 164 | .classpath 165 | 166 | ### Gradle Patch ### 167 | # Java heap dump 168 | *.hprof 169 | 170 | # End of https://www.toptal.com/developers/gitignore/api/kotlin,intellij,gradle 171 | build 172 | gpm.json 173 | 174 | .idea 175 | .qodana 176 | *.DS_Store -------------------------------------------------------------------------------- /src/main/kotlin/com/github/theapache64/rebuggerplugin/AddRebuggerHereAction.kt: -------------------------------------------------------------------------------- 1 | package com.github.theapache64.rebuggerplugin 2 | 3 | import com.intellij.application.options.CodeStyle.getIndentOptions 4 | import com.intellij.openapi.actionSystem.AnAction 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | import com.intellij.openapi.actionSystem.CommonDataKeys 7 | import com.intellij.psi.PsiElement 8 | import com.intellij.psi.codeStyle.CodeStyleManager 9 | import com.intellij.psi.impl.source.tree.LeafPsiElement 10 | import com.intellij.psi.util.childrenOfType 11 | import com.intellij.psi.util.parentOfType 12 | import com.intellij.refactoring.suggested.startOffset 13 | import org.jetbrains.kotlin.psi.* 14 | 15 | class AddRebuggerHereAction : AnAction() { 16 | override fun actionPerformed(event: AnActionEvent) { 17 | val project = event.project ?: return 18 | val editor = event.getData(CommonDataKeys.EDITOR) ?: return 19 | val ktFile = event.getData(CommonDataKeys.PSI_FILE) as? KtFile ?: return 20 | val offset = editor.caretModel.offset 21 | val currentElement = ktFile.findElementAt(offset) 22 | val function = currentElement?.parentOfType() ?: return 23 | 24 | val trackSet = mutableSetOf() 25 | 26 | // Adding function argument 27 | function.valueParameters.mapNotNull { it.name }.toSet().let { argSet -> 28 | trackSet.addAll(argSet) 29 | } 30 | 31 | function.bodyBlockExpression?.let { processElementsRecursively(it, offset, trackSet) } 32 | 33 | // Adding code block 34 | editor.document.executeCommand(project, description = "Add Rebugger Call") { 35 | 36 | // Write code block 37 | val trackMap = StringBuilder().apply { 38 | for (varName in trackSet) { 39 | this.append("\"$varName\" to $varName,\n") 40 | } 41 | } 42 | 43 | val rebuggerCall = "Rebugger(trackMap=mapOf($trackMap),)" 44 | insertString(offset, rebuggerCall) 45 | val codeStyleManager = CodeStyleManager.getInstance(project).apply { 46 | getIndentOptions(ktFile).apply { 47 | CONTINUATION_INDENT_SIZE = 4 48 | INDENT_SIZE = 4 49 | } 50 | } 51 | codeStyleManager.reformatText(ktFile, offset, offset + rebuggerCall.length) 52 | 53 | // Add import statement 54 | val classToImport = "com.theapache64.rebugger.Rebugger" 55 | if (!ktFile.hasImport(classToImport)) { 56 | // Hack due to https://twitter.com/theapache64/status/1644815369947824130 57 | val fileContent = ktFile.text 58 | val lastImportIndex = fileContent.lastIndexOf("import ") 59 | insertString(lastImportIndex, "import $classToImport\n") 60 | } 61 | } 62 | } 63 | 64 | private fun processElementsRecursively( 65 | element: PsiElement, 66 | offset: Int, 67 | trackSet: MutableSet 68 | ) { 69 | 70 | if (element.startOffset < offset) { 71 | when (element) { 72 | is KtCallExpression -> { 73 | element.valueArguments.forEach { arg -> 74 | // capturing string template : eg: "Data is $data" 75 | arg.stringTemplateExpression?.let { stringTemplate -> 76 | stringTemplate.childrenOfType() 77 | .forEach { longString -> 78 | longString.childrenOfType() 79 | .forEach { dotQualified -> 80 | trackSet.add(dotQualified.text) 81 | } 82 | } 83 | } 84 | 85 | // capturing string template : eg: "Data is ${data.message}" 86 | arg.childrenOfType() 87 | .forEach { dotQualified -> 88 | trackSet.add(dotQualified.text) 89 | } 90 | } 91 | } 92 | 93 | is KtProperty -> { 94 | // Getting var/val property names 95 | element.childrenOfType().find { leafPsiElement -> 96 | leafPsiElement.elementType.toString() == "IDENTIFIER" 97 | }?.text?.let { valName -> 98 | trackSet.add(valName) 99 | } 100 | } 101 | } 102 | } 103 | 104 | // Adding states between function header and cursor 105 | element.children.forEach { child -> 106 | processElementsRecursively(child, offset, trackSet) 107 | } 108 | } 109 | 110 | 111 | private fun KtFile.hasImport(classToImport: String): Boolean { 112 | return importDirectives.find { it.text.contains(classToImport) } != null 113 | } 114 | 115 | override fun update(event: AnActionEvent) { 116 | val file = event.getData(CommonDataKeys.VIRTUAL_FILE) 117 | val isKotlinFile = file?.extension == "kt" 118 | val editor = event.getData(CommonDataKeys.EDITOR) 119 | val hasSelection = editor?.caretModel?.currentCaret?.let { 120 | it.selectionStart != it.selectionEnd 121 | } ?: false 122 | event.presentation.isEnabledAndVisible = isKotlinFile && !hasSelection && editor != null 123 | } 124 | } -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: 2 | # - validate Gradle Wrapper, 3 | # - run 'test' and 'verifyPlugin' tasks, 4 | # - run Qodana inspections, 5 | # - run 'buildPlugin' task and prepare artifact for the further tests, 6 | # - run 'runPluginVerifier' task, 7 | # - create a draft release. 8 | # 9 | # Workflow is triggered on push and pull_request events. 10 | # 11 | # GitHub Actions reference: https://help.github.com/en/actions 12 | # 13 | ## JBIJPPTPL 14 | 15 | name: Build 16 | on: 17 | # Trigger the workflow on tag creation 18 | push: 19 | tags: 20 | - 'v*' 21 | # Trigger the workflow on any pull request 22 | pull_request: 23 | 24 | jobs: 25 | 26 | # Run Gradle Wrapper Validation Action to verify the wrapper's checksum 27 | # Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks 28 | # Build plugin and provide the artifact for the next workflow jobs 29 | build: 30 | name: Build 31 | runs-on: ubuntu-latest 32 | outputs: 33 | version: ${{ steps.properties.outputs.version }} 34 | changelog: ${{ steps.properties.outputs.changelog }} 35 | steps: 36 | 37 | # Free GitHub Actions Environment Disk Space 38 | - name: Maximize Build Space 39 | run: | 40 | sudo rm -rf /usr/share/dotnet 41 | sudo rm -rf /usr/local/lib/android 42 | sudo rm -rf /opt/ghc 43 | 44 | # Check out current repository 45 | - name: Fetch Sources 46 | uses: actions/checkout@v4 47 | 48 | # Validate wrapper 49 | - name: Gradle Wrapper Validation 50 | uses: gradle/wrapper-validation-action@v2 51 | 52 | # Setup Java 11 environment for the next steps 53 | - name: Setup Java 54 | uses: actions/setup-java@v4 55 | with: 56 | distribution: zulu 57 | java-version: 11 58 | 59 | # Set environment variables 60 | - name: Export Properties 61 | id: properties 62 | shell: bash 63 | run: | 64 | PROPERTIES="$(./gradlew properties --console=plain -q)" 65 | VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" 66 | NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')" 67 | CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" 68 | 69 | echo "version=$VERSION" >> $GITHUB_OUTPUT 70 | echo "name=$NAME" >> $GITHUB_OUTPUT 71 | echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT 72 | 73 | echo "changelog<> $GITHUB_OUTPUT 74 | echo "$CHANGELOG" >> $GITHUB_OUTPUT 75 | echo "EOF" >> $GITHUB_OUTPUT 76 | 77 | ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier 78 | 79 | # Run tests 80 | - name: Run Tests 81 | run: ./gradlew check 82 | 83 | # Collect Tests Result of failed tests 84 | - name: Collect Tests Result 85 | if: ${{ failure() }} 86 | uses: actions/upload-artifact@v4 87 | with: 88 | name: tests-result 89 | path: ${{ github.workspace }}/build/reports/tests 90 | 91 | # Upload Kover report to CodeCov 92 | - name: Upload Code Coverage Report 93 | uses: codecov/codecov-action@v4 94 | with: 95 | files: ${{ github.workspace }}/build/reports/kover/xml/report.xml 96 | 97 | # Cache Plugin Verifier IDEs 98 | - name: Setup Plugin Verifier IDEs Cache 99 | uses: actions/cache@v4 100 | with: 101 | path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides 102 | key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} 103 | 104 | # Run Verify Plugin task and IntelliJ Plugin Verifier tool 105 | - name: Run Plugin Verification tasks 106 | run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} 107 | 108 | # Collect Plugin Verifier Result 109 | - name: Collect Plugin Verifier Result 110 | if: ${{ always() }} 111 | uses: actions/upload-artifact@v4 112 | with: 113 | name: pluginVerifier-result 114 | path: ${{ github.workspace }}/build/reports/pluginVerifier 115 | 116 | # Prepare plugin archive content for creating artifact 117 | - name: Prepare Plugin Artifact 118 | id: artifact 119 | shell: bash 120 | run: | 121 | cd ${{ github.workspace }}/build/distributions 122 | FILENAME=`ls *.zip` 123 | unzip "$FILENAME" -d content 124 | 125 | echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT 126 | 127 | # Store already-built plugin as an artifact for downloading 128 | - name: Upload artifact 129 | uses: actions/upload-artifact@v4 130 | with: 131 | name: ${{ steps.artifact.outputs.filename }} 132 | path: ./build/distributions/content/*/* 133 | 134 | # Prepare a draft release for GitHub Releases page for the manual verification 135 | # If accepted and published, release workflow would be triggered 136 | releaseDraft: 137 | name: Release Draft 138 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') 139 | needs: build 140 | runs-on: ubuntu-latest 141 | permissions: 142 | contents: write 143 | steps: 144 | 145 | # Check out current repository 146 | - name: Fetch Sources 147 | uses: actions/checkout@v4 148 | 149 | # Remove old release drafts by using the curl request for the available releases with a draft flag 150 | - name: Remove Old Release Drafts 151 | env: 152 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 153 | run: | 154 | gh api repos/{owner}/{repo}/releases \ 155 | --jq '.[] | select(.draft == true) | .id' \ 156 | | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} 157 | 158 | # Create a new release draft which is not publicly visible and requires manual acceptance 159 | - name: Create Release Draft 160 | env: 161 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 162 | run: | 163 | gh release create v${{ needs.build.outputs.version }} \ 164 | --draft \ 165 | --title "v${{ needs.build.outputs.version }}" \ 166 | --notes "$(cat << 'EOM' 167 | ${{ needs.build.outputs.changelog }} 168 | EOM 169 | )" 170 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Use the maximum available, or set MAX_FD != -1 to use that value. 89 | MAX_FD=maximum 90 | 91 | warn () { 92 | echo "$*" 93 | } >&2 94 | 95 | die () { 96 | echo 97 | echo "$*" 98 | echo 99 | exit 1 100 | } >&2 101 | 102 | # OS specific support (must be 'true' or 'false'). 103 | cygwin=false 104 | msys=false 105 | darwin=false 106 | nonstop=false 107 | case "$( uname )" in #( 108 | CYGWIN* ) cygwin=true ;; #( 109 | Darwin* ) darwin=true ;; #( 110 | MSYS* | MINGW* ) msys=true ;; #( 111 | NONSTOP* ) nonstop=true ;; 112 | esac 113 | 114 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 115 | 116 | 117 | # Determine the Java command to use to start the JVM. 118 | if [ -n "$JAVA_HOME" ] ; then 119 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 120 | # IBM's JDK on AIX uses strange locations for the executables 121 | JAVACMD=$JAVA_HOME/jre/sh/java 122 | else 123 | JAVACMD=$JAVA_HOME/bin/java 124 | fi 125 | if [ ! -x "$JAVACMD" ] ; then 126 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 127 | 128 | Please set the JAVA_HOME variable in your environment to match the 129 | location of your Java installation." 130 | fi 131 | else 132 | JAVACMD=java 133 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 134 | 135 | Please set the JAVA_HOME variable in your environment to match the 136 | location of your Java installation." 137 | fi 138 | 139 | # Increase the maximum file descriptors if we can. 140 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 141 | case $MAX_FD in #( 142 | max*) 143 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 144 | # shellcheck disable=SC3045 145 | MAX_FD=$( ulimit -H -n ) || 146 | warn "Could not query maximum file descriptor limit" 147 | esac 148 | case $MAX_FD in #( 149 | '' | soft) :;; #( 150 | *) 151 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 152 | # shellcheck disable=SC3045 153 | ulimit -n "$MAX_FD" || 154 | warn "Could not set maximum file descriptor limit to $MAX_FD" 155 | esac 156 | fi 157 | 158 | # Collect all arguments for the java command, stacking in reverse order: 159 | # * args from the command line 160 | # * the main class name 161 | # * -classpath 162 | # * -D...appname settings 163 | # * --module-path (only if needed) 164 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 165 | 166 | # For Cygwin or MSYS, switch paths to Windows format before running java 167 | if "$cygwin" || "$msys" ; then 168 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 169 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 170 | 171 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 172 | 173 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 174 | for arg do 175 | if 176 | case $arg in #( 177 | -*) false ;; # don't mess with options #( 178 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 179 | [ -e "$t" ] ;; #( 180 | *) false ;; 181 | esac 182 | then 183 | arg=$( cygpath --path --ignore --mixed "$arg" ) 184 | fi 185 | # Roll the args list around exactly as many times as the number of 186 | # args, so each arg winds up back in the position where it started, but 187 | # possibly modified. 188 | # 189 | # NB: a `for` loop captures its iteration list before it begins, so 190 | # changing the positional parameters here affects neither the number of 191 | # iterations, nor the values presented in `arg`. 192 | shift # remove old arg 193 | set -- "$@" "$arg" # push replacement arg 194 | done 195 | fi 196 | 197 | 198 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 199 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 200 | 201 | # Collect all arguments for the java command; 202 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 203 | # shell script including quotes and variable substitutions, so put them in 204 | # double quotes to make sure that they get re-expanded; and 205 | # * put everything else in single quotes, so that it's not re-expanded. 206 | 207 | set -- \ 208 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 209 | -classpath "$CLASSPATH" \ 210 | org.gradle.wrapper.GradleWrapperMain \ 211 | "$@" 212 | 213 | # Stop when "xargs" is not available. 214 | if ! command -v xargs >/dev/null 2>&1 215 | then 216 | die "xargs is not available" 217 | fi 218 | 219 | # Use "xargs" to parse quoted args. 220 | # 221 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 222 | # 223 | # In Bash we could simply go: 224 | # 225 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 226 | # set -- "${ARGS[@]}" "$@" 227 | # 228 | # but POSIX shell has neither arrays nor command substitution, so instead we 229 | # post-process each arg (as a line of input to sed) to backslash-escape any 230 | # character that might be a shell metacharacter, then use eval to reverse 231 | # that process (while maintaining the separation between arguments), and wrap 232 | # the whole thing up as a single "set" statement. 233 | # 234 | # This will of course break if any of these variables contains a newline or 235 | # an unmatched quote. 236 | # 237 | 238 | eval "set -- $( 239 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 240 | xargs -n1 | 241 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 242 | tr '\n' ' ' 243 | )" '"$@"' 244 | 245 | exec "$JAVACMD" "$@" 246 | --------------------------------------------------------------------------------