Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit 8c6e817

Browse files
committed
refactor and document
1 parent 2883256 commit 8c6e817

10 files changed

Lines changed: 1513 additions & 989 deletions

File tree

.editorconfig

Lines changed: 0 additions & 18 deletions
This file was deleted.

OpenCode.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# OpenCode Development Guide
2+
3+
## Build/Test/Lint Commands
4+
5+
- **Build**: `go build ./...` or `go build .` (for main binary)
6+
- **Test**: `task test` or `go test ./...`
7+
- **Single test**: `go test ./internal/path/to/package -run TestName`
8+
- **Lint**: `task lint` or `golangci-lint run`
9+
- **Format**: `task fmt` or `gofumpt -w .`
10+
11+
## Code Style Guidelines
12+
13+
- **Imports**: Standard library first, then third-party, then internal packages (separated by blank lines)
14+
- **Types**: Use `any` instead of `interface{}`, prefer concrete types over interfaces when possible
15+
- **Naming**: Use camelCase for private, PascalCase for public, descriptive names (e.g., `messageListCmp`, `handleNewUserMessage`)
16+
- **Constants**: Use `const` blocks with descriptive names (e.g., `NotFound = -1`)
17+
- **Error handling**: Always check errors, use `require.NoError()` in tests, return errors up the stack
18+
- **Documentation**: Add comments for all public types/methods, explain complex logic in private methods
19+
- **Testing**: Use testify/assert and testify/require, table-driven tests with `t.Run()`, mark helpers with `t.Helper()`
20+
- **File organization**: Group related functionality, extract helper methods for complex logic, use meaningful method names
21+
- **TUI components**: Implement interfaces (util.Model, layout.Sizeable), document component purpose and behavior
22+
- **Message handling**: Use pubsub events, handle different message roles (User/Assistant/Tool), manage tool calls separately

internal/tui/components/chat/editor.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
185185
return m, nil
186186
}
187187
}
188-
if key.Matches(msg, messageKeys.PageUp) || key.Matches(msg, messageKeys.PageDown) ||
189-
key.Matches(msg, messageKeys.HalfPageUp) || key.Matches(msg, messageKeys.HalfPageDown) {
190-
return m, nil
191-
}
192188
if key.Matches(msg, editorMaps.OpenEditor) {
193189
if m.app.CoderAgent.IsSessionBusy(m.session.ID) {
194190
return m, util.ReportWarn("Agent is working, please wait...")

0 commit comments

Comments
 (0)