summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-06-19 10:41:59 -0500
committeradamdottv <[email protected]>2025-06-19 10:41:59 -0500
commitf48eac638d27bb81ba2f6681622755130b5a1261 (patch)
tree5b92c3df0f86439ef934d11891f2b229656d81bc
parente1f12f93ebaf56eeabe19404c6411b2a92c4c8c4 (diff)
downloadopencode-f48eac638d27bb81ba2f6681622755130b5a1261.tar.gz
opencode-f48eac638d27bb81ba2f6681622755130b5a1261.zip
feat(tui): more toast messages
-rw-r--r--packages/tui/internal/components/chat/messages.go5
-rw-r--r--packages/tui/internal/tui/tui.go11
2 files changed, 13 insertions, 3 deletions
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go
index a62a53e1c..c05bd27c9 100644
--- a/packages/tui/internal/components/chat/messages.go
+++ b/packages/tui/internal/components/chat/messages.go
@@ -28,6 +28,7 @@ type MessagesComponent interface {
Last() (tea.Model, tea.Cmd)
// Previous() (tea.Model, tea.Cmd)
// Next() (tea.Model, tea.Cmd)
+ ToolDetailsVisible() bool
}
type messagesComponent struct {
@@ -426,6 +427,10 @@ func (m *messagesComponent) Last() (tea.Model, tea.Cmd) {
return m, nil
}
+func (m *messagesComponent) ToolDetailsVisible() bool {
+ return m.showToolDetails
+}
+
func NewMessagesComponent(app *app.App) MessagesComponent {
customSpinner := spinner.Spinner{
Frames: []string{" ", "┃", "┃"},
diff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.go
index 282322799..7af637e7a 100644
--- a/packages/tui/internal/tui/tui.go
+++ b/packages/tui/internal/tui/tui.go
@@ -355,8 +355,7 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
}
editor := os.Getenv("EDITOR")
if editor == "" {
- // TODO: let the user know there's no EDITOR set
- return a, nil
+ return a, toast.NewErrorToast("No EDITOR set, can't open editor")
}
value := a.editor.Value()
@@ -368,7 +367,7 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
tmpfile.WriteString(value)
if err != nil {
slog.Error("Failed to create temp file", "error", err)
- return a, nil
+ return a, toast.NewErrorToast("Something went wrong, couldn't open editor")
}
tmpfile.Close()
c := exec.Command(editor, tmpfile.Name()) //nolint:gosec
@@ -440,7 +439,12 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
// TODO: block until compaction is complete
a.app.CompactSession(context.Background())
case commands.ToolDetailsCommand:
+ message := "Tool details are now visible"
+ if a.messages.ToolDetailsVisible() {
+ message = "Tool details are now hidden"
+ }
cmds = append(cmds, util.CmdHandler(chat.ToggleToolDetailsMsg{}))
+ cmds = append(cmds, toast.NewInfoToast(message))
case commands.ModelListCommand:
modelDialog := dialog.NewModelDialog(a.app)
a.modal = modelDialog
@@ -465,6 +469,7 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
a.editor = updated.(chat.EditorComponent)
cmds = append(cmds, cmd)
case commands.InputNewlineCommand:
+ slog.Debug("InputNewlineCommand")
updated, cmd := a.editor.Newline()
a.editor = updated.(chat.EditorComponent)
cmds = append(cmds, cmd)