feat: Add an experimental option to disable paste summaries (#2552)

Co-authored-by: rekram1-node <aidenpcline@gmail.com>
This commit is contained in:
Chris Covington
2025-09-11 12:21:08 -07:00
committed by GitHub
parent 4614e4983e
commit 53f1f16122
3 changed files with 18 additions and 10 deletions

View File

@@ -499,6 +499,7 @@ export namespace Config {
.optional(),
})
.optional(),
disable_paste_summary: z.boolean().optional(),
})
.optional(),
})

View File

@@ -699,6 +699,7 @@ func (r configCommandJSON) RawJSON() string {
type ConfigExperimental struct {
Hook ConfigExperimentalHook `json:"hook"`
DisablePasteSummary bool `json:"disable_paste_summary"`
JSON configExperimentalJSON `json:"-"`
}
@@ -706,6 +707,7 @@ type ConfigExperimental struct {
// [ConfigExperimental]
type configExperimentalJSON struct {
Hook apijson.Field
SummarizePaste apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

View File

@@ -668,6 +668,11 @@ func (m *editorComponent) shouldSummarizePastedText(text string) bool {
if m.app.IsBashMode {
return false
}
if m.app.Config != nil && m.app.Config.Experimental.DisablePasteSummary {
return false
}
lines := strings.Split(text, "\n")
lineCount := len(lines)
charCount := len(text)