-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(line-markers): Add support for running files (#17)
* Rename .java to .kt * feat(line-markers): Add support for running files The line markers now works, however they always run the whole file. * feat(line-markers): Add support for running files The line markers now works, however they always run the whole file.
- Loading branch information
1 parent
2ad5f61
commit 68c5272
Showing
9 changed files
with
79 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
src/main/java/com/pestphp/pest/action/BasePestRunAction.java
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
src/main/java/com/pestphp/pest/action/CreateRunSingleTestAction.java
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
src/main/java/com/pestphp/pest/action/RunSingleTestAction.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
src/main/java/com/pestphp/pest/configuration/PestRunConfigurationProducer.java
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
src/main/kotlin/com/pestphp/pest/configuration/PestRunConfigurationProducer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.pestphp.pest.configuration | ||
|
||
import com.intellij.execution.configurations.ConfigurationFactory | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.util.Condition | ||
import com.intellij.openapi.vfs.VirtualFile | ||
import com.intellij.psi.PsiDirectory | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.PsiFile | ||
import com.intellij.util.Function | ||
import com.jetbrains.php.lang.psi.elements.FunctionReference | ||
import com.jetbrains.php.testFramework.run.PhpTestConfigurationProducer | ||
import com.pestphp.pest.PestUtil | ||
|
||
class PestRunConfigurationProducer : PhpTestConfigurationProducer<PestRunConfiguration?>( | ||
PestRunConfiguration.VALIDATOR, | ||
FILE_TO_SCOPE, | ||
METHOD_NAMER, | ||
METHOD | ||
) { | ||
override fun getConfigurationFactory(): ConfigurationFactory = PestRunConfigurationType.getInstance() | ||
|
||
override fun isEnabled(project: Project): Boolean = PestUtil.isEnabled(project) | ||
|
||
override fun getWorkingDirectory(element: PsiElement): VirtualFile? { | ||
if (element is PsiDirectory) { | ||
return element.parentDirectory?.virtualFile | ||
} | ||
|
||
return element.containingFile?.containingDirectory?.virtualFile | ||
} | ||
|
||
companion object { | ||
private val METHOD = Condition<PsiElement> { element: PsiElement? -> | ||
(element is FunctionReference | ||
&& PestUtil.isPestTestFunction((element as FunctionReference?)!!)) | ||
} | ||
private val METHOD_NAMER = Function<PsiElement, String?> { element: PsiElement? -> | ||
if (element is FunctionReference) { | ||
PestUtil.getTestName(element) | ||
} | ||
null | ||
} | ||
private val FILE_TO_SCOPE = Function<PsiFile, PsiElement?> { file: PsiFile? -> | ||
if (PestUtil.isPestTestFile(file)) { | ||
return@Function file | ||
} | ||
null | ||
} | ||
} | ||
} |