Skip to content

Commit

Permalink
Fix the issue with the status bar icon
Browse files Browse the repository at this point in the history
In the 2023.3 EAP call to isAvailable seems to happen much earlier than it used to be.
This caused the fact that `injector` is not yet initialised at that moment and we fail with an exception. All other status bar icons are also not loaded because of this exception.
Adding `VimPlugin.getInstance()` is a quick workaround to initialize the needed injector
  • Loading branch information
AlexPl292 committed Oct 28, 2023
1 parent d8ce20c commit 5e4ee1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/maddyhome/idea/vim/ui/ShowCmd.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.intellij.openapi.wm.WindowManager
import com.intellij.openapi.wm.impl.status.EditorBasedWidget
import com.intellij.openapi.wm.impl.status.widget.StatusBarWidgetsManager
import com.intellij.util.Consumer
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.helper.EngineStringHelper
Expand Down Expand Up @@ -86,7 +87,10 @@ internal class ShowCmdStatusBarWidgetFactory : StatusBarWidgetFactory/*, LightEd
// Nothing
}

override fun isAvailable(project: Project): Boolean = injector.globalOptions().showcmd
override fun isAvailable(project: Project): Boolean {
VimPlugin.getInstance()
return injector.globalOptions().showcmd
}

override fun createWidget(project: Project): StatusBarWidget = Widget(project)

Expand Down

0 comments on commit 5e4ee1b

Please sign in to comment.