Skip to content

Commit

Permalink
feat: add inlay code complete custom ai engine toggle in dev coder co…
Browse files Browse the repository at this point in the history
…nfig
  • Loading branch information
jialiu-github committed Mar 21, 2024
1 parent a9e8b06 commit 268f309
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Expand Up @@ -22,7 +22,10 @@ class AutoDevCoderConfigurable(project: Project) : BoundConfigurable(AutoDevBund
private val refactorCodeField = JTextField()
private val fixIssueCodeField = JTextField()
private val generateTestField = JTextField()

private val useCustomAIEngineWhenInlayCodeComplete = JCheckBox()
.apply {
toolTipText = "You can use custom LLM to inlay complete code."
}
val settings = project.service<AutoDevCoderSettingService>()
val state = settings.state.copy()

Expand Down Expand Up @@ -95,6 +98,15 @@ class AutoDevCoderConfigurable(project: Project) : BoundConfigurable(AutoDevBund
)
}

row(AutoDevBundle.message("settings.autodev.coder.useCustomerAgentWhenInlayCodeComplete")) {
fullWidthCell(useCustomAIEngineWhenInlayCodeComplete)
.bind(
componentGet = { it.isSelected },
componentSet = { component, value -> component.isSelected = value },
prop = state::useCustomAIEngineWhenInlayCodeComplete.toMutableProperty()
)
}

onApply {
settings.modify {
it.recordingInLocal = state.recordingInLocal
Expand All @@ -104,6 +116,7 @@ class AutoDevCoderConfigurable(project: Project) : BoundConfigurable(AutoDevBund
it.refactorCode = state.refactorCode
it.fixIssueCode = state.fixIssueCode
it.generateTest = state.generateTest
it.useCustomAIEngineWhenInlayCodeComplete = state.useCustomAIEngineWhenInlayCodeComplete
it.noChatHistory = state.noChatHistory
}
}
Expand Down
Expand Up @@ -30,6 +30,7 @@ class AutoDevCoderSettingService(
var fixIssueCode: String by property("Help me fix this issue") { it.isEmpty() }
var generateTest: String by property("Generate test for \$lang code") { it.isEmpty() }

var useCustomAIEngineWhenInlayCodeComplete by property(false)
override fun copy(): AutoDevCoderSettings {
val state = AutoDevCoderSettings()
state.copyFrom(this)
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages/AutoDevBundle.properties
Expand Up @@ -96,6 +96,7 @@ settings.autodev.coder.explainCode=Explain code
settings.autodev.coder.refactorCode=Refactor code
settings.autodev.coder.fixIssueCode=Fix issue
settings.autodev.coder.generateTest=Generate test
settings.autodev.coder.useCustomerAgentWhenInlayCodeComplete= Use Custormer Agent

settings.welcome.message=Welcome to use AutoDev
settings.welcome.feature.context=Precise context-aware code generate and chat
Expand Down

0 comments on commit 268f309

Please sign in to comment.