File tree Expand file tree Collapse file tree 4 files changed +78
-3
lines changed
kotlin/cc/unitmesh/devti/language
src/main/resources/messages Expand file tree Collapse file tree 4 files changed +78
-3
lines changed Original file line number Diff line number Diff line change
1
+ package cc.unitmesh.devti.language.actions
2
+
3
+ import cc.unitmesh.devti.AutoDevNotifications
4
+ import com.intellij.execution.actions.ConfigurationContext
5
+ import com.intellij.openapi.actionSystem.ActionUpdateThread
6
+ import com.intellij.openapi.actionSystem.AnActionEvent
7
+ import com.intellij.openapi.actionSystem.CommonDataKeys
8
+ import com.intellij.openapi.project.DumbAwareAction
9
+ import org.jetbrains.annotations.NonNls
10
+
11
+ class DevInRunFileAction : DumbAwareAction () {
12
+ override fun getActionUpdateThread (): ActionUpdateThread = ActionUpdateThread .BGT
13
+
14
+ override fun update (e : AnActionEvent ) {
15
+ val file = e.getData(CommonDataKeys .PSI_FILE ) ? : return
16
+ if (e.presentation.text.isNullOrBlank()) {
17
+ e.presentation.text = " Run DevIn file: ${file.name} "
18
+ }
19
+ }
20
+
21
+ override fun actionPerformed (e : AnActionEvent ) {
22
+ val file =
23
+ e.getData(CommonDataKeys .PSI_FILE ) ? : return
24
+ val virtualFile = file.virtualFile ? : return
25
+
26
+
27
+ val project = file.project
28
+ val context = ConfigurationContext .getFromContext(e.dataContext, e.place)
29
+
30
+ AutoDevNotifications .notify(project, " Run file action" )
31
+ }
32
+
33
+ companion object {
34
+ val ID : @NonNls String = " runDevInFileAction"
35
+ }
36
+
37
+ }
Original file line number Diff line number Diff line change
1
+ package cc.unitmesh.devti.language.run
2
+
3
+ import cc.unitmesh.devti.language.DevInLanguage
4
+ import cc.unitmesh.devti.language.actions.DevInRunFileAction
5
+ import cc.unitmesh.devti.language.psi.DevInFile
6
+ import com.intellij.execution.lineMarker.RunLineMarkerContributor
7
+ import com.intellij.icons.AllIcons
8
+ import com.intellij.openapi.actionSystem.ActionManager
9
+ import com.intellij.openapi.actionSystem.AnAction
10
+ import com.intellij.psi.PsiElement
11
+
12
+ class DevInRunLineMarkersProvider : RunLineMarkerContributor () {
13
+ override fun getInfo (element : PsiElement ): Info ? {
14
+ if (element.language !is DevInLanguage || element.textRange.startOffset != 0 ) return null
15
+
16
+ val psiFile = element.containingFile
17
+ if (psiFile !is DevInFile ) return null
18
+
19
+ val actions = arrayOf<AnAction >(ActionManager .getInstance().getAction(DevInRunFileAction .ID ))
20
+
21
+ return Info (
22
+ AllIcons .RunConfigurations .TestState .Run , { " Run DevIn file: ${psiFile.name} " }, * actions
23
+ )
24
+ }
25
+ }
Original file line number Diff line number Diff line change 8
8
<fileType name =" DevInFile" implementationClass =" cc.unitmesh.devti.language.DevInFileType" fieldName =" INSTANCE"
9
9
language =" DevIn" extensions =" devin" />
10
10
11
- <lang .parserDefinition language =" DevIn" implementationClass =" cc.unitmesh.devti.language.parser.DevInParserDefinition" />
11
+ <lang .parserDefinition language =" DevIn"
12
+ implementationClass =" cc.unitmesh.devti.language.parser.DevInParserDefinition" />
12
13
<lang .syntaxHighlighterFactory language =" DevIn"
13
14
implementationClass =" cc.unitmesh.devti.language.highlight.DevInSyntaxHighlighterFactory" />
14
15
28
29
29
30
<languageInjector implementation =" cc.unitmesh.devti.language.DevInLanguageInjector" />
30
31
31
- <configurationType implementation =" cc.unitmesh.devti.language.run.AutoDevConfigurationType" />
32
- <programRunner implementation =" cc.unitmesh.devti.language.run.DevInCommandRunner" />
32
+
33
+ <runLineMarkerContributor language =" DevIn"
34
+ implementationClass =" cc.unitmesh.devti.language.run.DevInRunLineMarkersProvider" />
35
+
36
+ <!-- <configurationType implementation="cc.unitmesh.devti.language.run.AutoDevConfigurationType"/>-->
37
+ <!-- <programRunner implementation="cc.unitmesh.devti.language.run.DevInCommandRunner"/>-->
33
38
</extensions >
39
+
40
+ <actions >
41
+ <action id =" runDevInFileAction"
42
+ class =" cc.unitmesh.devti.language.actions.DevInRunFileAction"
43
+ use-shortcut-of =" RunClass"
44
+ />
45
+ </actions >
34
46
</idea-plugin >
Original file line number Diff line number Diff line change @@ -147,3 +147,4 @@ autoarkui.generate=Auto Generate ArkUI
147
147
autoarkui.generate.clarify =Clarify Requirements
148
148
autoarkui.generate.design =Design Page
149
149
devin.ref.loading =Loading git revision
150
+ line.marker.run.0 =Run {0}
You can’t perform that action at this time.
0 commit comments