From 78ae86fec961e32032f910bb8e9bd8ad1f07cf2a Mon Sep 17 00:00:00 2001 From: Alex Berezhnykh Date: Tue, 25 Apr 2023 03:05:35 +0300 Subject: [PATCH 1/3] Frontend/Intentions: add tag --- rider-fsharp/src/main/resources/META-INF/plugin.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rider-fsharp/src/main/resources/META-INF/plugin.xml b/rider-fsharp/src/main/resources/META-INF/plugin.xml index 98e6e2dfb2..1e1610756b 100644 --- a/rider-fsharp/src/main/resources/META-INF/plugin.xml +++ b/rider-fsharp/src/main/resources/META-INF/plugin.xml @@ -60,24 +60,28 @@ + F# com.jetbrains.rider.plugins.fsharp.services.fsi.SendLineToFsiIntentionAction F# SendToFsi + F# com.jetbrains.rider.plugins.fsharp.services.fsi.SendSelectionToFsiIntentionAction F# SendToFsi + F# com.jetbrains.rider.plugins.fsharp.services.fsi.DebugLineInFsiIntentionAction F# SendToFsi + F# com.jetbrains.rider.plugins.fsharp.services.fsi.DebugSelectionInFsiIntentionAction F# SendToFsi From cdd09678ec71675c5e08620a144a8638f8b48f64 Mon Sep 17 00:00:00 2001 From: Alex Berezhnykh Date: Thu, 11 May 2023 03:37:02 +0300 Subject: [PATCH 2/3] remove redundant checks --- .../rider/plugins/fsharp/services/fsi/SendToFsiActions.kt | 7 +++---- rider-fsharp/src/main/resources/META-INF/plugin.xml | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt b/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt index acedcaf4a3..07ea8514c2 100644 --- a/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt +++ b/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt @@ -10,7 +10,6 @@ import com.intellij.openapi.util.Iconable import com.intellij.openapi.util.SystemInfo import com.intellij.psi.PsiElement import com.jetbrains.rd.platform.util.getComponent -import com.jetbrains.rider.ideaInterop.fileTypes.fsharp.FSharpLanguageBase import icons.ReSharperIcons import javax.swing.Icon @@ -55,9 +54,9 @@ open class SendToFsiActionBase( e.presentation.isVisible = false return } - val file = CommonDataKeys.PSI_FILE.getData(e.dataContext) + CommonDataKeys.PSI_FILE.getData(e.dataContext) val editor = CommonDataKeys.EDITOR.getData(e.dataContext) - if (file?.language !is FSharpLanguageBase || editor?.caretModel?.caretCount != 1) { + if (editor?.caretModel?.caretCount != 1) { e.presentation.isEnabled = false return } @@ -99,7 +98,7 @@ abstract class BaseSendToFsiIntentionAction(private val debug: Boolean, private override fun startInWriteAction() = false override fun isAvailable(project: Project, editor: Editor?, file: PsiElement) = - isAvailable && file.language is FSharpLanguageBase && editor?.caretModel?.caretCount == 1 + isAvailable && editor?.caretModel?.caretCount == 1 override fun invoke(project: Project, editor: Editor, element: PsiElement) { project.getComponent().sendToFsi(editor, element.containingFile, debug) diff --git a/rider-fsharp/src/main/resources/META-INF/plugin.xml b/rider-fsharp/src/main/resources/META-INF/plugin.xml index 1e1610756b..3ded2c5ee5 100644 --- a/rider-fsharp/src/main/resources/META-INF/plugin.xml +++ b/rider-fsharp/src/main/resources/META-INF/plugin.xml @@ -60,30 +60,30 @@ - F# com.jetbrains.rider.plugins.fsharp.services.fsi.SendLineToFsiIntentionAction F# + F# SendToFsi - F# com.jetbrains.rider.plugins.fsharp.services.fsi.SendSelectionToFsiIntentionAction F# + F# SendToFsi - F# com.jetbrains.rider.plugins.fsharp.services.fsi.DebugLineInFsiIntentionAction F# + F# SendToFsi - F# com.jetbrains.rider.plugins.fsharp.services.fsi.DebugSelectionInFsiIntentionAction F# + F# SendToFsi From 73469253149395df52e1b605117e52c86e6b2670 Mon Sep 17 00:00:00 2001 From: Alex Berezhnykh Date: Thu, 11 May 2023 18:40:14 +0300 Subject: [PATCH 3/3] run actions on a background thread --- .../rider/plugins/fsharp/services/fsi/SendToFsiActions.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt b/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt index 07ea8514c2..619a7f6991 100644 --- a/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt +++ b/rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/SendToFsiActions.kt @@ -40,6 +40,8 @@ open class SendToFsiActionBase( private val sendSelectionText: String ) : AnAction(), DumbAware { + override fun getActionUpdateThread() = ActionUpdateThread.BGT + override fun actionPerformed(e: AnActionEvent) { val editor = CommonDataKeys.EDITOR.getData(e.dataContext)!! val file = CommonDataKeys.PSI_FILE.getData(e.dataContext)!!