Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

Add editor command configuration support

Dane Schneidera574fa974853
diff --git a/app/shared/plan_config.go b/app/shared/plan_config.go
index 69a2b4d3..c7d292e8 100644
--- a/app/shared/plan_config.go
+++ b/app/shared/plan_config.go
@@ -54,9 +54,13 @@ type PlanConfig struct {
AutoMode AutoModeType `json:"autoMode"`
// QuietMode bool `json:"quietMode"`
- Editor string `json:"editor"`
- AutoContinue bool `json:"autoContinue"`
- AutoBuild bool `json:"autoBuild"`
+ Editor string `json:"editor"`
+ EditorCommand string `json:"editorCommand"`
+ EditorArgs []string `json:"editorArgs"`
+ EditorOpenManually bool `json:"editorOpenManually"`
+
+ AutoContinue bool `json:"autoContinue"`
+ AutoBuild bool `json:"autoBuild"`
AutoUpdateContext bool `json:"autoUpdateContext"`
AutoLoadContext bool `json:"autoContext"`
@@ -89,9 +93,7 @@ type PlanConfig struct {
// PlainTextStream bool `json:"plainTextStream"`
}
-var DefaultPlanConfig = PlanConfig{
- Editor: defaultEditor,
-}
+var DefaultPlanConfig = PlanConfig{}
func (p *PlanConfig) Scan(src interface{}) error {
if src == nil {
@@ -199,6 +201,7 @@ type ConfigSetting struct {
BoolSetter func(p *PlanConfig, enabled bool)
IntSetter func(p *PlanConfig, value int)
StringSetter func(p *PlanConfig, value string)
+ EditorSetter func(p *PlanConfig, label, command string, args []string)
Getter func(p *PlanConfig) string
Choices *[]string
HasCustomChoice bool
@@ -240,15 +243,15 @@ var ConfigSettingsByKey = map[string]ConfigSetting{
"editor": {
Name: "editor",
- Desc: "System editor",
- StringSetter: func(p *PlanConfig, value string) {
- p.Editor = value
+ Desc: "Preferred editor",
+ EditorSetter: func(p *PlanConfig, label, command string, args []string) {
+ p.Editor = label
+ p.EditorCommand = command
+ p.EditorArgs = args
},
Getter: func(p *PlanConfig) string {
return p.Editor
},
- Choices: &[]string{EditorTypeVim, EditorTypeNano},
- HasCustomChoice: true,
},
"autocontinue": {