mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 01:34:22 +01:00
feat: Add an experimental option to disable paste summaries (#2552)
Co-authored-by: rekram1-node <aidenpcline@gmail.com>
This commit is contained in:
@@ -499,6 +499,7 @@ export namespace Config {
|
|||||||
.optional(),
|
.optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
|
disable_paste_summary: z.boolean().optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -699,6 +699,7 @@ func (r configCommandJSON) RawJSON() string {
|
|||||||
|
|
||||||
type ConfigExperimental struct {
|
type ConfigExperimental struct {
|
||||||
Hook ConfigExperimentalHook `json:"hook"`
|
Hook ConfigExperimentalHook `json:"hook"`
|
||||||
|
DisablePasteSummary bool `json:"disable_paste_summary"`
|
||||||
JSON configExperimentalJSON `json:"-"`
|
JSON configExperimentalJSON `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,6 +707,7 @@ type ConfigExperimental struct {
|
|||||||
// [ConfigExperimental]
|
// [ConfigExperimental]
|
||||||
type configExperimentalJSON struct {
|
type configExperimentalJSON struct {
|
||||||
Hook apijson.Field
|
Hook apijson.Field
|
||||||
|
SummarizePaste apijson.Field
|
||||||
raw string
|
raw string
|
||||||
ExtraFields map[string]apijson.Field
|
ExtraFields map[string]apijson.Field
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -668,6 +668,11 @@ func (m *editorComponent) shouldSummarizePastedText(text string) bool {
|
|||||||
if m.app.IsBashMode {
|
if m.app.IsBashMode {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.app.Config != nil && m.app.Config.Experimental.DisablePasteSummary {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
lines := strings.Split(text, "\n")
|
lines := strings.Split(text, "\n")
|
||||||
lineCount := len(lines)
|
lineCount := len(lines)
|
||||||
charCount := len(text)
|
charCount := len(text)
|
||||||
|
|||||||
Reference in New Issue
Block a user