File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/main/kotlin/cc/unitmesh/devti/gui/snippet Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,17 @@ class AutoDevRunDevInsAction : DumbAwareAction() {
13
13
override fun getActionUpdateThread (): ActionUpdateThread = ActionUpdateThread .EDT
14
14
15
15
override fun update (e : AnActionEvent ) {
16
- val editor = e.getData(com.intellij.openapi.actionSystem.PlatformDataKeys .EDITOR ) ? : return
17
16
val project = e.project ? : return
17
+ val editor = e.getData(com.intellij.openapi.actionSystem.PlatformDataKeys .EDITOR ) ? : return
18
18
val document = editor.document
19
19
val file = FileDocumentManager .getInstance().getFile(document) ? : return
20
20
21
- val language = PsiManager .getInstance(project).findFile(file)?.language?.id ? : return
21
+ val language = try {
22
+ PsiManager .getInstance(project).findFile(file)?.language?.id
23
+ } catch (e: Exception ) {
24
+ null
25
+ } ? : return
26
+
22
27
e.presentation.isEnabled = language == " HTTP Request" || (language == " DevIn" && hasDevInProcessor(language))
23
28
}
24
29
You can’t perform that action at this time.
0 commit comments