Skip to content

Commit b8df6e2

Browse files
committed
fix(editor): remove scrollbar and caret settings #371
- Comment out unused scrollbar and caret settings in LocalJsonTextProvider - Add input validation and clear chat input in McpPreviewEditor - Remove unused Tool import in McpPreviewEditor
1 parent 71c3db9 commit b8df6e2

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

core/src/main/kotlin/cc/unitmesh/devti/mcp/editor/McpPreviewEditor.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cc.unitmesh.devti.mcp.editor
22

33
import cc.unitmesh.devti.AutoDevIcons
4+
import cc.unitmesh.devti.AutoDevNotifications
45
import cc.unitmesh.devti.llm2.model.LlmConfig
56
import cc.unitmesh.devti.llms.custom.CustomLLMProvider
67
import cc.unitmesh.devti.mcp.ui.McpToolListPanel
@@ -31,7 +32,6 @@ import com.intellij.ui.dsl.builder.panel
3132
import com.intellij.util.ui.JBUI
3233
import com.intellij.util.ui.UIUtil
3334
import com.intellij.util.ui.components.BorderLayoutPanel
34-
import io.modelcontextprotocol.kotlin.sdk.Tool
3535
import kotlinx.coroutines.flow.Flow
3636
import kotlinx.coroutines.flow.MutableStateFlow
3737
import kotlinx.coroutines.flow.cancellable
@@ -228,15 +228,22 @@ open class McpPreviewEditor(
228228
config.enabledTools = allTools.map { it.value }.flatten().toMutableList()
229229
}
230230

231+
if (chatInput.text.isEmpty()) {
232+
AutoDevNotifications.warn(project, "Please enter a message to send.")
233+
return
234+
}
235+
231236
val llmConfig = LlmConfig.load().firstOrNull { it.name == chatbotSelector.selectedItem }
232237
?: LlmConfig.default()
233238
val llmProvider = CustomLLMProvider(project, llmConfig)
234239
val message = chatInput.text.trim()
240+
241+
chatInput.text = ""
242+
235243
val result = StringBuilder()
236244
val systemPrompt = config.createSystemPrompt()
237245
val stream: Flow<String> = llmProvider.stream(message, systemPrompt = systemPrompt)
238246

239-
// Reset the resultPanel before setting new content
240247
resultPanel.reset()
241248
resultPanel.setText("Loading response...")
242249
resultPanel.isVisible = true

core/src/main/kotlin/cc/unitmesh/devti/provider/local/LocalJsonTextProvider.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ class JsonLanguageField(
4646
override fun createEditor(): EditorEx {
4747
return super.createEditor().apply {
4848
setShowPlaceholderWhenFocused(true)
49-
setHorizontalScrollbarVisible(false)
50-
setVerticalScrollbarVisible(true)
49+
// setHorizontalScrollbarVisible(false)
50+
// setVerticalScrollbarVisible(true)
5151
setPlaceholder(placeholder)
5252

5353
val scheme = EditorColorsUtil.getColorSchemeForBackground(this.colorsScheme.defaultBackground)
5454
this.colorsScheme = this.createBoundColorSchemeDelegate(scheme)
5555

56-
this.settings.isUseSoftWraps = true
57-
this.settings.isAdditionalPageAtBottom = false
58-
this.settings.isCaretRowShown = false
56+
// this.settings.isUseSoftWraps = true
57+
// this.settings.isAdditionalPageAtBottom = false
58+
// this.settings.isCaretRowShown = false
5959

6060
isOneLineMode = oneLineMode
6161
}

0 commit comments

Comments
 (0)