The open source coding agent.
TypeScript
small fixes
Kujtim Hoxha795b3692197a
diff --git a/internal/llm/tools/edit.go b/internal/llm/tools/edit.goindex c84bbd7a053..a5877044bf9 100644--- a/internal/llm/tools/edit.go+++ b/internal/llm/tools/edit.go@@ -80,7 +80,7 @@ func (e *editTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)if err != nil {return NewTextErrorResponse(fmt.Sprintf("error creating file: %s", err)), nil}- return NewTextErrorResponse(result), nil+ return NewTextResponse(result), nil}if params.NewString == "" {@@ -88,7 +88,7 @@ func (e *editTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)if err != nil {return NewTextErrorResponse(fmt.Sprintf("error deleting content: %s", err)), nil}- return NewTextErrorResponse(result), nil+ return NewTextResponse(result), nil}result, err := replaceContent(params.FilePath, params.OldString, params.NewString)diff --git a/internal/lsp/util/edit.go b/internal/lsp/util/edit.goindex 180429ce563..3b94fb39ff7 100644--- a/internal/lsp/util/edit.go+++ b/internal/lsp/util/edit.go@@ -34,9 +34,9 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {lines := strings.Split(string(content), lineEnding)// Check for overlapping edits- for i := 0; i < len(edits); i++ {+ for i, edit1 := range edits {for j := i + 1; j < len(edits); j++ {- if rangesOverlap(edits[i].Range, edits[j].Range) {+ if rangesOverlap(edit1.Range, edits[j].Range) {return fmt.Errorf("overlapping edits detected between edit %d and %d", i, j)}}@@ -54,7 +54,7 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {// Apply each editfor _, edit := range sortedEdits {- newLines, err := applyTextEdit(lines, edit, lineEnding)+ newLines, err := applyTextEdit(lines, edit)if err != nil {return fmt.Errorf("failed to apply edit: %w", err)}@@ -82,7 +82,7 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {return nil}-func applyTextEdit(lines []string, edit protocol.TextEdit, lineEnding string) ([]string, error) {+func applyTextEdit(lines []string, edit protocol.TextEdit) ([]string, error) {startLine := int(edit.Range.Start.Line)endLine := int(edit.Range.End.Line)startChar := int(edit.Range.Start.Character)diff --git a/internal/lsp/watcher/watcher.go b/internal/lsp/watcher/watcher.goindex a9d057c711c..7a6eaacc52d 100644--- a/internal/lsp/watcher/watcher.go+++ b/internal/lsp/watcher/watcher.go@@ -347,7 +347,7 @@ func matchesSimpleGlob(pattern, path string) bool {// Otherwise, check if any path component matchespathComponents := strings.Split(path, "/")- for i := 0; i < len(pathComponents); i++ {+ for i := range pathComponents {subPath := strings.Join(pathComponents[i:], "/")if strings.HasSuffix(subPath, rest) {return truediff --git a/internal/tui/components/core/button.go b/internal/tui/components/core/button.goindex 102957e0ec8..090fbc1ee51 100644--- a/internal/tui/components/core/button.go+++ b/internal/tui/components/core/button.go@@ -67,7 +67,7 @@ const (// ButtonMsg is sent when a button is clickedtype ButtonMsg struct {ID string- Payload interface{}+ Payload any}// ButtonCmp represents a clickable button component@@ -79,7 +79,7 @@ type ButtonCmp struct {state ButtonStatevariant ButtonVariantkeyMap ButtonKeyMap- payload interface{}+ payload anystyle lipgloss.StylehoverStyle lipgloss.Style}@@ -107,7 +107,7 @@ func (b *ButtonCmp) WithVariant(variant ButtonVariant) *ButtonCmp {}// WithPayload sets the payload sent with button events-func (b *ButtonCmp) WithPayload(payload interface{}) *ButtonCmp {+func (b *ButtonCmp) WithPayload(payload any) *ButtonCmp {b.payload = payloadreturn b}diff --git a/internal/tui/components/repl/messages.go b/internal/tui/components/repl/messages.goindex 2b5e599aa46..30ce4be7c9e 100644--- a/internal/tui/components/repl/messages.go+++ b/internal/tui/components/repl/messages.go@@ -5,7 +5,6 @@ import ("fmt""sort""strings"- "time""github.com/charmbracelet/bubbles/key""github.com/charmbracelet/bubbles/viewport"@@ -41,7 +40,6 @@ type messagesCmp struct {height intfocused boolcachedView string- timeLoaded time.Time}func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {@@ -424,9 +422,6 @@ func (m *messagesCmp) projectDiagnostics() string {}if len(errorDiagnostics) == 0 && len(warnDiagnostics) == 0 && len(hintDiagnostics) == 0 && len(infoDiagnostics) == 0 {- if time.Since(m.timeLoaded) < time.Second*10 {- return "Loading diagnostics..."- }return "No diagnostics"}@@ -496,7 +491,6 @@ func (m *messagesCmp) SetSize(width int, height int) {}func (m *messagesCmp) Init() tea.Cmd {- m.timeLoaded = time.Now()return nil}diff --git a/internal/tui/layout/grid.go b/internal/tui/layout/grid.goindex d6f0b4ab914..6be493e2c2f 100644--- a/internal/tui/layout/grid.go+++ b/internal/tui/layout/grid.go@@ -127,10 +127,10 @@ func (g *gridLayout) View() string {// Render each rowrows := make([]string, g.rows)- for i := 0; i < g.rows; i++ {+ for i := range g.rows {// Render each column in this rowcols := make([]string, len(g.panes[i]))- for j := 0; j < len(g.panes[i]); j++ {+ for j := range g.panes[i] {if g.panes[i][j] == nil {cols[j] = ""continuediff --git a/internal/tui/layout/overlay.go b/internal/tui/layout/overlay.goindex 87cc80e68e4..22f9e00fe05 100644--- a/internal/tui/layout/overlay.go+++ b/internal/tui/layout/overlay.go@@ -159,12 +159,7 @@ func max(a, b int) int {return b}-func min(a, b int) int {- if a < b {- return a- }- return b-}+type whitespace struct {style termenv.Style