Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into fix/#515-improve-rule-declarati…
Browse files Browse the repository at this point in the history
…on-message
  • Loading branch information
Xewar313 committed Apr 22, 2024
2 parents cd42eab + 322d25b commit 4e18a88
Show file tree
Hide file tree
Showing 35 changed files with 164 additions and 99 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

# SnakeCharm Plugin Changelog

## [2024.1.1]
Released on 20 April 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)

Expand Down
25 changes: 15 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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")
}

Expand Down Expand Up @@ -153,9 +153,6 @@ tasks {
withType<KotlinCompile> {
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")
}
}
Expand Down Expand Up @@ -305,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")
}

Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ class ImplicitPySymbolsProvider(
val project = project

DumbService.getInstance(project).runWhenSmart {
SlowOperations.allowSlowOperations<Throwable> { 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<Throwable> { .. }

// 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)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.jetbrains.snakecharm.lang.SnakemakeNames
import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection

object SmkWrapperCompletionProvider : CompletionProvider<CompletionParameters>() {
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -205,7 +206,7 @@ class SmkWrapperStorage(val project: Project) : Disposable {
@ExperimentalSerializationApi
private fun deserializeWrappers(storagePath: Path) =
Cbor.decodeFromByteArray<Pair<String, List<SmkWrapperStorage.WrapperInfo>>>(
storagePath.readBytes()
Files.readAllBytes(storagePath)
)

@ExperimentalSerializationApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ class SmkCheckPointImpl

override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) {
is SmkElementVisitor -> pyVisitor.visitSmkCheckPoint(this)
else -> super.acceptPyVisitor(pyVisitor)
else -> super<SmkRuleLikeImpl>.acceptPyVisitor(pyVisitor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<SmkArgsSectionImpl>.acceptPyVisitor(pyVisitor)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SmkModuleImpl : SmkRuleLikeImpl<SmkModuleStub, SmkModule, SmkModuleArgsSec
override fun acceptPyVisitor(pyVisitor: PyElementVisitor?) {
when (pyVisitor) {
is SmkElementVisitor -> pyVisitor.visitSmkModule(this)
else -> super.acceptPyVisitor(pyVisitor)
else -> super<SmkRuleLikeImpl>.acceptPyVisitor(pyVisitor)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SmkRuleImpl

override fun acceptPyVisitor(pyVisitor: PyElementVisitor) = when (pyVisitor) {
is SmkElementVisitor -> pyVisitor.visitSmkRule(this)
else -> super.acceptPyVisitor(pyVisitor)
else -> super<SmkRuleLikeImpl>.acceptPyVisitor(pyVisitor)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SmkArgsSectionImpl>.acceptPyVisitor(pyVisitor)
}

override fun getReference(): PsiReference? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyElementImpl>.acceptPyVisitor(pyVisitor)
}

override fun getPresentation() = getPresentation(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SmkArgsSectionImpl>.acceptPyVisitor(pyVisitor)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SmkSubworkflowImpl:
override fun acceptPyVisitor(pyVisitor: PyElementVisitor) {
when (pyVisitor) {
is SmkElementVisitor -> pyVisitor.visitSmkSubworkflow(this)
else -> super.acceptPyVisitor(pyVisitor)
else -> super<SmkRuleLikeImpl>.acceptPyVisitor(pyVisitor)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<SmkArgsSectionImpl>.acceptPyVisitor(pyVisitor)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SmkUseImpl : SmkRuleLikeImpl<SmkUseStub, SmkUse, SmkRuleOrCheckpointArgsSe
override fun acceptPyVisitor(pyVisitor: PyElementVisitor?) {
when (pyVisitor) {
is SmkElementVisitor -> pyVisitor.visitSmkUse(this)
else -> super.acceptPyVisitor(pyVisitor)
else -> super<SmkRuleLikeImpl>.acceptPyVisitor(pyVisitor)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyElementImpl>.acceptPyVisitor(pyVisitor)
}

override fun getSectionKeywordNode() = node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyElementImpl>.acceptPyVisitor(pyVisitor)
}

override fun getPresentation() = getPresentation(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyElementImpl>.acceptPyVisitor(pyVisitor)
}

override fun getPresentation() = getPresentation(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyElementImpl>.acceptPyVisitor(pyVisitor)
}

override fun getPresentation() = getPresentation(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyReferenceExpressionImpl>.acceptPyVisitor(pyVisitor)
}

override fun getReference(context: PyResolveContext): PsiPolyVariantReference {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<SmkSLReferenceExpression>.acceptPyVisitor(pyVisitor)
}

override fun getQualifier(): PyExpression? {
return super<SmkSLReferenceExpression>.getQualifier()
}

override fun isQualified(): Boolean {
return super<SmkSLReferenceExpression>.isQualified()
}

override fun getReferencedName(): String? {
return super<SmkSLReferenceExpression>.getReferencedName()
}

override fun getNameElement(): ASTNode? {
return super<SmkSLReferenceExpression>.getNameElement()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<SmkSLElementImpl>.acceptPyVisitor(pyVisitor)
}

override fun getIndexExpression() = this.childToPsi<SmkSLSubscriptionIndexKeyExpressionImpl>(KEY_EXPRESSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyReferenceExpressionImpl>.acceptPyVisitor(pyVisitor)
}


Expand Down
Loading

0 comments on commit 4e18a88

Please sign in to comment.