Skip to content

Commit 939cfe7

Browse files
committed
feat(run-service): refactor createConfiguration method to use PSI file lookup and create RunConfigurationSettings instance. This refactoring improves the readability and maintainability of the RunService class. #100
1 parent 1c48d01 commit 939cfe7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/kotlin/cc/unitmesh/devti/provider/RunService.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ interface RunService {
2323
*/
2424
fun runConfigurationClass(project: Project): Class<out RunProfile>?
2525

26-
fun psiFileClass(project: Project): Class<out PsiElement>
27-
26+
/**
27+
* Creates a new run configuration for the given project and virtual file.
28+
*
29+
* 1. Looks up the PSI file from the virtual file using `PsiManager.getInstance(project).findFile(virtualFile)`.
30+
* 2. Creates a RunConfigurationSettings instance with the name "name" and the specified RunConfigurationType using `RunManager.getInstance(project).createConfiguration("name", RunConfigurationType)`.
31+
*
32+
* @param project The project for which to create the run configuration.
33+
* @param virtualFile The virtual file to associate with the run configuration.
34+
* @return The newly created RunConfiguration, or `null` if creation failed.
35+
*/
2836
fun createConfiguration(project: Project, virtualFile: VirtualFile): RunConfiguration? = null
2937

3038
/**

0 commit comments

Comments
 (0)