[R] Fix "Companion objects in IDE extension implementations may only contain a logger and constants" inspection

GitOrigin-RevId: 1f195432490cf1bf208665609d886698c7c2fe7b
This commit is contained in:
Andrey Vokin
2024-02-20 09:29:36 +01:00
committed by intellij-monorepo-bot
parent 634b8189ec
commit 1817160e36

View File

@@ -29,19 +29,6 @@ private val logger = Logger.getInstance(InlaysManager::class.java)
class InlaysManager : EditorFactoryListener {
companion object {
private val KEY = Key.create<EditorInlaysManager>("org.jetbrains.plugins.notebooks.visualization.r.inlays.editorInlaysManager")
fun getEditorManager(editor: Editor): EditorInlaysManager? = editor.getUserData(KEY)
private fun getDescriptor(editor: Editor): InlayElementDescriptor? {
return InlayDescriptorProvider.EP.extensionList
.asSequence()
.mapNotNull { it.getInlayDescriptor(editor) }
.firstOrNull()
}
}
override fun editorCreated(event: EditorFactoryEvent) {
val editor = event.editor
val project = editor.project ?: return
@@ -56,4 +43,15 @@ class InlaysManager : EditorFactoryListener {
event.editor.putUserData(KEY, null)
}
}
}
private val KEY = Key.create<EditorInlaysManager>("org.jetbrains.plugins.notebooks.visualization.r.inlays.editorInlaysManager")
fun getEditorManager(editor: Editor): EditorInlaysManager? = editor.getUserData(KEY)
private fun getDescriptor(editor: Editor): InlayElementDescriptor? {
return InlayDescriptorProvider.EP.extensionList
.asSequence()
.mapNotNull { it.getInlayDescriptor(editor) }
.firstOrNull()
}