Skip to content

Instantly share code, notes, and snippets.

@dkandalov
Created October 29, 2024 16:15
Show Gist options
  • Save dkandalov/3c3984ac39b51883920f019ff91f1351 to your computer and use it in GitHub Desktop.
Save dkandalov/3c3984ac39b51883920f019ff91f1351 to your computer and use it in GitHub Desktop.
@file:Suppress("UnstableApiUsage")
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl
import liveplugin.registerAction
// Action to remove panel at the top of the editor, e.g. "Kotlin script is in beta" panel.
registerAction("Remove Top Editor Component", "ctrl meta H") { event ->
val project = event.project ?: return@registerAction
val editorManager = FileEditorManager.getInstance(project) as FileEditorManagerImpl
val editor = editorManager.selectedEditor ?: return@registerAction
editorManager.getTopComponents(editor).forEach {
editorManager.removeTopComponent(editor, it)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment