Skip to content

Commit

Permalink
Merge pull request #173 from pontem-network/drop-233
Browse files Browse the repository at this point in the history
Drop 233
  • Loading branch information
mkurnikov authored Aug 2, 2024
2 parents bf72ff7 + 5f6e02d commit 1ff1d74
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
tests:
strategy:
matrix:
gradle-properties-version: [ 233, 241, 242 ]
gradle-properties-version: [ 241, 242 ]

runs-on: ubuntu-latest
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-eap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
uses: gradle/[email protected]
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
Expand Down
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand Down
13 changes: 0 additions & 13 deletions gradle-233.properties

This file was deleted.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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.refactoring.suggested.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<MvModule> {
override fun getDeclarationRange(container: MvModule): TextRange {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<MvResolveCache>()
}
}

Expand Down
20 changes: 2 additions & 18 deletions src/main/kotlin/org/move/openapiext/ui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T> 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)
}
Expand Down Expand Up @@ -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 <T : JComponent> Row.fullWidthCell(component: T): Cell<T> {
return cell(component).align(AlignX.FILL)
}

val JBTextField.trimmedText: String
get() = text.trim()
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)!!
Expand Down
20 changes: 11 additions & 9 deletions src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModuleFixtureBuilder<*>>() {
var _testProject: TestProject? = null

// var isProjectInitialized: Boolean = false

override fun setUp() {
super.setUp()
Expand All @@ -36,10 +37,10 @@ abstract class MvProjectTestBase: CodeInsightFixtureTestCase<ModuleFixtureBuilde
this.handleCompilerV2Annotations(project)
}

override fun tearDown() {
_testProject = null
super.tearDown()
}
// override fun tearDown() {
//// isProjectInitialized = false
// super.tearDown()
// }

override fun getTestName(lowercaseFirstLetter: Boolean): String {
val camelCase = super.getTestName(lowercaseFirstLetter)
Expand All @@ -59,9 +60,9 @@ abstract class MvProjectTestBase: CodeInsightFixtureTestCase<ModuleFixtureBuilde
}

private fun testProject(fileTree: FileTree): TestProject {
val rootDirectory = myModule.rootManager.contentRoots.first()
val rootDirectory = this.rootDirectory ?: error("myModule should exist")

val testProject = fileTree.create(myFixture.project, rootDirectory)
this._testProject = testProject
myFixture.configureFromFileWithCaret(testProject)

SystemProperties.setProperty("user.home", testProject.rootDirectory.path)
Expand All @@ -70,6 +71,8 @@ abstract class MvProjectTestBase: CodeInsightFixtureTestCase<ModuleFixtureBuilde
return testProject
}

val rootDirectory: VirtualFile? get() = myModule?.rootManager?.contentRoots?.firstOrNull()

protected fun CodeInsightTestFixture.configureFromFileWithCaret(testProject: TestProject) {
val fileWithCaret =
testProject.rootDirectory.toNioPath()
Expand Down Expand Up @@ -98,9 +101,8 @@ abstract class MvProjectTestBase: CodeInsightFixtureTestCase<ModuleFixtureBuilde
}

private fun findVirtualFile(path: String): VirtualFile {
val rootDirectory = this._testProject?.rootDirectory ?: error("no root")
val parts = FileUtil.splitPath(path, '/')
var res = rootDirectory
var res = this.rootDirectory ?: error("no root")
for (part in parts) {
res = res.findChild(part) ?: error("cannot find $path")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ abstract class RunConfigurationProducerTestBase(val testDir: String): MvProjectT
configurationContext.configurationsFromContext.orEmpty().map { it.configurationSettings }
check(configurations.isNotEmpty()) { "No configurations found" }

val testProject = this._testProject ?: error("testProject not initialized")
val testId = testProject.rootDirectory.name
// if (!this.isProjectInitialized) error("testProject is not initialized")
val rootDirectory = this.rootDirectory ?: error("testProject is not initialized yet")
val testId = rootDirectory.name

val root = Element("configurations")
configurations.forEach {
Expand Down

0 comments on commit 1ff1d74

Please sign in to comment.