From 039cb02ccb6f3c3b3a726cc0537deaa2c7a0e76b Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Thu, 18 Apr 2024 18:48:43 +0200 Subject: [PATCH 1/5] Features/#513 pc 2024.1 (#514) * fix: 2024.1 support : see #513 * Parser errors bundle changed * workaround : Slow operations logging reduced as workarond * Kotlin compilation fixed - super classes, isDirectory, etc * parser tests * class cast exception due to mock sdk * deprecated API cleanup * TOML dependency added - required for PyCharm components initialisation - Python plugin now requires TOML to be installed. Theoretically it's an optional dependency, but actually it stops majority of the python plugin functionality, as the module intellij.python.community.impl is not loaded without it. * use latest kotlin 1.9 * refactor: use LanguageLevel * cleanup build script, `-Xjvm-default=all` is required (else not compile), others seems not --- CHANGELOG.md | 7 +++ build.gradle.kts | 17 +++---- gradle.properties | 14 +++--- .../codeInsight/ImplicitPySymbolsProvider.kt | 9 +++- .../completion/wrapper/SmkWrapperCrawler.kt | 2 +- .../completion/wrapper/SmkWrapperStorage.kt | 3 +- .../SmkFrameworkConfigurableProvider.kt | 2 +- .../lang/psi/impl/SmkCheckPointImpl.kt | 2 +- .../lang/psi/impl/SmkModuleArgsSectionImpl.kt | 2 +- .../snakecharm/lang/psi/impl/SmkModuleImpl.kt | 2 +- .../snakecharm/lang/psi/impl/SmkRuleImpl.kt | 2 +- .../SmkRuleOrCheckpointArgsSectionImpl.kt | 2 +- .../lang/psi/impl/SmkRunSectionImpl.kt | 2 +- .../psi/impl/SmkSubworkflowArgsSectionImpl.kt | 2 +- .../lang/psi/impl/SmkSubworkflowImpl.kt | 2 +- .../lang/psi/impl/SmkUseArgsSectionImpl.kt | 2 +- .../snakecharm/lang/psi/impl/SmkUseImpl.kt | 2 +- .../psi/impl/SmkWorkflowArgsSectionImpl.kt | 2 +- .../impl/SmkWorkflowLocalrulesSectionImpl.kt | 2 +- .../impl/SmkWorkflowPythonBlockSectionImpl.kt | 2 +- .../impl/SmkWorkflowRuleorderSectionImpl.kt | 2 +- .../lang/psi/SmkSLReferenceExpression.kt | 2 + .../lang/psi/SmkSLReferenceExpressionImpl.kt | 2 +- .../lang/psi/SmkSLSubscriptionExpression.kt | 22 +++++++++ .../psi/SmkSLSubscriptionExpressionImpl.kt | 2 +- ...SmkSLSubscriptionIndexKeyExpressionImpl.kt | 2 +- src/main/resources/META-INF/plugin.xml | 1 + .../com/jetbrains/python/PythonMockSdk.kt | 45 ++++++++++++------- .../fixtures/PyLightProjectDescriptor.kt | 15 +++---- .../jetbrains/snakecharm/SnakemakeTestCase.kt | 9 +--- .../lang/parser/SnakemakeParsingTest.kt | 8 ++++ src/test/kotlin/features/glue/StepDefs.kt | 10 ++--- .../kotlin/features/glue/WrappersSteps.kt | 2 +- 33 files changed, 127 insertions(+), 75 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 019fe7ae5..ded79c90e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ # SnakeCharm Plugin Changelog +## [2024.1.1] +Released on ... 2024 + +### Fixed +- Compatibility with PyCharm 2024.1 + + ## [2023.3.1] Released on 6 Dec 2023 (EAP on 3 Nov 2023) diff --git a/build.gradle.kts b/build.gradle.kts index bc7f8b573..9a4c77898 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,14 +19,14 @@ plugins { // Java support id("java") - // Kotlin support - kotlin("jvm") version "1.8.10" - kotlin("plugin.serialization") version "1.8.10" + // Kotlin support latest: 1.9.23 + kotlin("jvm") version "1.9.23" + kotlin("plugin.serialization") version "1.9.23" // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin // This plugin allows you to build plugins for IntelliJ platform using specific // IntelliJ SDK and bundled plugins. - id("org.jetbrains.intellij") version "1.16.0" + id("org.jetbrains.intellij") version "1.17.3" // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin id("org.jetbrains.changelog") version "2.2.0" } @@ -51,9 +51,9 @@ kotlin { dependencies { testImplementation("io.cucumber:cucumber-java:7.8.1") testImplementation("io.cucumber:cucumber-junit:7.8.1") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.8.10") - testImplementation("org.jetbrains.kotlin:kotlin-reflect:1.8.10") - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10") + testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.9.23") + testImplementation("org.jetbrains.kotlin:kotlin-reflect:1.9.23") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23") implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.4.1") } @@ -153,9 +153,6 @@ tasks { withType { kotlinOptions { jvmTarget = it - languageVersion = "1.7" - // see https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library - apiVersion = "1.6" freeCompilerArgs = listOf("-Xjvm-default=all") } } diff --git a/gradle.properties b/gradle.properties index 9f053c566..c7d4d7e4d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ pluginName = snakecharm # * {pluginVersion}{pluginPreReleaseSuffix} # * plugin version is YEAR.MAJOR.MINOR, where YEAR.MAJOR is a minimal compatible platform version, MINOR is version digit. # * {pluginPreReleaseSuffix}: Use empty string [..=] for release, for eap: [..=-eap] or [..=-eap.2] -pluginVersion = 2023.3.1 +pluginVersion = 2024.1.1 pluginPreReleaseSuffix=-eap #pluginPreReleaseSuffix= @@ -20,13 +20,13 @@ pluginBuildCounter=SNAPSHOT ####################################################################################################################### # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild = 233 -pluginUntilBuild = 233.* +pluginSinceBuild = 241 +pluginUntilBuild = 241.* # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl # See https://jb.gg/intellij-platform-builds-list for available build versions. # E.g. pluginVerifierIdeVersions = 2023.1, 2023.2, 232-EAP-SNAPSHOT, 233-EAP-SNAPSHOT -pluginVerifierIdeVersions = 2023.3, 233-EAP-SNAPSHOT +pluginVerifierIdeVersions = 2024.1, 241-EAP-SNAPSHOT # Versions: 2021.1.1, LATEST-EAP-SNAPSHOT, LATEST-TRUNK-SNAPSHOT, 201-EAP-SNAPSHOT, 201.7223.69 # Platforms: PC, PY, IC @@ -38,7 +38,7 @@ pluginVerifierIdeVersions = 2023.3, 233-EAP-SNAPSHOT # !!!! Uncomment one of the following settings: either pycharmPath or pythonPlugin !!!! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -platformPlugins = org.jetbrains.plugins.yaml +platformPlugins = org.jetbrains.plugins.yaml, org.toml.lang # -- PyCharm: -- # * Run Snakemake plugin inside PyCharm. The IDE will be downloaded automatically @@ -49,8 +49,8 @@ platformType = PC # * latest release #platformVersion = 2023.1 # * EAPs for next major release (or selected minor release) -#platformVersion = 2023.2 -platformVersion = 233-EAP-SNAPSHOT +platformVersion = 2024.1 +#platformVersion = 241-EAP-SNAPSHOT #platformVersion = LATEST-EAP-SNAPSHOT # * Night builds from master #platformVersion = LATEST-TRUNK-SNAPSHOT diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/ImplicitPySymbolsProvider.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/ImplicitPySymbolsProvider.kt index 137157fa5..5030028a0 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/ImplicitPySymbolsProvider.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/ImplicitPySymbolsProvider.kt @@ -76,7 +76,14 @@ class ImplicitPySymbolsProvider( val project = project DumbService.getInstance(project).runWhenSmart { - SlowOperations.allowSlowOperations { doRefreshCache(project, sdk, forceClear, null) } + SlowOperations.startSection(SlowOperations.KNOWN_ISSUE).use { ignore -> + // XXX: workaround because default code throws 100+ exceptions: java.lang.Throwable: Slow operations are prohibited on EDT. See SlowOperations.assertSlowOperationsAreAllowed javadoc. + // SlowOperations.allowSlowOperations { .. } + + // TODO: 1) should be in background 2) note that it requires some read actions to access PSI + // See: https://github.com/JetBrains-Research/snakecharm/issues/513 + doRefreshCache(project, sdk, forceClear, null) + } } } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt index 3c7ea50c3..208ef31bd 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt @@ -1,7 +1,6 @@ package com.jetbrains.snakecharm.codeInsight.completion.wrapper import com.intellij.openapi.util.io.FileUtil -import com.intellij.util.io.isDirectory import com.intellij.util.io.write import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI import kotlinx.serialization.ExperimentalSerializationApi @@ -11,6 +10,7 @@ import org.yaml.snakeyaml.Yaml import java.io.File import java.nio.file.Paths import kotlin.io.path.exists +import kotlin.io.path.isDirectory object SmkWrapperCrawler { private val VERBOSE = false diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt index 32887fa7c..61b139aae 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt @@ -17,6 +17,7 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.cbor.Cbor import kotlinx.serialization.decodeFromByteArray import java.net.URL +import java.nio.file.Files import java.nio.file.Path import java.util.* import kotlin.io.path.exists @@ -205,7 +206,7 @@ class SmkWrapperStorage(val project: Project) : Disposable { @ExperimentalSerializationApi private fun deserializeWrappers(storagePath: Path) = Cbor.decodeFromByteArray>>( - storagePath.readBytes() + Files.readAllBytes(storagePath) ) @ExperimentalSerializationApi diff --git a/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkConfigurableProvider.kt b/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkConfigurableProvider.kt index 701b49da1..14bb8b1c6 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkConfigurableProvider.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkConfigurableProvider.kt @@ -4,11 +4,11 @@ import com.intellij.facet.ui.ValidationResult import com.intellij.openapi.options.Configurable import com.intellij.openapi.options.SearchableConfigurable import com.intellij.openapi.project.Project -import com.intellij.util.io.isDirectory import com.jetbrains.snakecharm.SnakemakeBundle import java.nio.file.Paths import javax.swing.JComponent import kotlin.io.path.exists +import kotlin.io.path.isDirectory /** * Registers project settings tab for snakemake settings ('supported framework') diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkCheckPointImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkCheckPointImpl.kt index 8e21a045c..bd1f45a7f 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkCheckPointImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkCheckPointImpl.kt @@ -26,6 +26,6 @@ class SmkCheckPointImpl override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkCheckPoint(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } } \ No newline at end of file diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleArgsSectionImpl.kt index 65b92da26..fe5f68d91 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleArgsSectionImpl.kt @@ -13,7 +13,7 @@ class SmkModuleArgsSectionImpl(node: ASTNode) : SmkArgsSectionImpl(node), SmkMod override fun acceptPyVisitor(pyVisitor: PyElementVisitor?) { when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkModuleArgsSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleImpl.kt index 3febcf396..5f1d98ad8 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkModuleImpl.kt @@ -30,7 +30,7 @@ class SmkModuleImpl : SmkRuleLikeImpl pyVisitor.visitSmkModule(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt index d8238d009..81da7252f 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt @@ -33,7 +33,7 @@ class SmkRuleImpl override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkRule(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } companion object { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt index 08bc70556..5f3512c4c 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt @@ -20,7 +20,7 @@ open class SmkRuleOrCheckpointArgsSectionImpl(node: ASTNode) : SmkArgsSectionImp override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkRuleOrCheckpointArgsSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getReference(): PsiReference? = diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRunSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRunSectionImpl.kt index 074e998b8..dc6111978 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRunSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRunSectionImpl.kt @@ -24,7 +24,7 @@ class SmkRunSectionImpl(node: ASTNode): PyElementImpl(node), SmkRunSection { override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkRunSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getPresentation() = getPresentation(this) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowArgsSectionImpl.kt index e2da2cf56..024c5a7ef 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowArgsSectionImpl.kt @@ -9,7 +9,7 @@ class SmkSubworkflowArgsSectionImpl(node: ASTNode): SmkArgsSectionImpl(node), Sm override fun acceptPyVisitor(pyVisitor: PyElementVisitor) { when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkSubworkflowArgsSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } } } \ No newline at end of file diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowImpl.kt index 0aed8764f..d89ae94af 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkSubworkflowImpl.kt @@ -20,7 +20,7 @@ class SmkSubworkflowImpl: override fun acceptPyVisitor(pyVisitor: PyElementVisitor) { when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkSubworkflow(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } } } \ No newline at end of file diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt index a1c3997c6..20e0ac2b9 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt @@ -12,7 +12,7 @@ class SmkUseArgsSectionImpl(node: ASTNode) : SmkArgsSectionImpl(node), SmkRuleOr override fun acceptPyVisitor(pyVisitor: PyElementVisitor?) { when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkRuleOrCheckpointArgsSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseImpl.kt index 115008a2e..a8446e634 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseImpl.kt @@ -30,7 +30,7 @@ class SmkUseImpl : SmkRuleLikeImpl pyVisitor.visitSmkUse(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowArgsSectionImpl.kt index 96bdbdc67..10bed92a3 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowArgsSectionImpl.kt @@ -28,7 +28,7 @@ class SmkWorkflowArgsSectionImpl(node: ASTNode) : PyElementImpl(node), SmkWorkfl override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkWorkflowArgsSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getSectionKeywordNode() = node diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowLocalrulesSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowLocalrulesSectionImpl.kt index c14777ee2..a90d86d6c 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowLocalrulesSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowLocalrulesSectionImpl.kt @@ -14,7 +14,7 @@ class SmkWorkflowLocalrulesSectionImpl(node: ASTNode): PyElementImpl(node), SmkW override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkWorkflowLocalrulesSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getPresentation() = getPresentation(this) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowPythonBlockSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowPythonBlockSectionImpl.kt index a49517608..0c2cb3e69 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowPythonBlockSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowPythonBlockSectionImpl.kt @@ -21,7 +21,7 @@ class SmkWorkflowPythonBlockSectionImpl(node: ASTNode) : PyElementImpl(node), Sm override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkWorkflowPythonBlockSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getPresentation() = getPresentation(this) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowRuleorderSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowRuleorderSectionImpl.kt index 9677ff7f4..645f2486b 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowRuleorderSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkWorkflowRuleorderSectionImpl.kt @@ -14,7 +14,7 @@ class SmkWorkflowRuleorderSectionImpl(node: ASTNode): PyElementImpl(node), SmkWo override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkElementVisitor -> pyVisitor.visitSmkWorkflowRuleorderSection(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getPresentation() = getPresentation(this) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpression.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpression.kt index cdd9099a7..7ada1ab6e 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpression.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpression.kt @@ -9,6 +9,8 @@ import com.jetbrains.snakecharm.lang.psi.SmkSection import com.jetbrains.snakecharm.stringLanguage.lang.psi.references.SmkSLWildcardReference interface SmkSLReferenceExpression : PyReferenceExpression, SmkSLExpression, PsiNameIdentifierOwner { + override fun getName(): String? + fun containingRuleOrCheckpointSection(): SmkRuleOrCheckpointArgsSection? = PsiTreeUtil.getParentOfType(injectionHost(), SmkRuleOrCheckpointArgsSection::class.java) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt index 9db6e9045..f3613feff 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt @@ -36,7 +36,7 @@ class SmkSLReferenceExpressionImpl(node: ASTNode) : PyReferenceExpressionImpl(no override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkSLElementVisitor -> pyVisitor.visitSmkSLReferenceExpression(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getReference(context: PyResolveContext): PsiPolyVariantReference { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpression.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpression.kt index 2802dcdca..d9acbc6f4 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpression.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpression.kt @@ -1,6 +1,28 @@ package com.jetbrains.snakecharm.stringLanguage.lang.psi +import com.intellij.lang.ASTNode +import com.jetbrains.python.ast.PyAstElementVisitor +import com.jetbrains.python.psi.PyExpression import com.jetbrains.python.psi.PySubscriptionExpression interface SmkSLSubscriptionExpression : SmkSLReferenceExpression, PySubscriptionExpression { + override fun acceptPyVisitor(pyVisitor: PyAstElementVisitor?) { + super.acceptPyVisitor(pyVisitor) + } + + override fun getQualifier(): PyExpression? { + return super.getQualifier() + } + + override fun isQualified(): Boolean { + return super.isQualified() + } + + override fun getReferencedName(): String? { + return super.getReferencedName() + } + + override fun getNameElement(): ASTNode? { + return super.getNameElement() + } } \ No newline at end of file diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpressionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpressionImpl.kt index f3a5d490c..98a96e14d 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpressionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionExpressionImpl.kt @@ -101,7 +101,7 @@ class SmkSLSubscriptionExpressionImpl(node: ASTNode) : SmkSLElementImpl(node), S override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkSLElementVisitor -> pyVisitor.visitSmkSLSubscriptionExpression(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } override fun getIndexExpression() = this.childToPsi(KEY_EXPRESSION) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionIndexKeyExpressionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionIndexKeyExpressionImpl.kt index 2b7d99d45..f6e13ba26 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionIndexKeyExpressionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLSubscriptionIndexKeyExpressionImpl.kt @@ -36,7 +36,7 @@ class SmkSLSubscriptionIndexKeyExpressionImpl(node: ASTNode) : PyReferenceExpres override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) { is SmkSLElementVisitor -> pyVisitor.visitSmkSLSubscriptionExpressionKey(this) - else -> super.acceptPyVisitor(pyVisitor) + else -> super.acceptPyVisitor(pyVisitor) } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index bc922dff8..1a167117d 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -12,6 +12,7 @@ com.intellij.modules.lang com.intellij.modules.python + org.toml.lang org.jetbrains.plugins.yaml diff --git a/src/test/kotlin/com/jetbrains/python/PythonMockSdk.kt b/src/test/kotlin/com/jetbrains/python/PythonMockSdk.kt index 87155bcdd..98ee278c2 100644 --- a/src/test/kotlin/com/jetbrains/python/PythonMockSdk.kt +++ b/src/test/kotlin/com/jetbrains/python/PythonMockSdk.kt @@ -15,10 +15,12 @@ */ package com.jetbrains.python +import com.intellij.openapi.application.Application +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.projectRoots.ProjectJdkTable import com.intellij.openapi.projectRoots.Sdk import com.intellij.openapi.projectRoots.SdkAdditionalData import com.intellij.openapi.projectRoots.SdkTypeId -import com.intellij.openapi.projectRoots.impl.MockSdk import com.intellij.openapi.roots.OrderRootType import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.VirtualFile @@ -27,6 +29,7 @@ import com.intellij.util.containers.MultiMap import com.jetbrains.python.codeInsight.typing.PyTypeShed.findRootsForLanguageLevel import com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil import com.jetbrains.python.psi.LanguageLevel +import com.jetbrains.python.sdk.PythonSdkType.MOCK_PY_MARKER_KEY import com.jetbrains.python.sdk.PythonSdkUtil import java.io.File @@ -36,18 +39,16 @@ import java.io.File * * @author yole */ -// object PythonMockSdk { fun create( testDataRoot: String, - version: String = LanguageLevel.getLatest().toPythonVersion(), + level: LanguageLevel = LanguageLevel.getLatest(), sdkNameSuffix: String = "", vararg additionalRoots: VirtualFile ): Sdk { - val level = LanguageLevel.fromPythonVersion(version)!! return create( "Mock ${PyNames.PYTHON_SDK_ID_NAME} ${level.toPythonVersion()}$sdkNameSuffix", - "$testDataRoot/MockSdk$version", + "$testDataRoot/MockSdk${level.toPythonVersion()}", PyMockSdkType(level), level, *additionalRoots @@ -55,7 +56,7 @@ object PythonMockSdk { } private fun create( - name: String = "MockSdk", + sdkName: String = "MockSdk", mockSdkPath: String, sdkType: SdkTypeId, level: LanguageLevel, @@ -65,16 +66,30 @@ object PythonMockSdk { roots.putValues(OrderRootType.CLASSES, createRoots(mockSdkPath, level)) roots.putValues(OrderRootType.CLASSES, listOf(*additionalRoots)) - val sdk = MockSdk( - name, - "$mockSdkPath/bin/python${level.toPythonVersion()}", - toVersionString(level), - roots, - sdkType - ) + val sdk = ProjectJdkTable.getInstance().createSdk(sdkName, sdkType) + val sdkModificator = sdk.sdkModificator + sdkModificator.homePath = "$mockSdkPath/bin/python${level.toPythonVersion()}" + sdkModificator.setVersionString(toVersionString(level)) + + createRoots(mockSdkPath, level).forEach { vFile: VirtualFile? -> + sdkModificator.addRoot( + vFile!!, OrderRootType.CLASSES + ) + } + + additionalRoots.forEach { vFile -> + sdkModificator.addRoot(vFile, OrderRootType.CLASSES) + } - // com.jetbrains.python.psi.resolve.PythonSdkPathCache.getInstance() corrupts SDK, so have to clone - return sdk.clone() + val application: Application = ApplicationManager.getApplication() + val runnable = Runnable { sdkModificator.commitChanges() } + if (application.isDispatchThread()) { + application.runWriteAction(runnable) + } else { + application.invokeAndWait { application.runWriteAction(runnable) } + } + sdk.putUserData(MOCK_PY_MARKER_KEY, true) + return sdk } private fun toVersionString( level: LanguageLevel) = "Python ${level.toPythonVersion()}" diff --git a/src/test/kotlin/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt b/src/test/kotlin/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt index 686f2fbea..ebdda0023 100644 --- a/src/test/kotlin/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt +++ b/src/test/kotlin/com/jetbrains/python/fixtures/PyLightProjectDescriptor.kt @@ -23,7 +23,8 @@ import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFile import com.intellij.testFramework.LightProjectDescriptor import com.jetbrains.python.PythonMockSdk -import com.jetbrains.python.module.PythonModuleType +import com.jetbrains.python.PythonModuleTypeBase +import com.jetbrains.python.psi.LanguageLevel import java.nio.file.Path /** @@ -31,9 +32,9 @@ import java.nio.file.Path * @author Ilya.Kazakevich */ class PyLightProjectDescriptor( - private val myPythonVersion: String, - private val testDataRoot: String, - private vararg val additionalLibraryRoots: Path + private val myPythonLangLevel: LanguageLevel, + private val testDataRoot: String, + private vararg val additionalLibraryRoots: Path ) : LightProjectDescriptor() { /** @@ -44,7 +45,7 @@ class PyLightProjectDescriptor( .map { VfsUtil.findFile(it, true)!! } .toTypedArray() - override fun getSdk() = PythonMockSdk.create(testDataRoot, myPythonVersion, "", *additionalRoots) + override fun getSdk() = PythonMockSdk.create(testDataRoot, myPythonLangLevel, "", *additionalRoots) protected fun createLibrary(model: ModifiableRootModel, name: String, path: String) { val modifiableModel = model.moduleLibraryTable.createLibrary(name).modifiableModel @@ -55,8 +56,6 @@ class PyLightProjectDescriptor( } override fun getModuleTypeId(): String { - return PythonModuleType.getInstance().id - // return "EMPTY_MODULE" - //return "PYTHON_MODULE" + return PythonModuleTypeBase.getInstance().id } } \ No newline at end of file diff --git a/src/test/kotlin/com/jetbrains/snakecharm/SnakemakeTestCase.kt b/src/test/kotlin/com/jetbrains/snakecharm/SnakemakeTestCase.kt index cffc547f7..93e201a31 100644 --- a/src/test/kotlin/com/jetbrains/snakecharm/SnakemakeTestCase.kt +++ b/src/test/kotlin/com/jetbrains/snakecharm/SnakemakeTestCase.kt @@ -23,18 +23,13 @@ import javax.swing.SwingUtilities abstract class SnakemakeTestCase : UsefulTestCase() { // TODO: could be extend SnakemakeTestCase here? - companion object { - const val PYTHON_2_MOCK_SDK = "2.7" - const val PYTHON_3_MOCK_SDK = "3.7" - } - protected val ourPyDescriptor = PyLightProjectDescriptor( - PYTHON_2_MOCK_SDK, + LanguageLevel.PYTHON27, SnakemakeTestUtil.getTestDataPath().toString() ) protected val ourPy3Descriptor = PyLightProjectDescriptor( - PYTHON_3_MOCK_SDK, + LanguageLevel.PYTHON37, SnakemakeTestUtil.getTestDataPath().toString(), SnakemakeTestUtil.getTestDataPath().resolve("MockPackages3") ) diff --git a/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt b/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt index d402801b2..070586fb8 100644 --- a/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt +++ b/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt @@ -40,6 +40,14 @@ class SnakemakeParsingTest : ParsingTestCase( addExplicitExtension(LanguageASTFactory.INSTANCE, PythonLanguage.getInstance(), PythonASTFactory()) // w/o this fails due to NPEs on PyPsiFacade access + application.registerService( + PyElementTypesFacade::class.java, + PyElementTypesFacadeImpl::class.java + ) + application.registerService( + PyLanguageFacade::class.java, + PyLanguageFacadeImpl::class.java + ) project.registerService( PyPsiFacade::class.java, PyPsiFacadeImpl::class.java diff --git a/src/test/kotlin/features/glue/StepDefs.kt b/src/test/kotlin/features/glue/StepDefs.kt index 6fbc2ae78..13654ceba 100644 --- a/src/test/kotlin/features/glue/StepDefs.kt +++ b/src/test/kotlin/features/glue/StepDefs.kt @@ -14,6 +14,7 @@ import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl import com.jetbrains.python.PythonMockSdk import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache import com.jetbrains.python.fixtures.PyLightProjectDescriptor +import com.jetbrains.python.psi.LanguageLevel import com.jetbrains.python.psi.PyFile import com.jetbrains.snakecharm.SnakemakeTestCase import com.jetbrains.snakecharm.SnakemakeTestUtil @@ -32,6 +33,7 @@ class StepDefs { @Throws(Exception::class) fun configureSnakemakeProject(projectType: String) { // Launched from 'Test worker' thread + val level = LanguageLevel.PYTHON37 require(SnakemakeWorld.myFixture == null) { "fixture must be null here, looks like cleanup after prev test failed." @@ -63,14 +65,10 @@ class StepDefs { // Write code here that turns the phrase above into concrete actions val testDataRoot = SnakemakeTestUtil.getTestDataPath().toString() - val projectDescriptor = PyLightProjectDescriptor( - SnakemakeTestCase.PYTHON_3_MOCK_SDK, - testDataRoot, - *additionalRoots - ) + val projectDescriptor = PyLightProjectDescriptor(level, testDataRoot, *additionalRoots) SnakemakeWorld.myPythonOnlySdk = PythonMockSdk.create( - testDataRoot, SnakemakeTestCase.PYTHON_3_MOCK_SDK, sdkNameSuffix = "_wo_snakemake" + testDataRoot, level, sdkNameSuffix = "_wo_snakemake" ) val factory = IdeaTestFixtureFactory.getFixtureFactory() diff --git a/src/test/kotlin/features/glue/WrappersSteps.kt b/src/test/kotlin/features/glue/WrappersSteps.kt index 11aa1ed03..64e3fdbc2 100644 --- a/src/test/kotlin/features/glue/WrappersSteps.kt +++ b/src/test/kotlin/features/glue/WrappersSteps.kt @@ -2,12 +2,12 @@ package features.glue import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.util.io.FileUtil -import com.intellij.util.io.isDirectory import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import features.glue.StepDefs.Companion.waitEDTEventsDispatching import io.cucumber.java.en.Given import java.nio.file.Paths import kotlin.io.path.exists +import kotlin.io.path.isDirectory class WrappersSteps { @Given("^wrapper repo path in test dir \"(.+)\"") From d23329e0627ea67e1b5f213aab318ba009eae464 Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Thu, 18 Apr 2024 19:10:01 +0200 Subject: [PATCH 2/5] feat: wrappers bundle updated to 3.8.0 --- CHANGELOG.md | 1 + gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ded79c90e..af90f6e05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Released on ... 2024 ### Fixed - Compatibility with PyCharm 2024.1 +- Bundled snakemake wrappers list updated to `v3.8.0` ## [2023.3.1] diff --git a/gradle.properties b/gradle.properties index c7d4d7e4d..b7b88dccb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -106,6 +106,6 @@ gradleVersion = 8.0.2 # - build.script.snakemakeWrappersRepoVersion = v$TAG # (or findout how to configure via %vcsroot.BioLabs_SnakeCharmPlugin_SnakemakeWrappersLatestRelease.branch%) -# * To checkout tag run: `git tag -l; git checkout tags/v$TAG -b tags/$TAG` (git checkout tags/v1.3.2 -b tags/v1.3.2) -snakemakeWrappersRepoVersion=v2.9.1 +# * To checkout tag run: `git tag -l; TAG=3.8.0; git checkout tags/v$TAG -b tags/$TAG` (git checkout tags/v1.3.2 -b tags/v1.3.2) +snakemakeWrappersRepoVersion=v3.8.0 snakemakeWrappersRepoPath=/Users/romeo/work/git_repos/snakecharm_related/snakemake-wrappers \ No newline at end of file From 4a3b1ea436f55a30ff7ebebda2aa8a30da14fff8 Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Sat, 20 Apr 2024 00:52:41 +0200 Subject: [PATCH 3/5] fix: Completion for wrapper names rarely works * closes #517 --- CHANGELOG.md | 2 +- .../wrapper/SmkWrapperCompletionProvider.kt | 2 +- .../wrapper_section_completion.feature | 46 ++++++++++--------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af90f6e05..8beda405e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Released on ... 2024 ### Fixed - Compatibility with PyCharm 2024.1 - Bundled snakemake wrappers list updated to `v3.8.0` - +- Completion for wrapper names rarely works (see [#517](https://github.com/JetBrains-Research/snakecharm/issues/517)) ## [2023.3.1] Released on 6 Dec 2023 (EAP on 3 Nov 2023) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCompletionProvider.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCompletionProvider.kt index 9e6916a28..029a54ae2 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCompletionProvider.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCompletionProvider.kt @@ -14,7 +14,7 @@ import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection object SmkWrapperCompletionProvider : CompletionProvider() { - private val WRAPPER_VERSION_REGEXP = Regex("(\\d+\\.\\d+\\.\\d+|master|latest).*") + private val WRAPPER_VERSION_REGEXP = Regex("(v?\\d+\\.\\d+\\.\\d+|master|latest).*") val CAPTURE = PlatformPatterns.psiElement() .inFile(SmkKeywordCompletionContributor.IN_SNAKEMAKE) diff --git a/src/test/resources/features/completion/wrapper_section_completion.feature b/src/test/resources/features/completion/wrapper_section_completion.feature index 8f854b58d..d5b4c8dd6 100644 --- a/src/test/resources/features/completion/wrapper_section_completion.feature +++ b/src/test/resources/features/completion/wrapper_section_completion.feature @@ -1,25 +1,27 @@ Feature: Completion for wrapper name - Scenario Outline: Complete wrapper name for bundled wrappers Given a snakemake project Given I open a file "foo.smk" with text """ NAME: - wrapper: "0.64.0/" + wrapper: "/" """ And add snakemake framework support with wrappers loaded When I put the caret after And I invoke autocompletion popup and see a text: """ NAME: - wrapper: "0.64.0/" + wrapper: "/" """ Examples: - | rule_like | short_name | full_name | - | rule | bismark2report | bio/bismark/bismark2report | - | rule | fastqc | bio/fastqc | - | checkpoint | cairosvg | utils/cairosvg | - | checkpoint | bam2fq/interleaved | bio/samtools/bam2fq/interleaved | + | rule_like | short_name | full_name | wrapper_repo_vers | + | rule | bismark2report | bio/bismark/bismark2report | 0.64.0 | + | rule | fastqc | bio/fastqc | 0.64.0 | + | checkpoint | cairosvg | utils/cairosvg | 0.64.0 | + | checkpoint | bam2fq/interleaved | bio/samtools/bam2fq/interleaved | 0.64.0 | + | rule | bismark2report | bio/bismark/bismark2report | v1.1.1 | + | rule | bismark2report | bio/bismark/bismark2report | v7.7.7 | + Scenario Outline: Complete wrapper name for non-standard version tag (multiple lookup items) Given a snakemake project @@ -36,14 +38,15 @@ Feature: Completion for wrapper name wrapper: "" """ Examples: - | rule_like | prefix | lookup | - | rule | 0.64.0/ | 0.64.0/bio/fastqc | - | rule | 0.64.0 | 0.64.0/bio/fastqc | - | rule | master | master/bio/fastqc | - | rule | latest | latest/bio/fastqc | - | rule | 0.54.3 | 0.54.3/bio/fastqc | - | rule | 0.30.10 | 0.30.10/bio/fastqc | - | checkpoint | 0.64.0/ | 0.64.0/bio/bismark/bismark2report | + | rule_like | prefix | lookup | + | rule | 0.64.0/ | 0.64.0/bio/fastqc | + | rule | v0.64.0/ | v0.64.0/bio/fastqc | + | rule | 0.64.0 | 0.64.0/bio/fastqc | + | rule | master | master/bio/fastqc | + | rule | latest | latest/bio/fastqc | + | rule | 0.54.3 | 0.54.3/bio/fastqc | + | rule | 0.30.10 | 0.30.10/bio/fastqc | + | checkpoint | 0.64.0/ | 0.64.0/bio/bismark/bismark2report | Scenario Outline: Complete wrapper name for non-standard version tag Given a snakemake project @@ -60,11 +63,12 @@ Feature: Completion for wrapper name wrapper: "/" """ Examples: - | rule_like | tag | short_name | full_name | - | rule | master | bismark2report | bio/bismark/bismark2report | - | rule | latest | fastqc | bio/fastqc | - | checkpoint | 0.54.3 | cairosvg | utils/cairosvg | - | checkpoint | 0.30.10 | bam2fq/interleaved | bio/samtools/bam2fq/interleaved | + | rule_like | tag | short_name | full_name | + | rule | master | bismark2report | bio/bismark/bismark2report | + | rule | latest | fastqc | bio/fastqc | + | checkpoint | 0.54.3 | cairosvg | utils/cairosvg | + | checkpoint | 0.30.10 | bam2fq/interleaved | bio/samtools/bam2fq/interleaved | + | checkpoint | v2.30.10 | bam2fq/interleaved | bio/samtools/bam2fq/interleaved | # TODO: configure temp wrappers dir using VFS & light fixture, e.g. # Scenario Outline: Complete for custom wrappers repo folder wrappers From 393d53fe49574bf0e25c310b10011c7fbca20477 Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Sat, 20 Apr 2024 00:53:07 +0200 Subject: [PATCH 4/5] fix: wrappers bundle cache missing in final plugin bundle --- build.gradle.kts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 9a4c77898..d12fd85f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -302,8 +302,16 @@ tasks { } jar { + // original, non-instrumented JAR + // :runIde, :test tasks launches the plugin from *.jar, so it is required also for development dependsOn("buildWrappersBundle") + from("${project.buildDir}/bundledWrappers/smk-wrapper-storage-bundled.cbor") + } + + instrumentedJar { + // modified (instrumented) JAR // :runIde, :test tasks launches the plugin from *.jar, so it is required also for development + dependsOn("buildWrappersBundle") from("${project.buildDir}/bundledWrappers/smk-wrapper-storage-bundled.cbor") } From 322d25bf7dbbc4c289ffce6a018735c709ed5fb0 Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Sat, 20 Apr 2024 21:45:10 +0200 Subject: [PATCH 5/5] chore: change notes for release 2024.1.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8beda405e..e0cb9bfdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ # SnakeCharm Plugin Changelog ## [2024.1.1] -Released on ... 2024 +Released on 20 April 2024 ### Fixed - Compatibility with PyCharm 2024.1