diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml
index 7cccd40..c9f1dc2 100644
--- a/resources/META-INF/plugin.xml
+++ b/resources/META-INF/plugin.xml
@@ -7,6 +7,7 @@
version 0.0.8
Features
+ - improve detecting extras [#39]
- improve showing popup [#38]
- improve handling invalid interpreter [#37]
diff --git a/src/com/koxudaxi/poetry/PoetryExtrasLineMarkerContributor.kt b/src/com/koxudaxi/poetry/PoetryExtrasLineMarkerContributor.kt
index 7484721..cee5f89 100644
--- a/src/com/koxudaxi/poetry/PoetryExtrasLineMarkerContributor.kt
+++ b/src/com/koxudaxi/poetry/PoetryExtrasLineMarkerContributor.kt
@@ -5,9 +5,7 @@ import com.intellij.icons.AllIcons.Actions.Install
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.psi.PsiElement
import com.jetbrains.python.sdk.pythonSdk
-import org.toml.lang.psi.TomlKey
-import org.toml.lang.psi.TomlKeyValue
-import org.toml.lang.psi.TomlTable
+import org.toml.lang.psi.*
object PoetryExtrasLineMarkerContributor : RunLineMarkerContributor() {
override fun getInfo(element: PsiElement): Info? {
@@ -17,7 +15,9 @@ object PoetryExtrasLineMarkerContributor : RunLineMarkerContributor() {
val keyValue = element.parent as? TomlKeyValue ?: return null
val names = (keyValue.parent as? TomlTable)?.header?.names ?: return null
if (names.joinToString(".") { it.text } != "tool.poetry.extras") return null
- if (keyValue.key.text == null || keyValue.value?.text == null) return null
+ if (keyValue.key.text == null) return null
+ val value = keyValue.value as? TomlArray ?: return null
+ if (value.elements.isEmpty() || value.elements.any { it !is TomlLiteral || it.textLength < 3}) return null
val action =ActionManager.getInstance().getAction(PoetryInstallExtras.actionID)
return Info(Install, { parameter -> "Install " + ((parameter as? TomlKey)?.text ?: "extra")}, arrayOf(action))
}