Skip to content

Commit

Permalink
[RIDER] Add veto mechanism for AI Assistant plugin load RIDER-120772
Browse files Browse the repository at this point in the history
(cherry picked from commit c0ce5cc65b673ae84f1261455a807b820c8824b3)

IJ-CR-150848

GitOrigin-RevId: fc14e3f3d88caf797934884919cd2274a188c7a4
  • Loading branch information
Nikita.Lyubimov authored and intellij-monorepo-bot committed Dec 6, 2024
1 parent 8875af5 commit d232a78
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.plugins

import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls

interface DynamicPluginVetoer {
Expand All @@ -13,5 +14,9 @@ interface DynamicPluginVetoer {
* 'null' to let the plugin be unloaded
*/
fun vetoPluginUnload(pluginDescriptor: IdeaPluginDescriptor): @Nls String?


@ApiStatus.Internal
fun vetoPluginLoad(pluginDescriptor: IdeaPluginDescriptor): Boolean = false
}

Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,15 @@ object DynamicPlugins {

private fun doLoadPlugin(pluginDescriptor: IdeaPluginDescriptorImpl, project: Project? = null): Boolean {
var result = false

val isVetoed = VETOER_EP_NAME.findFirstSafe {
it.vetoPluginLoad(pluginDescriptor)
} != null

if (isVetoed) {
return false
}

val indicator = PotemkinProgress(IdeBundle.message("plugins.progress.loading.plugin.title", pluginDescriptor.name),
project,
null,
Expand Down

0 comments on commit d232a78

Please sign in to comment.