Skip to content

Commit

Permalink
Return nullability of editor in action
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPl292 committed Jul 29, 2024
1 parent e61fed2 commit bd53a89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal class IjActionExecutor : VimActionExecutor {
* @param ijAction The action to execute
* @param context The context to run it in
*/
override fun executeAction(editor: VimEditor, action: NativeAction, context: ExecutionContext): Boolean {
override fun executeAction(editor: VimEditor?, action: NativeAction, context: ExecutionContext): Boolean {
val ijAction = (action as IjNativeAction).action

/**
Expand All @@ -77,7 +77,10 @@ internal class IjActionExecutor : VimActionExecutor {
dataContext.putUserData(runFromVimKey, true)

val contextComponent = PlatformCoreDataKeys.CONTEXT_COMPONENT.getData(dataContext)
?: editor.ij.component
?: editor?.ij?.component ?: run {
LOG.error("Cannot get context component")
return false
}

val result = withRunningAction {
val result = withStringRegistryOption {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface VimActionExecutor {
* @param action The action to execute
* @param context The context to run it in
*/
fun executeAction(editor: VimEditor, action: NativeAction, context: ExecutionContext): Boolean
fun executeAction(editor: VimEditor?, action: NativeAction, context: ExecutionContext): Boolean

/**
* Execute an action by name
Expand Down

0 comments on commit bd53a89

Please sign in to comment.