Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AutoCorrection crashing with Missing extension point #4545

Merged
merged 1 commit into from Feb 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,7 @@
package io.github.detekt.parser

import org.jetbrains.kotlin.com.intellij.openapi.extensions.ExtensionPoint
import org.jetbrains.kotlin.com.intellij.openapi.extensions.Extensions.getRootArea
import org.jetbrains.kotlin.com.intellij.openapi.project.Project
import org.jetbrains.kotlin.com.intellij.openapi.util.UserDataHolderBase
import org.jetbrains.kotlin.com.intellij.pom.PomModel
Expand All @@ -20,9 +21,9 @@ class DetektPomModel(project: Project) : UserDataHolderBase(), PomModel {
init {
val extension = "org.jetbrains.kotlin.com.intellij.treeCopyHandler"
val extensionClass = TreeCopyHandler::class.java.name
val extensionArea = project.extensionArea
synchronized(extensionArea) {
if (extensionArea.hasExtensionPoint(extension)) {
@Suppress("DEPRECATION")
for (extensionArea in listOf(project.extensionArea, getRootArea())) {
if (!extensionArea.hasExtensionPoint(extension)) {
extensionArea.registerExtensionPoint(extension, extensionClass, ExtensionPoint.Kind.INTERFACE)
}
}
Expand Down