|
1 | 1 | package cc.unitmesh.devti.settings |
2 | 2 |
|
| 3 | +import cc.unitmesh.devti.AutoDevBundle |
| 4 | +import com.intellij.collaboration.messages.CollaborationToolsBundle |
3 | 5 | import com.intellij.json.JsonLanguage |
| 6 | +import com.intellij.jsonpath.JsonPathFileType |
4 | 7 | import com.intellij.jsonpath.psi.JsonPathFile |
5 | 8 | import com.intellij.openapi.editor.colors.EditorColorsUtil |
6 | 9 | import com.intellij.openapi.editor.ex.EditorEx |
7 | 10 | import com.intellij.openapi.project.ProjectManager |
8 | 11 | import com.intellij.openapi.ui.ComboBox |
| 12 | +import com.intellij.ui.EditorTextField |
9 | 13 | import com.intellij.ui.LanguageTextField |
10 | 14 | import com.intellij.ui.components.JBLabel |
11 | 15 | import com.intellij.ui.components.JBPasswordField |
@@ -33,21 +37,29 @@ class AppSettingsComponent(settings: AutoDevSettingsState) { |
33 | 37 | private val aiEngine = ComboBox(AI_ENGINES) |
34 | 38 | private val customEngineServer = JBTextField() |
35 | 39 | private val customEngineToken = JBTextField() |
36 | | - private val customEngineResponseFormat = JBTextField() |
| 40 | + val project = ProjectManager.getInstance().openProjects.firstOrNull() |
| 41 | + |
| 42 | + private val customEngineResponseFormat by lazy { |
| 43 | + object : EditorTextField(project, JsonPathFileType.INSTANCE) { |
| 44 | + |
| 45 | + }.apply { |
| 46 | + setOneLineMode(true) |
| 47 | + setPlaceholder(AutoDevBundle.message("autodev.custom.response.format.placeholder")) |
| 48 | + } |
| 49 | + } |
| 50 | + |
37 | 51 | private val language = ComboBox(HUMAN_LANGUAGES) |
38 | 52 | private val maxTokenLengthInput = JBTextField() |
39 | 53 |
|
40 | 54 | private val customEnginePrompt by lazy { |
41 | | - val project = ProjectManager.getInstance().openProjects.firstOrNull() |
42 | | - |
43 | 55 | object : LanguageTextField(JsonLanguage.INSTANCE, project, "") { |
44 | 56 | override fun createEditor(): EditorEx { |
45 | 57 |
|
46 | 58 | return super.createEditor().apply { |
47 | 59 | setShowPlaceholderWhenFocused(true) |
48 | 60 | setHorizontalScrollbarVisible(false) |
49 | 61 | setVerticalScrollbarVisible(true) |
50 | | - setPlaceholder("Enter custom prompt here") |
| 62 | + setPlaceholder(AutoDevBundle.message("autodev.custom.prompt.placeholder")) |
51 | 63 |
|
52 | 64 |
|
53 | 65 | val scheme = EditorColorsUtil.getColorSchemeForBackground(this.colorsScheme.defaultBackground) |
|
0 commit comments