KT-34692: Invoke ScratchAction::update without invokeLater
- `invokeLater` is bad here, since `AnAction::update` must update action look immediately, not later in the future
- Because of `invokeLater`, `RunScratchAction` wasn't properly rendered in the context menu
- `invokeLater` was added in the a24da280ca to fix EA-210180
- EA-210180 is not reproducible; however, the main reason of the exception is that `AnAction::update` was called not from EDT, but from regular thread updating "Run From Here" (>>) gutter actions
- all exception under EA-210180 are from 1.3.50; my guess is that those exceptions were caused by changes in scratch editor implementation details and will not appear again; if they will, we will need to investigate them
- ^KT-34692 Fixed
This commit is contained in:
committed by
Roman Golyshev
parent
28ec74648e
commit
bcee8ce04b
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.idea.scratch.getScratchFileFromSelectedEditor
|
||||
import javax.swing.Icon
|
||||
|
||||
abstract class ScratchAction(message: String, icon: Icon) : AnAction(message, message, icon) {
|
||||
override fun update(e: AnActionEvent) = ApplicationManager.getApplication().invokeLater {
|
||||
override fun update(e: AnActionEvent) {
|
||||
val scratchFile = e.getData(CommonDataKeys.EDITOR)
|
||||
?.let { TextEditorProvider.getInstance().getTextEditor(it).getScratchFile() }
|
||||
?: e.project?.let { getScratchFileFromSelectedEditor(it) }
|
||||
|
||||
Reference in New Issue
Block a user