()
+ assert(pattern.accepts(element)) {
+ """
+ Pattern does not accept element at caret:
+ pattern: $pattern
+ $code
+ """.trimIndent()
+ }
+ }
+}
diff --git a/modules/core/src/test/resources/META-INF/plugin.xml b/modules/core/src/test/resources/META-INF/plugin.xml
new file mode 100644
index 00000000..dda38dab
--- /dev/null
+++ b/modules/core/src/test/resources/META-INF/plugin.xml
@@ -0,0 +1,21 @@
+
+ com.github.l34130.mise
+
+
+
+
+
+
+
+
diff --git a/modules/products/goland/build.gradle.kts b/modules/products/goland/build.gradle.kts
index ad6ea7d1..bdfe1ce7 100644
--- a/modules/products/goland/build.gradle.kts
+++ b/modules/products/goland/build.gradle.kts
@@ -1,4 +1,5 @@
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
+import org.jetbrains.intellij.platform.gradle.TestFrameworkType
fun properties(key: String) = project.findProperty(key).toString()
@@ -9,6 +10,7 @@ plugins {
dependencies {
implementation(project(":mise-core"))
+ testImplementation(libs.junit)
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellijPlatform {
@@ -18,6 +20,6 @@ dependencies {
jetbrainsRuntime()
- instrumentationTools()
+ testFramework(TestFrameworkType.Platform)
}
}
diff --git a/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/go/ProjectGoSdkSetup.kt b/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/go/MiseProjectGoSdkSetup.kt
similarity index 95%
rename from modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/go/ProjectGoSdkSetup.kt
rename to modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/go/MiseProjectGoSdkSetup.kt
index f3425070..992e463f 100644
--- a/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/go/ProjectGoSdkSetup.kt
+++ b/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/go/MiseProjectGoSdkSetup.kt
@@ -13,7 +13,7 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.LocalFileSystem
import kotlin.reflect.KClass
-class ProjectGoSdkSetup : AbstractProjectSdkSetup() {
+class MiseProjectGoSdkSetup : AbstractProjectSdkSetup() {
override fun getDevToolName() = MiseDevToolName("go")
override fun setupSdk(
diff --git a/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/run/GoLandRunConfigurationExtension.kt b/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/run/MiseGoLandRunConfigurationExtension.kt
similarity index 56%
rename from modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/run/GoLandRunConfigurationExtension.kt
rename to modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/run/MiseGoLandRunConfigurationExtension.kt
index 4385d914..c253de62 100644
--- a/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/run/GoLandRunConfigurationExtension.kt
+++ b/modules/products/goland/src/main/kotlin/com/github/l34130/mise/goland/run/MiseGoLandRunConfigurationExtension.kt
@@ -1,20 +1,16 @@
package com.github.l34130.mise.goland.run
-import com.github.l34130.mise.core.command.MiseCommandLineHelper
-import com.github.l34130.mise.core.command.MiseCommandLineNotFoundException
-import com.github.l34130.mise.core.notification.MiseNotificationServiceUtils
+import com.github.l34130.mise.core.MiseHelper
import com.github.l34130.mise.core.run.MiseRunConfigurationSettingsEditor
-import com.github.l34130.mise.core.setting.MiseSettings
import com.goide.execution.GoRunConfigurationBase
import com.goide.execution.GoRunningState
import com.goide.execution.extension.GoRunConfigurationExtension
import com.intellij.execution.configurations.RunnerSettings
import com.intellij.execution.target.TargetedCommandLineBuilder
-import com.intellij.openapi.components.service
import com.intellij.openapi.options.SettingsEditor
import org.jdom.Element
-class GoLandRunConfigurationExtension : GoRunConfigurationExtension() {
+class MiseGoLandRunConfigurationExtension : GoRunConfigurationExtension() {
override fun getEditorTitle(): String = MiseRunConfigurationSettingsEditor.EDITOR_TITLE
override fun > createEditor(configuration: P): SettingsEditor
=
@@ -44,26 +40,9 @@ class GoLandRunConfigurationExtension : GoRunConfigurationExtension() {
state: GoRunningState>,
commandLineType: GoRunningState.CommandLineType,
) {
- val project = configuration.getProject()
- val projectState = project.service().state
- val runConfigState = MiseRunConfigurationSettingsEditor.getMiseRunConfigurationState(configuration)
-
- val (workDir, configEnvironment) = when {
- projectState.useMiseDirEnv -> project.basePath to projectState.miseConfigEnvironment
- runConfigState?.useMiseDirEnv == true -> configuration.getWorkingDirectory() to runConfigState.miseConfigEnvironment
- else -> return
- }
-
- MiseCommandLineHelper.getEnvVars(workDir, configEnvironment)
- .fold(
- onSuccess = { envVars -> envVars },
- onFailure = {
- if (it !is MiseCommandLineNotFoundException) {
- MiseNotificationServiceUtils.notifyException("Failed to load environment variables", it)
- }
- emptyMap()
- },
- ).forEach { (k, v) -> cmdLine.addEnvironmentVariable(k, v) }
+ MiseHelper
+ .getMiseEnvVarsOrNotify(configuration, configuration::getWorkingDirectory)
+ .forEach { (k, v) -> cmdLine.addEnvironmentVariable(k, v) }
}
override fun isApplicableFor(configuration: GoRunConfigurationBase<*>): Boolean = true
diff --git a/modules/products/goland/src/test/kotlin/com/github/l34130/mise/goland/GoLandTest.kt b/modules/products/goland/src/test/kotlin/com/github/l34130/mise/goland/GoLandTest.kt
new file mode 100644
index 00000000..c2f27dd4
--- /dev/null
+++ b/modules/products/goland/src/test/kotlin/com/github/l34130/mise/goland/GoLandTest.kt
@@ -0,0 +1,9 @@
+package com.github.l34130.mise.goland
+
+import com.intellij.testFramework.fixtures.BasePlatformTestCase
+
+class GoLandTest : BasePlatformTestCase() {
+ fun testGoLand() {
+ println("GoLandTest.testGoLand")
+ }
+}
diff --git a/modules/products/gradle/build.gradle.kts b/modules/products/gradle/build.gradle.kts
index cad68150..59832245 100644
--- a/modules/products/gradle/build.gradle.kts
+++ b/modules/products/gradle/build.gradle.kts
@@ -1,4 +1,5 @@
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
+import org.jetbrains.intellij.platform.gradle.TestFrameworkType
fun properties(key: String) = project.findProperty(key).toString()
@@ -10,6 +11,7 @@ plugins {
dependencies {
implementation(project(":mise-core"))
+ testImplementation(libs.junit)
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellijPlatform {
@@ -19,6 +21,6 @@ dependencies {
jetbrainsRuntime()
- instrumentationTools()
+ testFramework(TestFrameworkType.Platform)
}
}
diff --git a/modules/products/gradle/src/main/kotlin/com/github/l34130/mise/gradle/run/GradleEnvironmentProvider.kt b/modules/products/gradle/src/main/kotlin/com/github/l34130/mise/gradle/run/GradleEnvironmentProvider.kt
deleted file mode 100644
index def4d5a4..00000000
--- a/modules/products/gradle/src/main/kotlin/com/github/l34130/mise/gradle/run/GradleEnvironmentProvider.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.github.l34130.mise.gradle.run
-
-import com.github.l34130.mise.core.command.MiseCommandLineHelper
-import com.github.l34130.mise.core.command.MiseCommandLineNotFoundException
-import com.github.l34130.mise.core.notification.MiseNotificationServiceUtils
-import com.github.l34130.mise.core.run.MiseRunConfigurationSettingsEditor
-import com.github.l34130.mise.core.setting.MiseSettings
-import com.intellij.execution.Executor
-import com.intellij.execution.application.ApplicationConfiguration
-import com.intellij.execution.runners.ExecutionEnvironment
-import com.intellij.openapi.components.service
-import com.intellij.openapi.project.Project
-import com.intellij.task.ExecuteRunConfigurationTask
-import org.jetbrains.plugins.gradle.execution.build.GradleExecutionEnvironmentProvider
-import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
-
-class GradleEnvironmentProvider : GradleExecutionEnvironmentProvider {
- override fun isApplicable(task: ExecuteRunConfigurationTask?): Boolean = task?.runProfile is ApplicationConfiguration
-
- override fun createExecutionEnvironment(
- project: Project,
- task: ExecuteRunConfigurationTask,
- executor: Executor,
- ): ExecutionEnvironment? {
- val environment =
- GradleExecutionEnvironmentProvider.EP_NAME.extensions
- .firstOrNull { provider ->
- provider != this && provider.isApplicable(task)
- }?.createExecutionEnvironment(project, task, executor)
-
- if (environment?.runProfile !is GradleRunConfiguration) {
- return environment
- }
- val gradleRunConfiguration = environment.runProfile as GradleRunConfiguration
-
- val projectState = project.service().state
- val runConfigState = MiseRunConfigurationSettingsEditor.getMiseRunConfigurationState(gradleRunConfiguration)
-
- val (workDir, configEnvironment) = when {
- projectState.useMiseDirEnv -> project.basePath to projectState.miseConfigEnvironment
- runConfigState?.useMiseDirEnv == true -> {
- val sourceConfig = task.runProfile as ApplicationConfiguration
- sourceConfig.project.basePath to runConfigState.miseConfigEnvironment
- }
-
- else -> return environment
- }
-
- val miseEnvVars = MiseCommandLineHelper.getEnvVars(workDir, configEnvironment)
- .fold(
- onSuccess = { envVars -> envVars },
- onFailure = {
- if (it !is MiseCommandLineNotFoundException) {
- MiseNotificationServiceUtils.notifyException("Failed to load environment variables", it)
- }
- emptyMap()
- },
- )
-
- gradleRunConfiguration.settings.env = miseEnvVars + gradleRunConfiguration.settings.env
- return environment
- }
-}
diff --git a/modules/products/gradle/src/main/kotlin/com/github/l34130/mise/gradle/run/MiseGradleEnvironmentProvider.kt b/modules/products/gradle/src/main/kotlin/com/github/l34130/mise/gradle/run/MiseGradleEnvironmentProvider.kt
new file mode 100644
index 00000000..630d7cec
--- /dev/null
+++ b/modules/products/gradle/src/main/kotlin/com/github/l34130/mise/gradle/run/MiseGradleEnvironmentProvider.kt
@@ -0,0 +1,64 @@
+package com.github.l34130.mise.gradle.run
+
+import com.github.l34130.mise.core.MiseHelper
+import com.intellij.execution.Executor
+import com.intellij.execution.runners.ExecutionEnvironment
+import com.intellij.execution.runners.ProgramRunner
+import com.intellij.openapi.externalSystem.util.ExternalSystemUtil
+import com.intellij.openapi.project.Project
+import com.intellij.task.ExecuteRunConfigurationTask
+import org.jetbrains.plugins.gradle.execution.build.GradleExecutionEnvironmentProvider
+import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
+import org.jetbrains.plugins.gradle.util.GradleConstants
+
+class MiseGradleEnvironmentProvider : GradleExecutionEnvironmentProvider {
+ override fun isApplicable(task: ExecuteRunConfigurationTask?): Boolean = task?.runProfile is GradleRunConfiguration
+
+ override fun createExecutionEnvironment(
+ project: Project,
+ task: ExecuteRunConfigurationTask,
+ executor: Executor,
+ ): ExecutionEnvironment? {
+ val runProfile = task.runProfile as GradleRunConfiguration
+ var environment: ExecutionEnvironment? = delegateProvider(task)?.createExecutionEnvironment(project, task, executor)
+
+ // No registered environment provider. Gradle Task is in this case.
+ if (environment == null) {
+ environment =
+ ExternalSystemUtil.createExecutionEnvironment(
+ runProfile.project,
+ GradleConstants.SYSTEM_ID,
+ runProfile.settings.clone(),
+ executor.id,
+ )
+ }
+
+ // Code Coverage runs maybe in this case.
+ if (environment == null) {
+ val runner = ProgramRunner.getRunner(executor.id, task.runProfile)
+ val taskSettings = task.settings
+ if (runner != null && taskSettings != null) {
+ environment =
+ ExecutionEnvironment(executor, runner, taskSettings, project)
+ }
+ }
+
+ if (environment?.runProfile is GradleRunConfiguration) {
+ val miseEnvVars =
+ MiseHelper.getMiseEnvVarsOrNotify(
+ configuration = runProfile,
+ workingDirectory = { runProfile.projectPathOnTarget },
+ )
+
+ val settings = (environment.runProfile as GradleRunConfiguration).settings
+ settings.env = settings.env + miseEnvVars
+ }
+
+ return environment
+ }
+
+ private fun delegateProvider(task: ExecuteRunConfigurationTask): GradleExecutionEnvironmentProvider? {
+ val extensions = GradleExecutionEnvironmentProvider.EP_NAME.extensions
+ return extensions.firstOrNull { it !== this && it.isApplicable(task) }
+ }
+}
diff --git a/modules/products/gradle/src/test/kotlin/com/github/l34130/mise/gradle/GradleTest.kt b/modules/products/gradle/src/test/kotlin/com/github/l34130/mise/gradle/GradleTest.kt
new file mode 100644
index 00000000..3a91f056
--- /dev/null
+++ b/modules/products/gradle/src/test/kotlin/com/github/l34130/mise/gradle/GradleTest.kt
@@ -0,0 +1,9 @@
+package com.github.l34130.mise.gradle
+
+import com.intellij.testFramework.fixtures.BasePlatformTestCase
+
+class GradleTest : BasePlatformTestCase() {
+ fun testGradle() {
+ println("GradleTest.testGradle")
+ }
+}
diff --git a/modules/products/idea/build.gradle.kts b/modules/products/idea/build.gradle.kts
index be33ae06..7f62fd82 100644
--- a/modules/products/idea/build.gradle.kts
+++ b/modules/products/idea/build.gradle.kts
@@ -1,4 +1,5 @@
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
+import org.jetbrains.intellij.platform.gradle.TestFrameworkType
fun properties(key: String) = project.findProperty(key).toString()
@@ -9,6 +10,7 @@ plugins {
dependencies {
implementation(project(":mise-core"))
+ testImplementation(libs.junit)
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellijPlatform {
@@ -18,6 +20,6 @@ dependencies {
jetbrainsRuntime()
- instrumentationTools()
+ testFramework(TestFrameworkType.Platform)
}
}
diff --git a/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/jdk/ProjectJdkSetup.kt b/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/jdk/MiseProjectJdkSetup.kt
similarity index 97%
rename from modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/jdk/ProjectJdkSetup.kt
rename to modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/jdk/MiseProjectJdkSetup.kt
index 00c6b70b..48f7c153 100644
--- a/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/jdk/ProjectJdkSetup.kt
+++ b/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/jdk/MiseProjectJdkSetup.kt
@@ -10,7 +10,7 @@ import com.intellij.openapi.projectRoots.ProjectJdkTable
import com.intellij.openapi.roots.ProjectRootManager
import kotlin.reflect.KClass
-class ProjectJdkSetup : AbstractProjectSdkSetup() {
+class MiseProjectJdkSetup : AbstractProjectSdkSetup() {
override fun getDevToolName() = MiseDevToolName("java")
override fun setupSdk(
diff --git a/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/run/IdeaRunConfigurationExtension.kt b/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/run/IdeaRunConfigurationExtension.kt
deleted file mode 100644
index 144dcf2f..00000000
--- a/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/run/IdeaRunConfigurationExtension.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.github.l34130.mise.idea.run
-
-import com.github.l34130.mise.core.command.MiseCommandLineHelper
-import com.github.l34130.mise.core.command.MiseCommandLineNotFoundException
-import com.github.l34130.mise.core.notification.MiseNotificationServiceUtils
-import com.github.l34130.mise.core.run.MiseRunConfigurationSettingsEditor
-import com.github.l34130.mise.core.setting.MiseSettings
-import com.intellij.execution.RunConfigurationExtension
-import com.intellij.execution.configurations.GeneralCommandLine
-import com.intellij.execution.configurations.JavaParameters
-import com.intellij.execution.configurations.RunConfigurationBase
-import com.intellij.execution.configurations.RunnerSettings
-import com.intellij.openapi.components.service
-import com.intellij.openapi.options.SettingsEditor
-import org.jdom.Element
-
-class IdeaRunConfigurationExtension : RunConfigurationExtension() {
- override fun getEditorTitle(): String = MiseRunConfigurationSettingsEditor.EDITOR_TITLE
-
- override fun > createEditor(configuration: P): SettingsEditor
=
- MiseRunConfigurationSettingsEditor(configuration.project)
-
- override fun getSerializationId(): String = MiseRunConfigurationSettingsEditor.SERIALIZATION_ID
-
- override fun readExternal(
- runConfiguration: RunConfigurationBase<*>,
- element: Element,
- ) {
- MiseRunConfigurationSettingsEditor.readExternal(runConfiguration, element)
- }
-
- override fun writeExternal(
- runConfiguration: RunConfigurationBase<*>,
- element: Element,
- ) {
- MiseRunConfigurationSettingsEditor.writeExternal(runConfiguration, element)
- }
-
- override fun > updateJavaParameters(
- configuration: T,
- params: JavaParameters,
- runnerSettings: RunnerSettings?,
- ) {
- val sourceEnv =
- GeneralCommandLine()
- .withEnvironment(params.env)
- .withParentEnvironmentType(
- if (params.isPassParentEnvs) {
- GeneralCommandLine.ParentEnvironmentType.CONSOLE
- } else {
- GeneralCommandLine.ParentEnvironmentType.NONE
- },
- ).effectiveEnvironment
- params.env.putAll(sourceEnv)
-
- val project = configuration.project
- val projectState = project.service().state
- val runConfigState = MiseRunConfigurationSettingsEditor.getMiseRunConfigurationState(configuration)
-
- val (workDir, configEnvironment) = when {
- projectState.useMiseDirEnv -> project.basePath to projectState.miseConfigEnvironment
- runConfigState?.useMiseDirEnv == true -> params.workingDirectory to runConfigState.miseConfigEnvironment
- else -> return
- }
-
- val envVars = MiseCommandLineHelper.getEnvVars(workDir, configEnvironment)
- .fold(
- onSuccess = { envVars -> envVars },
- onFailure = {
- if (it !is MiseCommandLineNotFoundException) {
- MiseNotificationServiceUtils.notifyException("Failed to load environment variables", it)
- }
- emptyMap()
- },
- )
-
- params.env.putAll(envVars)
- }
-
- override fun isApplicableFor(configuration: RunConfigurationBase<*>): Boolean = true
-
- override fun isEnabledFor(
- applicableConfiguration: RunConfigurationBase<*>,
- runnerSettings: RunnerSettings?,
- ): Boolean = true
-}
diff --git a/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/run/MiseIdeaRunConfigurationExtension.kt b/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/run/MiseIdeaRunConfigurationExtension.kt
new file mode 100644
index 00000000..009b736c
--- /dev/null
+++ b/modules/products/idea/src/main/kotlin/com/github/l34130/mise/idea/run/MiseIdeaRunConfigurationExtension.kt
@@ -0,0 +1,86 @@
+package com.github.l34130.mise.idea.run
+
+import com.github.l34130.mise.core.MiseHelper
+import com.github.l34130.mise.core.run.MiseRunConfigurationSettingsEditor
+import com.intellij.execution.RunConfigurationExtension
+import com.intellij.execution.configurations.JavaParameters
+import com.intellij.execution.configurations.RunConfigurationBase
+import com.intellij.execution.configurations.RunnerSettings
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.execution.process.ProcessHandler
+import com.intellij.execution.process.ProcessListener
+import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration
+import com.intellij.openapi.options.SettingsEditor
+import com.intellij.openapi.project.Project
+import org.jdom.Element
+import java.util.concurrent.ConcurrentHashMap
+
+class MiseIdeaRunConfigurationExtension : RunConfigurationExtension() {
+ // Used for cleanup the configuration after the execution has ended.
+ private val runningProcessEnvs = ConcurrentHashMap>()
+
+ override fun getEditorTitle(): String = MiseRunConfigurationSettingsEditor.EDITOR_TITLE
+
+ override fun > createEditor(configuration: P): SettingsEditor
=
+ MiseRunConfigurationSettingsEditor(configuration.project)
+
+ override fun getSerializationId(): String = MiseRunConfigurationSettingsEditor.SERIALIZATION_ID
+
+ override fun readExternal(
+ runConfiguration: RunConfigurationBase<*>,
+ element: Element,
+ ) {
+ MiseRunConfigurationSettingsEditor.readExternal(runConfiguration, element)
+ }
+
+ override fun writeExternal(
+ runConfiguration: RunConfigurationBase<*>,
+ element: Element,
+ ) {
+ MiseRunConfigurationSettingsEditor.writeExternal(runConfiguration, element)
+ }
+
+ override fun > updateJavaParameters(
+ configuration: T,
+ params: JavaParameters,
+ runnerSettings: RunnerSettings?,
+ ) {
+ val envVars = MiseHelper.getMiseEnvVarsOrNotify(configuration, params::getWorkingDirectory)
+ params.env = params.env + envVars
+
+ // Gradle support (and external system configuration)
+ // When user double-clicks the Task in the Gradle tool window.
+ if (configuration is ExternalSystemRunConfiguration) {
+ runningProcessEnvs[configuration.project] = configuration.settings.env.toMap()
+ configuration.settings.env = configuration.settings.env + envVars
+ }
+ }
+
+ override fun attachToProcess(
+ configuration: RunConfigurationBase<*>,
+ handler: ProcessHandler,
+ runnerSettings: RunnerSettings?,
+ ) {
+ if (configuration is ExternalSystemRunConfiguration) {
+ val envsToRestore = runningProcessEnvs.remove(configuration.project) ?: return
+
+ handler.addProcessListener(
+ object : ProcessListener {
+ override fun processTerminated(event: ProcessEvent) {
+ configuration.settings.env.apply {
+ clear()
+ putAll(envsToRestore)
+ }
+ }
+ },
+ )
+ }
+ }
+
+ override fun isApplicableFor(configuration: RunConfigurationBase<*>): Boolean = true
+
+ override fun isEnabledFor(
+ applicableConfiguration: RunConfigurationBase<*>,
+ runnerSettings: RunnerSettings?,
+ ): Boolean = true
+}
diff --git a/modules/products/idea/src/test/kotlin/com/github/l34130/mise/idea/IdeaTest.kt b/modules/products/idea/src/test/kotlin/com/github/l34130/mise/idea/IdeaTest.kt
new file mode 100644
index 00000000..eef3a38c
--- /dev/null
+++ b/modules/products/idea/src/test/kotlin/com/github/l34130/mise/idea/IdeaTest.kt
@@ -0,0 +1,9 @@
+package com.github.l34130.mise.idea
+
+import com.intellij.testFramework.fixtures.BasePlatformTestCase
+
+class IdeaTest : BasePlatformTestCase() {
+ fun testIdea() {
+ println("IdeaTest.testIdea")
+ }
+}
diff --git a/modules/products/nodejs/build.gradle.kts b/modules/products/nodejs/build.gradle.kts
index 3a002ff2..088ab504 100644
--- a/modules/products/nodejs/build.gradle.kts
+++ b/modules/products/nodejs/build.gradle.kts
@@ -1,4 +1,5 @@
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
+import org.jetbrains.intellij.platform.gradle.TestFrameworkType
fun properties(key: String) = project.findProperty(key).toString()
@@ -9,6 +10,7 @@ plugins {
dependencies {
implementation(project(":mise-core"))
+ testImplementation(libs.junit)
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellijPlatform {
@@ -18,7 +20,6 @@ dependencies {
plugins("deno:233.6745.297")
jetbrainsRuntime()
-
- instrumentationTools()
+ testFramework(TestFrameworkType.Platform)
}
}
diff --git a/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/deno/ProjectDenoSetup.kt b/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/deno/MiseProjectDenoSetup.kt
similarity index 95%
rename from modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/deno/ProjectDenoSetup.kt
rename to modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/deno/MiseProjectDenoSetup.kt
index efd24ce3..60577f92 100644
--- a/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/deno/ProjectDenoSetup.kt
+++ b/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/deno/MiseProjectDenoSetup.kt
@@ -12,7 +12,7 @@ import com.intellij.openapi.util.io.FileUtil
import kotlin.io.path.Path
import kotlin.reflect.KClass
-class ProjectDenoSetup : AbstractProjectSdkSetup() {
+class MiseProjectDenoSetup : AbstractProjectSdkSetup() {
override fun getDevToolName() = MiseDevToolName("deno")
override fun setupSdk(
diff --git a/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/node/ProjectNodeSetup.kt b/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/node/MiseProjectNodeSetup.kt
similarity index 97%
rename from modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/node/ProjectNodeSetup.kt
rename to modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/node/MiseProjectNodeSetup.kt
index f5de5434..6a198f6a 100644
--- a/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/node/ProjectNodeSetup.kt
+++ b/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/node/MiseProjectNodeSetup.kt
@@ -15,7 +15,7 @@ import com.intellij.openapi.vfs.LocalFileSystem
import kotlin.io.path.Path
import kotlin.reflect.KClass
-class ProjectNodeSetup : AbstractProjectSdkSetup() {
+class MiseProjectNodeSetup : AbstractProjectSdkSetup() {
override fun getDevToolName() = MiseDevToolName("node")
override fun setupSdk(
diff --git a/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/run/NodeRunConfigurationExtension.kt b/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/run/MiseNodeRunConfigurationExtension.kt
similarity index 56%
rename from modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/run/NodeRunConfigurationExtension.kt
rename to modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/run/MiseNodeRunConfigurationExtension.kt
index 7bae9b25..bd41b615 100644
--- a/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/run/NodeRunConfigurationExtension.kt
+++ b/modules/products/nodejs/src/main/kotlin/com/github/l34130/mise/nodejs/run/MiseNodeRunConfigurationExtension.kt
@@ -1,23 +1,20 @@
package com.github.l34130.mise.nodejs.run
-import com.github.l34130.mise.core.command.MiseCommandLineHelper
-import com.github.l34130.mise.core.command.MiseCommandLineNotFoundException
-import com.github.l34130.mise.core.notification.MiseNotificationServiceUtils
+import com.github.l34130.mise.core.MiseHelper
import com.github.l34130.mise.core.run.MiseRunConfigurationSettingsEditor
-import com.github.l34130.mise.core.setting.MiseSettings
import com.intellij.execution.runners.ExecutionEnvironment
import com.intellij.javascript.nodejs.execution.AbstractNodeTargetRunProfile
import com.intellij.javascript.nodejs.execution.NodeTargetRun
import com.intellij.javascript.nodejs.execution.runConfiguration.AbstractNodeRunConfigurationExtension
import com.intellij.javascript.nodejs.execution.runConfiguration.NodeRunConfigurationLaunchSession
-import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.options.SettingsEditor
+import com.jetbrains.nodejs.run.NodeJsRunConfiguration
import org.jdom.Element
-class NodeRunConfigurationExtension : AbstractNodeRunConfigurationExtension() {
+class MiseNodeRunConfigurationExtension : AbstractNodeRunConfigurationExtension() {
companion object {
- private val LOG = Logger.getInstance(NodeRunConfigurationExtension::class.java)
+ private val LOG = Logger.getInstance(MiseNodeRunConfigurationExtension::class.java)
}
override fun getEditorTitle(): String = MiseRunConfigurationSettingsEditor.EDITOR_TITLE
@@ -45,30 +42,19 @@ class NodeRunConfigurationExtension : AbstractNodeRunConfigurationExtension() {
configuration: AbstractNodeTargetRunProfile,
environment: ExecutionEnvironment,
): NodeRunConfigurationLaunchSession? {
- val project = configuration.project
- val projectState = project.service().state
- val runConfigState = MiseRunConfigurationSettingsEditor.getMiseRunConfigurationState(configuration)
-
- val (workDir, configEnvironment) =
- when {
- projectState.useMiseDirEnv -> project.basePath to projectState.miseConfigEnvironment
- runConfigState?.useMiseDirEnv == true -> environment.modulePath to runConfigState.miseConfigEnvironment
- else -> return null
- }
+ val envVars =
+ MiseHelper.getMiseEnvVarsOrNotify(
+ configuration = configuration,
+ workingDirectory = {
+ when (configuration) {
+ is NodeJsRunConfiguration -> configuration.workingDirectory
+ else -> null
+ }
+ },
+ )
return object : NodeRunConfigurationLaunchSession() {
override fun addNodeOptionsTo(targetRun: NodeTargetRun) {
- val envVars = MiseCommandLineHelper.getEnvVars(workDir, configEnvironment)
- .fold(
- onSuccess = { envVars -> envVars },
- onFailure = {
- if (it !is MiseCommandLineNotFoundException) {
- MiseNotificationServiceUtils.notifyException("Failed to load environment variables", it)
- }
- emptyMap()
- },
- )
-
for ((key, value) in envVars) {
targetRun.commandLineBuilder.addEnvironmentVariable(key, value)
}
diff --git a/modules/products/nodejs/src/test/kotlin/com/github/l34130/mise/nodejs/NodeJsTest.kt b/modules/products/nodejs/src/test/kotlin/com/github/l34130/mise/nodejs/NodeJsTest.kt
new file mode 100644
index 00000000..03418ad3
--- /dev/null
+++ b/modules/products/nodejs/src/test/kotlin/com/github/l34130/mise/nodejs/NodeJsTest.kt
@@ -0,0 +1,9 @@
+package com.github.l34130.mise.nodejs
+
+import com.intellij.testFramework.fixtures.BasePlatformTestCase
+
+class NodeJsTest : BasePlatformTestCase() {
+ fun testNodeJs() {
+ println("NodeJsTest.testNodeJs")
+ }
+}
diff --git a/modules/products/rider/build.gradle.kts b/modules/products/rider/build.gradle.kts
index 71f6fc14..3d0e65b9 100644
--- a/modules/products/rider/build.gradle.kts
+++ b/modules/products/rider/build.gradle.kts
@@ -9,6 +9,7 @@ plugins {
dependencies {
implementation(project(":mise-core"))
+// testImplementation(libs.junit)
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellijPlatform {
@@ -16,6 +17,6 @@ dependencies {
jetbrainsRuntime()
- instrumentationTools()
+// testFramework(TestFrameworkType.Platform)
}
}
diff --git a/modules/products/rider/src/main/kotlin/com/github/l34130/mise/rider/run/RiderPatchCommandLineExtension.kt b/modules/products/rider/src/main/kotlin/com/github/l34130/mise/rider/run/MiseRiderPatchCommandLineExtension.kt
similarity index 65%
rename from modules/products/rider/src/main/kotlin/com/github/l34130/mise/rider/run/RiderPatchCommandLineExtension.kt
rename to modules/products/rider/src/main/kotlin/com/github/l34130/mise/rider/run/MiseRiderPatchCommandLineExtension.kt
index 6dba50ea..6965d42b 100644
--- a/modules/products/rider/src/main/kotlin/com/github/l34130/mise/rider/run/RiderPatchCommandLineExtension.kt
+++ b/modules/products/rider/src/main/kotlin/com/github/l34130/mise/rider/run/MiseRiderPatchCommandLineExtension.kt
@@ -7,7 +7,9 @@ import com.github.l34130.mise.core.setting.MiseSettings
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.execution.process.ProcessInfo
import com.intellij.execution.process.ProcessListener
+import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
+import com.intellij.util.application
import com.jetbrains.rd.util.lifetime.Lifetime
import com.jetbrains.rider.projectView.solutionDirectoryPath
import com.jetbrains.rider.run.PatchCommandLineExtension
@@ -16,7 +18,7 @@ import com.jetbrains.rider.runtime.DotNetRuntime
import org.jetbrains.concurrency.Promise
import org.jetbrains.concurrency.resolvedPromise
-class RiderPatchCommandLineExtension : PatchCommandLineExtension {
+class MiseRiderPatchCommandLineExtension : PatchCommandLineExtension {
override fun patchDebugCommandLine(
lifetime: Lifetime,
workerRunInfo: WorkerRunInfo,
@@ -40,23 +42,25 @@ class RiderPatchCommandLineExtension : PatchCommandLineExtension {
commandLine: GeneralCommandLine,
project: Project,
) {
- val projectState = MiseSettings.getService(project).state
+ val projectState = application.service().state
if (!projectState.useMiseDirEnv) {
return
}
- val miseEnvVars = MiseCommandLineHelper.getEnvVars(
- workDir = project.solutionDirectoryPath.toAbsolutePath().toString(),
- configEnvironment = projectState.miseConfigEnvironment
- ).fold(
- onSuccess = { envVars -> envVars },
- onFailure = {
- if (it !is MiseCommandLineNotFoundException) {
- MiseNotificationServiceUtils.notifyException("Failed to load environment variables", it)
- }
- emptyMap()
- },
- )
+ val miseEnvVars =
+ MiseCommandLineHelper
+ .getEnvVars(
+ workDir = project.solutionDirectoryPath.toAbsolutePath().toString(),
+ configEnvironment = projectState.miseConfigEnvironment,
+ ).fold(
+ onSuccess = { envVars -> envVars },
+ onFailure = {
+ if (it !is MiseCommandLineNotFoundException) {
+ MiseNotificationServiceUtils.notifyException("Failed to load environment variables", it)
+ }
+ emptyMap()
+ },
+ )
commandLine.withEnvironment(miseEnvVars)
}
diff --git a/modules/products/toml/build.gradle.kts b/modules/products/toml/build.gradle.kts
deleted file mode 100644
index 0abbd51e..00000000
--- a/modules/products/toml/build.gradle.kts
+++ /dev/null
@@ -1,23 +0,0 @@
-import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
-
-fun properties(key: String) = project.findProperty(key).toString()
-
-plugins {
- id("org.jetbrains.intellij.platform.module")
- alias(libs.plugins.kotlin) // Kotlin support
-}
-
-dependencies {
- implementation(project(":mise-core"))
-
- // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
- intellijPlatform {
- create(IntelliJPlatformType.IntellijIdeaCommunity, properties("platformVersion"))
-
- bundledPlugin("org.toml.lang")
-
- jetbrainsRuntime()
-
- instrumentationTools()
- }
-}
diff --git a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigCompletionContributor.kt b/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigCompletionContributor.kt
deleted file mode 100644
index 7ca3f4f2..00000000
--- a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigCompletionContributor.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.github.l34130.mise.toml.completion
-
-import com.intellij.codeInsight.completion.CompletionContributor
-import com.intellij.codeInsight.completion.CompletionType
-import com.intellij.patterns.PlatformPatterns
-
-class MiseConfigCompletionContributor : CompletionContributor() {
- init {
- extend(CompletionType.BASIC, PlatformPatterns.psiElement(), MiseConfigCompletionProvider())
- }
-}
diff --git a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigCompletionProvider.kt b/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigCompletionProvider.kt
deleted file mode 100644
index aa7c3300..00000000
--- a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigCompletionProvider.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.github.l34130.mise.toml.completion
-
-import com.github.l34130.mise.core.command.MiseCommandLineHelper
-import com.github.l34130.mise.core.command.MiseTask
-import com.github.l34130.mise.core.icon.MiseIcons
-import com.github.l34130.mise.core.setting.MiseSettings
-import com.intellij.codeInsight.completion.CompletionParameters
-import com.intellij.codeInsight.completion.CompletionProvider
-import com.intellij.codeInsight.completion.CompletionResultSet
-import com.intellij.codeInsight.lookup.LookupElementBuilder
-import com.intellij.openapi.util.io.FileUtil
-import com.intellij.util.ProcessingContext
-import kotlin.io.path.Path
-
-fun normalizePath(path: String) =
- Path(
- FileUtil.expandUserHome(path),
- ).normalize().toAbsolutePath().toString()
-
-class MiseConfigCompletionProvider : CompletionProvider() {
- override fun addCompletions(
- params: CompletionParameters,
- context: ProcessingContext,
- resultSet: CompletionResultSet,
- ) {
- val position = params.position
- val root = position.containingFile
-
- if (!MiseConfigPsiUtils.isInTaskDepends(position)) {
- return
- }
-
- val configEnvironment = MiseSettings.getService(root.project).state.miseConfigEnvironment
- // TODO: Store the tasks in a cache and update them only when the file changes
- // This will prevent unnecessary calls to the CLI or when the file is an invalid state
- val tasksFromMise = MiseCommandLineHelper.getTasks(
- workDir = root.project.basePath,
- configEnvironment = configEnvironment,
- ).fold(
- onSuccess = { tasks -> tasks },
- onFailure = { emptyList() },
- )
-
- val tasksInFile = MiseConfigPsiUtils.getMiseTasks(root)
- val uniqueTasks = HashMap()
- val currentPath =
- normalizePath(
- Path(root.project.basePath ?: "", root.viewProvider.virtualFile.path).toString(),
- )
-
- tasksFromMise
- .filter {
- when (it.source) {
- null -> true
- else -> normalizePath(it.source!!) != currentPath
- }
- }.forEach { uniqueTasks[it.name] = it }
- tasksInFile.forEach { uniqueTasks[it.name] = it }
-
- resultSet.addAllElements(
- uniqueTasks
- .filter { it.key.isNotBlank() }
- .map {
- LookupElementBuilder
- .create(it.key)
- .withIcon(MiseIcons.DEFAULT)
- .withTypeText(it.value.description ?: it.value.command)
- .withCaseSensitivity(false)
- },
- )
- }
-}
diff --git a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigPsiUtils.kt b/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigPsiUtils.kt
deleted file mode 100644
index d5b0c2c7..00000000
--- a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/completion/MiseConfigPsiUtils.kt
+++ /dev/null
@@ -1,146 +0,0 @@
-package com.github.l34130.mise.toml.completion
-
-import com.github.l34130.mise.core.command.MiseTask
-import com.intellij.psi.ElementManipulators
-import com.intellij.psi.PsiElement
-import com.intellij.psi.PsiFile
-import org.toml.lang.psi.TomlArray
-import org.toml.lang.psi.TomlKeyValue
-import org.toml.lang.psi.TomlLiteral
-import org.toml.lang.psi.TomlTable
-
-object MiseConfigPsiUtils {
- fun getMiseTasks(psiFile: PsiFile): List {
- val tasks = mutableListOf()
-
- // Handle table-style tasks ([tasks.abc])
- tasks.addAll(psiFile.children.filterIsInstance().mapNotNull { it.parseTableStyleTask() })
-
- // Handle key-value style tasks (a = 'echo a')
- psiFile.children
- .filterIsInstance()
- .find { it.header.key?.textMatches("tasks") == true }
- ?.let { tasksTable ->
- tasks.addAll(
- tasksTable.entries
- .mapNotNull { it.parseKeyValueStyleTask() },
- )
- }
-
- return tasks
- }
-
- fun isInTaskDepends(psiElement: PsiElement): Boolean {
- val tomlArray = psiElement.parent.parent as? TomlArray ?: return false
- val tomlKeyValue = tomlArray.parent as? TomlKeyValue ?: return false
-
- // Check if we're in a table-style task
- val tomlTable = tomlKeyValue.parent as? TomlTable
- if (tomlTable != null && tomlTable.isMiseTask()) {
- return tomlKeyValue.key.textMatches("depends")
- }
-
- // Check if we're in a key-value style task's depends
- val tasksTable = tomlKeyValue.parent as? TomlTable
- return tasksTable?.header?.key?.textMatches("tasks") == true &&
- tomlKeyValue.key.textMatches("depends")
- }
-}
-
-fun TomlTable.isMiseTask(): Boolean {
- val headerKey = header.key ?: return false
- val firstSegment = headerKey.segments.firstOrNull() ?: return false
- return ElementManipulators.getValueText(firstSegment) == "tasks"
-}
-
-fun TomlTable.parseTableStyleTask(): MiseTask? {
- if (!isMiseTask()) {
- return null
- }
-
- val headerKey = header.key!!
- val segments = headerKey.segments.drop(1) // Skip the initial "tasks" segment
- val taskName = segments.joinToString(".") { ElementManipulators.getValueText(it) }
-
- return parseTaskProperties(entries)?.copy(name = taskName)
-}
-
-fun TomlKeyValue.parseKeyValueStyleTask(): MiseTask? {
- val taskName = ElementManipulators.getValueText(key)
- if (value is TomlLiteral) {
- return MiseTask(
- name = taskName,
- aliases = null,
- depends = null,
- description = null,
- hide = false,
- command = ElementManipulators.getValueText(value as TomlLiteral),
- )
- }
-
- // Handle table-style task definition
- val tableValue = value as? TomlTable ?: return null
- return parseTaskProperties(tableValue.entries)?.copy(name = taskName)
-}
-
-private fun parseTaskProperties(entries: List): MiseTask? {
- var aliases: List? = null
- var depends: List? = null
- var description: String? = null
- var hide = false
- var command: String? = null
-
- for (entry in entries) {
- val key = entry.key
- val value = entry.value
- when {
- key.textMatches("alias") -> {
- when (value) {
- is TomlLiteral -> aliases = listOf(ElementManipulators.getValueText(value))
- is TomlArray ->
- aliases =
- value.elements
- .mapNotNull { it as? TomlLiteral }
- .map { ElementManipulators.getValueText(it) }
- }
- }
-
- key.textMatches("depends") -> {
- when (value) {
- is TomlArray ->
- depends =
- value.elements
- .mapNotNull { it as? TomlLiteral }
- .map { ElementManipulators.getValueText(it) }
- }
- }
-
- key.textMatches("description") -> {
- if (value is TomlLiteral) {
- description = ElementManipulators.getValueText(value)
- }
- }
-
- key.textMatches("hide") -> {
- if (value is TomlLiteral) {
- hide = ElementManipulators.getValueText(value).toBoolean()
- }
- }
-
- key.textMatches("run") -> {
- if (value is TomlLiteral) {
- command = ElementManipulators.getValueText(value)
- }
- }
- }
- }
-
- return MiseTask(
- name = "", // set by caller
- aliases = aliases,
- depends = depends,
- description = description,
- hide = hide,
- command = command,
- )
-}
diff --git a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/editor/MiseRunLineMarkerProvider.kt b/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/editor/MiseRunLineMarkerProvider.kt
deleted file mode 100644
index 7e535efc..00000000
--- a/modules/products/toml/src/main/kotlin/com/github/l34130/mise/toml/editor/MiseRunLineMarkerProvider.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.github.l34130.mise.toml.editor
-
-import com.github.l34130.mise.core.command.MiseRunTaskOnTerminalAction
-import com.github.l34130.mise.core.setting.MiseSettings
-import com.intellij.execution.lineMarker.RunLineMarkerContributor
-import com.intellij.openapi.components.service
-import com.intellij.psi.PsiElement
-import com.intellij.psi.impl.source.tree.LeafPsiElement
-import org.toml.lang.psi.TomlKey
-import org.toml.lang.psi.TomlKeySegment
-import org.toml.lang.psi.TomlKeyValue
-import org.toml.lang.psi.TomlTable
-import org.toml.lang.psi.TomlTableHeader
-
-class MiseRunLineMarkerProvider : RunLineMarkerContributor() {
- override fun getInfo(element: PsiElement): Info? {
- val isMiseFile = element.containingFile.name.contains("mise") && element.containingFile.name.endsWith(".toml")
- if (!isMiseFile || element !is LeafPsiElement) {
- return null
- }
-
- val taskName = getTaskInfo(element) ?: return null
-
- val miseSettings = element.project.service()
- val configEnvironment = miseSettings.state.miseConfigEnvironment
-
- return Info(MiseRunTaskOnTerminalAction(taskName, configEnvironment))
- }
-
- private fun getTaskInfo(element: LeafPsiElement): String? {
- val parent = element.parent ?: return null
-
- if (parent is TomlKeySegment) {
- // Case 1: [tasks] section
- // [tasks]
- // taskname = "..."
- // other = "..."
- val keyValue = parent.parent?.parent
- if (keyValue is TomlKeyValue) {
- val table = findParentTable(keyValue) ?: return null
- if (table.header.key?.text == "tasks") {
- return parent.text
- }
- }
-
- // Case 2: Table-style task [tasks.taskname]
- // [tasks.taskname]
- // run = "..."
- // [tasks.other]
- // run = "..."
- if (parent.parent is TomlKey && parent.parent.parent is TomlTableHeader && element.text != "tasks") {
- val tomlKey = parent.parent as TomlKey
- val segments = tomlKey.segments
- if (segments.size == 2) {
- if (segments[0].text == "tasks") {
- return segments[1].text
- }
- }
- }
- }
-
- return null
- }
-
- private fun findParentTable(element: PsiElement): TomlTable? {
- var current: PsiElement? = element
- while (current != null) {
- if (current is TomlTable) {
- return current
- }
- current = current.parent
- }
- return null
- }
-}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 5e8f1333..f2bb9c69 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,7 +1,7 @@
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
plugins {
- id("org.jetbrains.intellij.platform.settings") version "2.2.0"
+ id("org.jetbrains.intellij.platform.settings") version "2.2.1"
}
dependencyResolutionManagement {
@@ -23,7 +23,6 @@ include(
"modules/products/idea",
"modules/products/nodejs",
"modules/products/rider",
- "modules/products/toml",
)
rootProject.name = "mise"
diff --git a/src/main/resources/META-INF/mise-deno.xml b/src/main/resources/META-INF/mise-deno.xml
index da399596..0327ffc7 100644
--- a/src/main/resources/META-INF/mise-deno.xml
+++ b/src/main/resources/META-INF/mise-deno.xml
@@ -1,11 +1,11 @@
-
+
-
diff --git a/src/main/resources/META-INF/mise-goland.xml b/src/main/resources/META-INF/mise-goland.xml
index 6e82dce1..80994551 100644
--- a/src/main/resources/META-INF/mise-goland.xml
+++ b/src/main/resources/META-INF/mise-goland.xml
@@ -1,15 +1,15 @@
-
+
-
-
diff --git a/src/main/resources/META-INF/mise-gradle.xml b/src/main/resources/META-INF/mise-gradle.xml
index 99af9807..0a4d6aae 100644
--- a/src/main/resources/META-INF/mise-gradle.xml
+++ b/src/main/resources/META-INF/mise-gradle.xml
@@ -1,6 +1,6 @@
-
diff --git a/src/main/resources/META-INF/mise-idea.xml b/src/main/resources/META-INF/mise-idea.xml
index 3219269a..e143aec2 100644
--- a/src/main/resources/META-INF/mise-idea.xml
+++ b/src/main/resources/META-INF/mise-idea.xml
@@ -1,13 +1,13 @@
-
-
+
-
diff --git a/src/main/resources/META-INF/mise-nodejs.xml b/src/main/resources/META-INF/mise-nodejs.xml
index aa0b488b..c61fcf3d 100644
--- a/src/main/resources/META-INF/mise-nodejs.xml
+++ b/src/main/resources/META-INF/mise-nodejs.xml
@@ -1,15 +1,15 @@
-
+
-
diff --git a/src/main/resources/META-INF/mise-rider.xml b/src/main/resources/META-INF/mise-rider.xml
index dd581cd5..dd4f7f2e 100644
--- a/src/main/resources/META-INF/mise-rider.xml
+++ b/src/main/resources/META-INF/mise-rider.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/src/main/resources/META-INF/mise-toml.xml b/src/main/resources/META-INF/mise-toml.xml
deleted file mode 100644
index fa0e678d..00000000
--- a/src/main/resources/META-INF/mise-toml.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 15d810c9..f6b12128 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -5,6 +5,44 @@
134130
com.intellij.modules.platform
+ org.toml.lang
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
com.intellij.java
JavaScript
com.intellij.modules.rider
- org.toml.lang