[PyCharm] PY-74366 Jupyter/RemoteDev (feat): First version of notebook output synchronization in RD. Console, image and some other outputs will be properly updated.

GitOrigin-RevId: 283aa5b0699bad1c493cf9ef6847d025028087d5
This commit is contained in:
Nikita Pavlenko
2024-09-18 10:03:33 +02:00
committed by intellij-monorepo-bot
parent 10bdb6f46b
commit 1751d7e81a
4 changed files with 28 additions and 6 deletions

View File

@@ -1,5 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi -opt-in=kotlin.ExperimentalStdlibApi" />
</compilerSettings>
<compilerArguments>
<stringArguments>
<stringArg name="jvmTarget" arg="17" />
<stringArg name="apiVersion" arg="2.0" />
<stringArg name="languageVersion" arg="2.0" />
</stringArguments>
<arrayArguments>
<arrayArg name="pluginClasspaths">
<args>$KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar</args>
</arrayArg>
<arrayArg name="pluginOptions" />
</arrayArguments>
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
@@ -20,5 +42,6 @@
<orderEntry type="library" scope="TEST" name="assertJ" level="project" />
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.util.coroutines" />
<orderEntry type="library" exported="" name="kotlinx-serialization-core" level="project" />
</component>
</module>

View File

@@ -54,7 +54,6 @@ interface NotebookCellLines {
val contentLines: IntRange
get() = firstContentLine..lastContentLine
operator fun <V> get(key: Key<V>): V? = data.get(key)
override fun compareTo(other: Interval): Int = lines.first - other.lines.first
@@ -87,7 +86,6 @@ interface NotebookCellLines {
return document.getText(range)
}
fun getTopMarker(document: Document): String? =
if (markers.hasTopLine) document.getLineText(lines.first) else null

View File

@@ -4,16 +4,17 @@ import com.intellij.openapi.editor.impl.EditorImpl
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.notebooks.visualization.NotebookCellLines
import com.intellij.notebooks.visualization.outputs.statistic.NotebookOutputKeyType
import kotlinx.serialization.Polymorphic
/** Merely a marker for data that can be represented via some Swing component. */
@Polymorphic
interface NotebookOutputDataKey {
/**
Get content that can be used for building diff for outputs.
*/
fun getContentForDiffing(): Any
val statisticKey: NotebookOutputKeyType
get() = NotebookOutputKeyType.UNKNOWN
fun getStatisticKey() = NotebookOutputKeyType.UNKNOWN
}
interface NotebookOutputDataKeyExtractor {

View File

@@ -97,7 +97,7 @@ class EditorCellOutputs(
onViewportChange()
}
private fun updateView(newDataKeys: List<NotebookOutputDataKey>) = runInEdt {
fun updateView(newDataKeys: Collection<NotebookOutputDataKey>) = runInEdt {
updateData(newDataKeys)
recreateInlayIfNecessary()
}
@@ -125,7 +125,7 @@ class EditorCellOutputs(
}
@RequiresEdt
private fun updateData(newDataKeys: List<NotebookOutputDataKey>): Boolean {
private fun updateData(newDataKeys: Collection<NotebookOutputDataKey>): Boolean {
val newDataKeyIterator = newDataKeys.iterator()
val oldComponentsWithFactories = getComponentsWithFactories().iterator()
var isFilled = false