idea-plugin / arrow.meta.ide.dsl.application / ApplicationSyntax

ApplicationSyntax

interface ApplicationSyntax

multi-purpose algebra to interact with the Ide lifecycle through hijacking and replacing existing services or adding lifecycle related extensions that run at their respective phase. Services can be distributed across the ide in three different kinds at application-level, project-level or module-level. The intellij platform distributes an isolated instance depending on the level - isolated in terms of other instances -, that means an application-level service has solely one instance, whereas module-level services have an instance for each module. Though it is possible to register module-level services with Meta it is not advised to do so, due to high memory consumption.

Properties

availableServices accumulates all available services for loaded Pluginsopen val ApplicationSyntax.availableServices: List<ServiceDescriptor>

Functions

addAppLifecycleListener open fun IdeMetaPlugin.addAppLifecycleListener(listener: AppLifecycleListener): ExtensionPhase
registers an AppLifecycleListener.open fun IdeMetaPlugin.addAppLifecycleListener(appClosing: () -> Unit = Noop.effect0, projectOpenFailed: () -> Unit = Noop.effect0, appFrameCreated: (cliArgs: MutableList<String>) -> Unit = Noop.effect1, welcomeScreenDisplayed: () -> Unit = Noop.effect0, projectFrameClosed: () -> Unit = Noop.effect0, appStarting: (cliProject: Project?) -> Unit = Noop.effect1, appWillBeClosed: (restarted: Boolean) -> Unit = Noop.effect1): ExtensionPhase
addAppService registers an application-level service and the instance. The IntelliJ Platform ensures that only one instance of instance per application is instantiated. even though the service can be retrieved multiple times with ServiceManager.getService or com.intellij.openapi.project.Project.getService for project-level services. It is impeccable that there is only one instance implementation for a given service to fulfill coherence in the ide. The ide will throw an exception, if that premise is not met.open fun <A : Any> IdeMetaPlugin.addAppService(service: Class<A>, instance: (A?) -> A?): ExtensionPhase
addBackgroundPostStartupActivity registers an StartupActivity.Background, which is isomorphic to StartupActivity only with a 5 second delay executing StartupActivity.runActivity. See https://github.com/JetBrains/intellij-community/blob/master/platform/service-container/overview.md#startup-activityopen fun IdeMetaPlugin.addBackgroundPostStartupActivity(activity: Background): ExtensionPhase
addModuleListener registers an ModuleListeneropen fun IdeMetaPlugin.addModuleListener(moduleAdded: (project: Project, module: Module) -> Unit, moduleRemoved: (project: Project, module: Module) -> Unit, beforeModuleRemoved: (project: Project, module: Module) -> Unit, modulesRenamed: (project: Project, modules: List<Module>, oldNames: (Module) -> String) -> Unit): ExtensionPhase
addPostStartupActivity open fun IdeMetaPlugin.addPostStartupActivity(activity: StartupActivity): ExtensionPhase
addPreloadingActivity open fun IdeMetaPlugin.addPreloadingActivity(activity: PreloadingActivity): ExtensionPhase
registers an activity, which is executed eagerly in the background on startup.open fun IdeMetaPlugin.addPreloadingActivity(preload: (ProgressIndicator) -> Unit): ExtensionPhase
addProjectLifecycle registers a ProjectLifecycleopen fun IdeMetaPlugin.addProjectLifecycle(initialize: ProjectLifecycle.(Project) -> Unit = Noop.effect2, afterProjectClosed: ProjectLifecycle.(Project) -> Unit = Noop.effect2, dispose: ProjectLifecycle.() -> Unit = Noop.effect1, beforeProjectLoaded: ProjectLifecycle.(Project) -> Unit = Noop.effect2, postStartupActivitiesPassed: ProjectLifecycle.(Project) -> Unit = Noop.effect2): ExtensionPhase
addProjectLifecycleListener registers a ProjectLifecycleListeneropen fun ApplicationSyntax.addProjectLifecycleListener(beforeProjectLoaded: (Project) -> Unit = Noop.effect1, initialize: (Project) -> Unit = Noop.effect1, postStartupActivitiesPassed: (Project) -> Unit = Noop.effect1, afterProjectClosed: (Project) -> Unit = Noop.effect1): ExtensionPhase
addProjectService registers a project service instance once all project components are initialized. Contrary to addAppService this extension only works for existing services that have been declared in the plugin.xml, due to it’s current implementation in the Meta internals.open fun <A : Any> IdeMetaPlugin.addProjectService(service: Class<A>, instance: (Project, A?) -> A?): ExtensionPhase
appLifecycleListener open fun ApplicationSyntax.appLifecycleListener(appClosing: () -> Unit = Noop.effect0, projectOpenFailed: () -> Unit = Noop.effect0, appFrameCreated: (cliArgs: MutableList<String>) -> Unit = Noop.effect1, welcomeScreenDisplayed: () -> Unit = Noop.effect0, projectFrameClosed: () -> Unit = Noop.effect0, appStarting: (cliProject: Project?) -> Unit = Noop.effect1, appWillBeClosed: (restarted: Boolean) -> Unit = Noop.effect1): AppLifecycleListener
ctx open fun PsiElement.ctx(): CompilerContext?
open fun Project.ctx(): CompilerContext?
moduleListener open fun ApplicationSyntax.moduleListener(moduleAdded: (project: Project, module: Module) -> Unit, moduleRemoved: (project: Project, module: Module) -> Unit, beforeModuleRemoved: (project: Project, module: Module) -> Unit, modulesRenamed: (project: Project, modules: List<Module>, oldNames: (Module) -> String) -> Unit): ModuleListener
overrideService overrides a Service interface from with to, when override == true. from and to need to have a type relationship, either through subtyping or other means like type-proofs. The application will raise an error at runtime if the latter is not valid or when override == false and there is already a service instance associated with from.open fun IdeMetaPlugin.overrideService(from: Class<*>, to: Class<*>, override: Boolean = true): ExtensionPhase
preloadingActivity open fun ApplicationSyntax.preloadingActivity(preload: (ProgressIndicator) -> Unit): PreloadingActivity
projectLifecycleListener Order: beforeProjectLoaded then initialize then postStartupActivitiesPassed then afterProjectClosedopen fun ApplicationSyntax.projectLifecycleListener(beforeProjectLoaded: ProjectLifecycle.(Project) -> Unit = Noop.effect2, initialize: ProjectLifecycle.(Project) -> Unit = Noop.effect2, postStartupActivitiesPassed: ProjectLifecycle.(Project) -> Unit = Noop.effect2, afterProjectClosed: ProjectLifecycle.(Project) -> Unit = Noop.effect2, dispose: ProjectLifecycle.() -> Unit = Noop.effect1): ProjectLifecycleopen fun ApplicationSyntax.projectLifecycleListener(beforeProjectLoaded: (Project) -> Unit = Noop.effect1, initialize: (Project) -> Unit = Noop.effect1, postStartupActivitiesPassed: (Project) -> Unit = Noop.effect1, afterProjectClosed: (Project) -> Unit = Noop.effect1): ProjectLifecycleListener
registerMetaPlugin convenience extension to register the CliPlugins from an IdeMetaPlugin Pluginopen fun IdeMetaPlugin.registerMetaPlugin(conf: CompilerConfiguration = CompilerConfiguration(), dispose: ProjectLifecycle.() -> Unit = Noop.effect1): ExtensionPhase
replaceAppService replaces an application service with instance. In this example this Annotator needs a different instance for MyService than what is currently provided - see our example in addAppService.open fun <A : Any> IdeMetaPlugin.replaceAppService(service: Class<A>, instance: (A?) -> A): ExtensionPhase
stopServicePreloading open fun IdeMetaPlugin.stopServicePreloading(): ExtensionPhase

Inheritors

IdeSyntax interface IdeSyntax : IconProviderSyntax, SyntaxHighlighterSyntax, InspectionSyntax, AnActionSyntax, ColorSettingsSyntax, HintingSyntax, LanguageSyntax, LineMarkerSyntax, LiveTemplateSyntax, NavigationSyntax, SearchSyntax, StructureViewSyntax, UsageSyntax, ExtensionProviderSyntax, DocumentationSyntax, KotlinExtensionSyntax, DialogSyntax, PopupSyntax, NotificationSyntax, ToolWindowSyntax, GotoRelatedSyntax, AnnotatorSyntax, ParserSyntax, ApplicationSyntax, FoldingSyntax, EditorSyntax, ResolveScopeSyntax, ResolveProviderSyntax

Do you like Arrow?

Arrow Org
<