From 2887334f0f38cafd21e97d7ed5644fc1c0f69ee6 Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Fri, 2 Aug 2024 16:31:09 +0300 Subject: [PATCH 1/4] drop 233 --- .github/workflows/check.yml | 2 +- gradle-233.properties | 13 ------------- gradle.properties | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 gradle-233.properties diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2f9453a35..9f956dffd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,7 +10,7 @@ jobs: tests: strategy: matrix: - gradle-properties-version: [ 233, 241, 242 ] + gradle-properties-version: [ 241, 242 ] runs-on: ubuntu-latest env: diff --git a/gradle-233.properties b/gradle-233.properties deleted file mode 100644 index f3bb537d3..000000000 --- a/gradle-233.properties +++ /dev/null @@ -1,13 +0,0 @@ -# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -# for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild = 233 -pluginUntilBuild = 233.* - -# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties -platformType = PC -platformVersion = 2023.3 - -# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html -# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 -platformPlugins = org.toml.lang -verifierIdeVersion = PC-2023.3 diff --git a/gradle.properties b/gradle.properties index 522f940f3..b3e6d4790 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,6 +18,6 @@ jbrVersion=17.0.7b1000.6 propertiesPluginEnvironmentNameProperty=shortPlatformVersion # properties files # pass ORG_GRADLE_PROJECT_shortPlatformVersion environment variable to overwrite -shortPlatformVersion=233 +shortPlatformVersion=241 useInstaller=true From 9e21455187a3e8a68832d0032218ecc67d28e03a Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Fri, 2 Aug 2024 16:50:22 +0300 Subject: [PATCH 2/4] fix deprecations --- .github/workflows/publish-eap.yml | 4 ++-- build.gradle.kts | 5 +++-- gradle.properties | 2 +- .../move/ide/hints/DeclarationRangeHandler.kt | 2 +- .../lang/core/resolve/ref/MvResolveCache.kt | 5 ++--- src/main/kotlin/org/move/openapiext/ui.kt | 20 ++----------------- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.github/workflows/publish-eap.yml b/.github/workflows/publish-eap.yml index e0f5c10d4..c72c21d6d 100644 --- a/.github/workflows/publish-eap.yml +++ b/.github/workflows/publish-eap.yml @@ -29,7 +29,7 @@ jobs: needs: [ check-for-tests-success ] strategy: matrix: - gradle-properties-version: [ 233, 241 ] + gradle-properties-version: [ 241, 242 ] runs-on: ubuntu-latest env: @@ -71,7 +71,7 @@ jobs: uses: gradle/gradle-build-action@v2.7.0 with: gradle-version: wrapper - arguments: ":plugin:publishPlugin -Pkotlin.incremental=false --no-daemon --stacktrace" + arguments: ":publishPlugin -Pkotlin.incremental=false --no-daemon --stacktrace" gradle-home-cache-excludes: | caches/modules-2/files-2.1/com.jetbrains.intellij.pycharm caches/modules-2/files-2.1/com.jetbrains.intellij.idea diff --git a/build.gradle.kts b/build.gradle.kts index b1855e276..f400a72ac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,10 +55,11 @@ if (publishingChannel != "default") { } val pluginGroup = "org.move" -val javaVersion = JavaVersion.VERSION_17 val pluginName = "intellij-move" val pluginJarName = "intellij-move-$pluginVersion" +val javaVersion = JavaVersion.VERSION_17 +//val javaVersion = if (shortPlatformVersion == "241") JavaVersion.VERSION_17 else JavaVersion.VERSION_21 val kotlinReflectVersion = "1.9.10" val aptosVersion = "3.4.1" @@ -69,7 +70,7 @@ version = pluginVersion plugins { id("java") - kotlin("jvm") version "1.9.22" + kotlin("jvm") version "1.9.25" id("org.jetbrains.intellij.platform") version "2.0.0" id("org.jetbrains.grammarkit") version "2022.3.2.2" id("net.saliman.properties") version "1.5.2" diff --git a/gradle.properties b/gradle.properties index b3e6d4790..4069694ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,6 +18,6 @@ jbrVersion=17.0.7b1000.6 propertiesPluginEnvironmentNameProperty=shortPlatformVersion # properties files # pass ORG_GRADLE_PROJECT_shortPlatformVersion environment variable to overwrite -shortPlatformVersion=241 +shortPlatformVersion=242 useInstaller=true diff --git a/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt b/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt index 557157096..1460f997c 100644 --- a/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt +++ b/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt @@ -4,7 +4,7 @@ import com.intellij.codeInsight.hint.DeclarationRangeHandler import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiComment import com.intellij.psi.PsiElement -import com.intellij.refactoring.suggested.startOffset +import com.intellij.psi.util.startOffset import org.move.lang.core.psi.MvFunction import org.move.lang.core.psi.MvModule import org.move.lang.core.psi.ext.endOffset diff --git a/src/main/kotlin/org/move/lang/core/resolve/ref/MvResolveCache.kt b/src/main/kotlin/org/move/lang/core/resolve/ref/MvResolveCache.kt index d9314569d..b6a6a8a8b 100644 --- a/src/main/kotlin/org/move/lang/core/resolve/ref/MvResolveCache.kt +++ b/src/main/kotlin/org/move/lang/core/resolve/ref/MvResolveCache.kt @@ -10,7 +10,7 @@ package org.move.lang.core.resolve.ref import com.intellij.injected.editor.VirtualFileWindow import com.intellij.openapi.Disposable import com.intellij.openapi.components.Service -import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service import com.intellij.openapi.progress.ProgressManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.Key @@ -190,8 +190,7 @@ class MvResolveCache(project: Project) : Disposable { } companion object { - fun getInstance(project: Project): MvResolveCache = - ServiceManager.getService(project, MvResolveCache::class.java) + fun getInstance(project: Project): MvResolveCache = project.service() } } diff --git a/src/main/kotlin/org/move/openapiext/ui.kt b/src/main/kotlin/org/move/openapiext/ui.kt index ca2d7445f..a9e837624 100644 --- a/src/main/kotlin/org/move/openapiext/ui.kt +++ b/src/main/kotlin/org/move/openapiext/ui.kt @@ -31,13 +31,14 @@ class UiDebouncer( * @param onUiThread: callback to be executed in EDT with **any** modality state. * Use it only for UI updates */ - @Suppress("DEPRECATION") fun update(onPooledThread: () -> T, onUiThread: (T) -> Unit) { + @Suppress("DEPRECATION") if (Disposer.isDisposed(parentDisposable)) return alarm.cancelAllRequests() alarm.addRequest({ val r = onPooledThread() invokeLater(ModalityState.any()) { + @Suppress("DEPRECATION") if (!Disposer.isDisposed(parentDisposable)) { onUiThread(r) } @@ -75,23 +76,6 @@ fun JTextField.addTextChangeListener(listener: (DocumentEvent) -> Unit) { ) } -fun selectElement(element: MvElement, editor: Editor) { - val start = element.textRange.startOffset - val unwrappedEditor = editor -// val unwrappedEditor = if (editor is RsIntentionInsideMacroExpansionEditor && element.containingFile != editor.psiFileCopy) { -// if (element.containingFile != editor.originalFile) return -// editor.originalEditor -// } else { -// editor -// } - unwrappedEditor.caretModel.moveToOffset(start) - unwrappedEditor.scrollingModel.scrollToCaret(ScrollType.RELATIVE) - unwrappedEditor.selectionModel.setSelection(start, element.textRange.endOffset) -} - fun Row.fullWidthCell(component: T): Cell { return cell(component).align(AlignX.FILL) } - -val JBTextField.trimmedText: String - get() = text.trim() \ No newline at end of file From c9b6fe065880b6cfb74284ee0d1c7fd6617e11e6 Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Fri, 2 Aug 2024 16:55:45 +0300 Subject: [PATCH 3/4] oldest version as default --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4069694ba..b3e6d4790 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,6 +18,6 @@ jbrVersion=17.0.7b1000.6 propertiesPluginEnvironmentNameProperty=shortPlatformVersion # properties files # pass ORG_GRADLE_PROJECT_shortPlatformVersion environment variable to overwrite -shortPlatformVersion=242 +shortPlatformVersion=241 useInstaller=true From 5f6e02dea9dc709a70def3822872b87cae3b810f Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Fri, 2 Aug 2024 17:11:03 +0300 Subject: [PATCH 4/4] fix deprecation --- .../move/ide/hints/DeclarationRangeHandler.kt | 2 +- .../TestCommandConfigurationProducerTest.kt | 2 +- .../ide/actions/CreateMoveFileActionTest.kt | 5 ++--- .../org/move/utils/tests/MvProjectTestBase.kt | 20 ++++++++++--------- .../tests/RunConfigurationProducerTestBase.kt | 5 +++-- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt b/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt index 1460f997c..a833bf71f 100644 --- a/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt +++ b/src/main/kotlin/org/move/ide/hints/DeclarationRangeHandler.kt @@ -4,11 +4,11 @@ import com.intellij.codeInsight.hint.DeclarationRangeHandler import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiComment import com.intellij.psi.PsiElement -import com.intellij.psi.util.startOffset import org.move.lang.core.psi.MvFunction import org.move.lang.core.psi.MvModule import org.move.lang.core.psi.ext.endOffset import org.move.lang.core.psi.ext.getPrevNonCommentSibling +import org.move.lang.core.psi.ext.startOffset class ModuleDeclarationRangeHandler : DeclarationRangeHandler { override fun getDeclarationRange(container: MvModule): TextRange { diff --git a/src/test/kotlin/org/move/cli/runConfigurations/TestCommandConfigurationProducerTest.kt b/src/test/kotlin/org/move/cli/runConfigurations/TestCommandConfigurationProducerTest.kt index 107d7841a..ef95c510d 100644 --- a/src/test/kotlin/org/move/cli/runConfigurations/TestCommandConfigurationProducerTest.kt +++ b/src/test/kotlin/org/move/cli/runConfigurations/TestCommandConfigurationProducerTest.kt @@ -136,7 +136,7 @@ class TestCommandConfigurationProducerTest: RunConfigurationProducerTestBase("te ) } } - val sourcesDir = this._testProject?.rootDirectory?.toPsiDirectory(this.project) ?: error("no root") + val sourcesDir = this.rootDirectory?.toPsiDirectory(this.project) ?: error("no root") checkOnFsItem(sourcesDir) } diff --git a/src/test/kotlin/org/move/ide/actions/CreateMoveFileActionTest.kt b/src/test/kotlin/org/move/ide/actions/CreateMoveFileActionTest.kt index ecdba6067..cf12f011b 100644 --- a/src/test/kotlin/org/move/ide/actions/CreateMoveFileActionTest.kt +++ b/src/test/kotlin/org/move/ide/actions/CreateMoveFileActionTest.kt @@ -54,9 +54,8 @@ class CreateMoveFileActionTest : MvProjectTestBase() { moduleName: String, @Language("Move") expectedText: String ) { - val dir = this._testProject?.rootDirectory - ?.findChild("sources") - ?.toPsiDirectory(this.project)!! + val dir = this.rootDirectory + ?.findChild("sources")?.toPsiDirectory(this.project)!! val template = FileTemplateManager.getInstance(this.project).getInternalTemplate(templateName) val resultFile = CreateMoveFileAction().createFileFromTemplate(dir, moduleName, template)!! diff --git a/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt index a1c129b85..0bd08215f 100644 --- a/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt +++ b/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt @@ -25,7 +25,8 @@ import org.move.utils.tests.base.TestCase fun setRegistryKey(key: String, value: Boolean) = Registry.get(key).setValue(value) abstract class MvProjectTestBase: CodeInsightFixtureTestCase>() { - var _testProject: TestProject? = null + +// var isProjectInitialized: Boolean = false override fun setUp() { super.setUp() @@ -36,10 +37,10 @@ abstract class MvProjectTestBase: CodeInsightFixtureTestCase