diff options
Diffstat (limited to 'internal/hexaiaction/run.go')
| -rw-r--r-- | internal/hexaiaction/run.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/hexaiaction/run.go b/internal/hexaiaction/run.go index 2a3ade1..0330354 100644 --- a/internal/hexaiaction/run.go +++ b/internal/hexaiaction/run.go @@ -251,6 +251,7 @@ func codeActionHandlers() map[ActionKind]CodeActionHandler { ActionDocument: codeActionHandler{build: buildDocumentPlan}, ActionGoTest: codeActionHandler{build: buildGoTestPlan}, ActionSimplify: codeActionHandler{build: buildSimplifyPlan}, + ActionFixTypos: codeActionHandler{build: buildFixTyposPlan}, ActionCustomPrompt: codeActionHandler{build: buildCustomPromptPlan}, } } @@ -304,6 +305,15 @@ func buildSimplifyPlan(parts InputParts, cfg actionConfig, client chatDoer, _ io }, true } +func buildFixTyposPlan(parts InputParts, cfg actionConfig, client chatDoer, _ io.Writer) (actionPlan, bool) { + return actionPlan{ + fallback: parts.Selection, + run: func(ctx context.Context) (string, error) { + return handleFixTyposAction(ctx, parts, cfg, client) + }, + }, true +} + func buildCustomPromptPlan(parts InputParts, cfg actionConfig, client chatDoer, stderr io.Writer) (actionPlan, bool) { return actionPlan{ fallback: parts.Selection, @@ -348,6 +358,12 @@ func handleSimplifyAction(ctx context.Context, parts InputParts, cfg actionConfi }) } +func handleFixTyposAction(ctx context.Context, parts InputParts, cfg actionConfig, client chatDoer) (string, error) { + return runWithTimeout(ctx, timeout20s, func(cctx context.Context) (string, error) { + return runFixTypos(cctx, cfg, client, parts.Selection) + }) +} + func handleCustomAction(ctx context.Context, parts InputParts, cfg actionConfig, client chatDoer, selectedCustom *appconfig.CustomAction) (string, error) { if selectedCustom == nil { return parts.Selection, nil |
