Skip to content

Commit b1e132e

Browse files
committed
perf(sketch): disable markdown preview by default
- Remove markdown preview functionality from MessageView and SketchToolWindow - Update MarkdownPreviewHighlightSketch to remove onComplete method - Modify MarkdownPreviewSketchProvider
1 parent af41812 commit b1e132e

File tree

5 files changed

+4
-17
lines changed

5 files changed

+4
-17
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/view/MessageView.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ class MessageView(val project: Project, val message: String, val role: ChatRole,
108108
?.create(project, codeFence.text)
109109
}
110110

111-
val isCanHtml = codeFence.language.displayName.lowercase() == "markdown"
112-
if (isCanHtml && codeFence.isComplete && blockViews[index] !is ExtensionLangSketch) {
113-
langSketch = MarkdownPreviewHighlightSketch(project, codeFence.text)
114-
}
115-
116111
if (langSketch != null) {
117112
val oldComponent = blockViews[index]
118113
blockViews[index] = langSketch

core/src/main/kotlin/cc/unitmesh/devti/sketch/SketchToolWindow.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ import cc.unitmesh.devti.observer.agent.AgentStateService
1515
import cc.unitmesh.devti.sketch.ui.ExtensionLangSketch
1616
import cc.unitmesh.devti.sketch.ui.LangSketch
1717
import cc.unitmesh.devti.sketch.ui.LanguageSketchProvider
18-
import cc.unitmesh.devti.sketch.ui.MarkdownPreviewHighlightSketch
1918
import cc.unitmesh.devti.sketch.ui.code.CodeHighlightSketch
2019
import cc.unitmesh.devti.util.AutoDevCoroutineScope
2120
import cc.unitmesh.devti.util.parser.CodeFence
22-
import cc.unitmesh.devti.util.parser.convertMarkdownToHtml
2321
import com.intellij.openapi.Disposable
2422
import com.intellij.openapi.actionSystem.ActionPlaces
2523
import com.intellij.openapi.actionSystem.ActionToolbar
@@ -286,11 +284,6 @@ open class SketchToolWindow(
286284
langSketch?.onComplete(codeFence.text)
287285
}
288286

289-
// val isCanHtml = codeFence.language.displayName.lowercase() == "markdown"
290-
// if (isCanHtml && codeFence.isComplete && blockViews[index] !is ExtensionLangSketch) {
291-
// langSketch = MarkdownPreviewHighlightSketch(project, codeFence.text)
292-
// }
293-
294287
if (langSketch != null) {
295288
val oldComponent = blockViews[index]
296289
blockViews[index] = langSketch

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/MarkdownPreviewHighlightSketch.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ class MarkdownPreviewHighlightSketch(val project: Project, val text: String) : E
5454
return previewPanel
5555
}
5656

57-
override fun onComplete(code: String) {
58-
println(convertMarkdownToHtml(code))
59-
}
60-
6157
override fun updateLanguage(language: Language?, originLanguage: String?) {}
6258

6359
override fun dispose() {

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/MarkdownPreviewSketchProvider.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package cc.unitmesh.devti.sketch.ui
33
import com.intellij.openapi.project.Project
44

55
class MarkdownPreviewSketchProvider : LanguageSketchProvider {
6+
/**
7+
* Since Webview had a bad performance, we disable it by default.
8+
*/
69
override fun isSupported(lang: String): Boolean {
710
// return lang.lowercase() == "markdown"
811
return false

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pluginGroup = com.phodal.autodev
77
pluginName = AutoDev
88
pluginRepositoryUrl = https://github.com/unit-mesh/auto-dev
99
# SemVer format -> https://semver.org
10-
pluginVersion = 2.0.0-rc.5
10+
pluginVersion = 2.0.0-rc.6
1111

1212
# Supported IDEs: idea, pycharm
1313
baseIDE=idea

0 commit comments

Comments
 (0)