File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed
src/main/kotlin/com/github/tempest/framework Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ import com.jetbrains.php.lang.psi.elements.Method
1111
1212class ConsoleCommandLineMarkerProvider : RunLineMarkerContributor () {
1313 override fun getInfo (element : PsiElement ) = when {
14- element !is Method -> null
14+ element.parent !is Method -> null
15+ (element.parent as ? Method )?.nameIdentifier != element -> null
1516 else -> {
16- val commandName = element.getConsoleCommandName() ? : return null
17+ val commandName = ( element.parent as ? Method )? .getConsoleCommandName() ? : return null
1718 Info (
1819 AllIcons .Actions .Execute ,
1920 ExecutorAction .getActions(1 ),
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class TempestRunConfigurationProducer : LazyRunConfigurationProducer<TempestCons
1414 context : ConfigurationContext ,
1515 sourceElement : Ref <PsiElement >
1616 ): Boolean {
17- val element = context.psiLocation as ? Method ? : return false
17+ val element = context.psiLocation?.parent as ? Method ? : return false
1818 val commandName = element.getConsoleCommandName() ? : return false
1919
2020 configuration.settings.commandName = commandName
@@ -25,9 +25,9 @@ class TempestRunConfigurationProducer : LazyRunConfigurationProducer<TempestCons
2525
2626 override fun isConfigurationFromContext (
2727 configuration : TempestConsoleCommandRunConfiguration ,
28- context : ConfigurationContext
28+ context : ConfigurationContext ,
2929 ): Boolean {
30- val method = context.psiLocation as ? Method ? : return false
30+ val method = context.psiLocation?.parent as ? Method ? : return false
3131
3232 return configuration.settings.commandName == method.getConsoleCommandName()
3333 }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import com.intellij.psi.util.PsiTreeUtil
66import com.jetbrains.php.PhpIndex
77import com.jetbrains.php.lang.psi.PhpFile
88import com.jetbrains.php.lang.psi.elements.Method
9+ import com.jetbrains.php.lang.psi.elements.PhpClass
910import com.jetbrains.php.lang.psi.elements.Variable
1011
1112fun PhpFile.getPhpViewVariables (): Set <Variable > {
@@ -17,14 +18,19 @@ fun PhpFile.getPhpViewVariables(): Set<Variable> {
1718}
1819
1920fun Method.getConsoleCommandName (): String? {
20- return this
21- .getAttributes( TempestFrameworkClasses . ConsoleCommand )
21+ return getAttributes( TempestFrameworkClasses . ConsoleCommand )
22+ .apply { if ( this .isEmpty()) return null }
2223 .firstOrNull()
2324 ?.arguments
2425 ?.run { this .find { it.name == " name" } ? : firstOrNull() }
2526 ?.argument
2627 ?.value
2728 ?.run { StringUtil .unquoteString(this ) }
29+ ? : " ${containingClass?.getConsoleCommandNamePrefix()} :${name} "
30+ }
31+
32+ fun PhpClass.getConsoleCommandNamePrefix (): String {
33+ return name.substringBefore(" Command" ).lowercase()
2834}
2935
3036fun PhpIndex.getMethodsByFQN (fqn : String ): Collection <Method > {
You can’t perform that action at this time.
0 commit comments