[PyCharm] PY-73583 WIP improved structure view, cell selection reflects in structure

GitOrigin-RevId: c6c9818eb3d7433a4a1dffd5bccd1dd3096456d2
This commit is contained in:
Bogdan.Kirilenko
2024-08-06 15:30:11 +02:00
committed by intellij-monorepo-bot
parent 8d8231e4e1
commit cf6c17e165
2 changed files with 18 additions and 0 deletions

View File

@@ -171,6 +171,10 @@ class NotebookCellInlayManager private constructor(
val selectedCells = selectionModel.selectedCells.map { it.ordinal }
for (cell in cells) {
cell.selected = cell.intervalPointer.get()?.ordinal in selectedCells
if (cell.selected) {
editor.project?.messageBus?.syncPublisher(JupyterCellSelectionNotifier.TOPIC)?.cellSelected(cell.interval, editor)
}
}
}

View File

@@ -0,0 +1,14 @@
package org.jetbrains.plugins.notebooks.visualization.ui
import com.intellij.openapi.editor.Editor
import com.intellij.util.messages.Topic
import org.jetbrains.plugins.notebooks.visualization.NotebookCellLines
interface JupyterCellSelectionNotifier {
// todo: probably it's better to merge with some already existing listener
companion object {
val TOPIC = Topic.create("Jupyter Cell Selection Topic", JupyterCellSelectionNotifier::class.java)
}
fun cellSelected(interval: NotebookCellLines.Interval, editor: Editor)
}