on main help sign in
small fixes
795b369Kujtim Hoxha
internal/llm/tools/edit.go+2−2
@@ -80,7 +80,7 @@ func (e *editTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
80 if err != nil {
80 if err != nil {
81 return NewTextErrorResponse(fmt.Sprintf("error creating file: %s", err)), nil
81 return NewTextErrorResponse(fmt.Sprintf("error creating file: %s", err)), nil
82 }
82 }
83− return NewTextErrorResponse(result), nil
83+ return NewTextResponse(result), nil
84 }
84 }
85
85
86 if params.NewString == "" {
86 if params.NewString == "" {
@@ -88,7 +88,7 @@ func (e *editTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
88 if err != nil {
88 if err != nil {
89 return NewTextErrorResponse(fmt.Sprintf("error deleting content: %s", err)), nil
89 return NewTextErrorResponse(fmt.Sprintf("error deleting content: %s", err)), nil
90 }
90 }
91− return NewTextErrorResponse(result), nil
91+ return NewTextResponse(result), nil
92 }
92 }
93
93
94 result, err := replaceContent(params.FilePath, params.OldString, params.NewString)
94 result, err := replaceContent(params.FilePath, params.OldString, params.NewString)
internal/lsp/util/edit.go+4−4
@@ -34,9 +34,9 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
34 lines := strings.Split(string(content), lineEnding)
34 lines := strings.Split(string(content), lineEnding)
35
35
36 // Check for overlapping edits
36 // Check for overlapping edits
37− for i := 0; i < len(edits); i++ {
37+ for i, edit1 := range edits {
38 for j := i + 1; j < len(edits); j++ {
38 for j := i + 1; j < len(edits); j++ {
39− if rangesOverlap(edits[i].Range, edits[j].Range) {
39+ if rangesOverlap(edit1.Range, edits[j].Range) {
40 return fmt.Errorf("overlapping edits detected between edit %d and %d", i, j)
40 return fmt.Errorf("overlapping edits detected between edit %d and %d", i, j)
41 }
41 }
42 }
42 }
@@ -54,7 +54,7 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
54
54
55 // Apply each edit
55 // Apply each edit
56 for _, edit := range sortedEdits {
56 for _, edit := range sortedEdits {
57− newLines, err := applyTextEdit(lines, edit, lineEnding)
57+ newLines, err := applyTextEdit(lines, edit)
58 if err != nil {
58 if err != nil {
59 return fmt.Errorf("failed to apply edit: %w", err)
59 return fmt.Errorf("failed to apply edit: %w", err)
60 }
60 }
@@ -82,7 +82,7 @@ func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
82 return nil
82 return nil
83}
83}
84
84
85−func applyTextEdit(lines []string, edit protocol.TextEdit, lineEnding string) ([]string, error) {
85+func applyTextEdit(lines []string, edit protocol.TextEdit) ([]string, error) {
86 startLine := int(edit.Range.Start.Line)
86 startLine := int(edit.Range.Start.Line)
87 endLine := int(edit.Range.End.Line)
87 endLine := int(edit.Range.End.Line)
88 startChar := int(edit.Range.Start.Character)
88 startChar := int(edit.Range.Start.Character)
internal/lsp/watcher/watcher.go+1−1
@@ -347,7 +347,7 @@ func matchesSimpleGlob(pattern, path string) bool {
347
347
348 // Otherwise, check if any path component matches
348 // Otherwise, check if any path component matches
349 pathComponents := strings.Split(path, "/")
349 pathComponents := strings.Split(path, "/")
350− for i := 0; i < len(pathComponents); i++ {
350+ for i := range pathComponents {
351 subPath := strings.Join(pathComponents[i:], "/")
351 subPath := strings.Join(pathComponents[i:], "/")
352 if strings.HasSuffix(subPath, rest) {
352 if strings.HasSuffix(subPath, rest) {
353 return true
353 return true
internal/tui/components/core/button.go+3−3
@@ -67,7 +67,7 @@ const (
67// ButtonMsg is sent when a button is clicked
67// ButtonMsg is sent when a button is clicked
68type ButtonMsg struct {
68type ButtonMsg struct {
69 ID string
69 ID string
70− Payload interface{}
70+ Payload any
71}
71}
72
72
73// ButtonCmp represents a clickable button component
73// ButtonCmp represents a clickable button component
@@ -79,7 +79,7 @@ type ButtonCmp struct {
79 state ButtonState
79 state ButtonState
80 variant ButtonVariant
80 variant ButtonVariant
81 keyMap ButtonKeyMap
81 keyMap ButtonKeyMap
82− payload interface{}
82+ payload any
83 style lipgloss.Style
83 style lipgloss.Style
84 hoverStyle lipgloss.Style
84 hoverStyle lipgloss.Style
85}
85}
@@ -107,7 +107,7 @@ func (b *ButtonCmp) WithVariant(variant ButtonVariant) *ButtonCmp {
107}
107}
108
108
109// WithPayload sets the payload sent with button events
109// WithPayload sets the payload sent with button events
110−func (b *ButtonCmp) WithPayload(payload interface{}) *ButtonCmp {
110+func (b *ButtonCmp) WithPayload(payload any) *ButtonCmp {
111 b.payload = payload
111 b.payload = payload
112 return b
112 return b
113}
113}
internal/tui/components/repl/messages.go−6
@@ -5,7 +5,6 @@ import (
5 "fmt"
5 "fmt"
6 "sort"
6 "sort"
7 "strings"
7 "strings"
8− "time"
9
8
10 "github.com/charmbracelet/bubbles/key"
9 "github.com/charmbracelet/bubbles/key"
11 "github.com/charmbracelet/bubbles/viewport"
10 "github.com/charmbracelet/bubbles/viewport"
@@ -41,7 +40,6 @@ type messagesCmp struct {
41 height int
40 height int
42 focused bool
41 focused bool
43 cachedView string
42 cachedView string
44− timeLoaded time.Time
45}
43}
46
44
47func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
45func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
@@ -424,9 +422,6 @@ func (m *messagesCmp) projectDiagnostics() string {
424 }
422 }
425
423
426 if len(errorDiagnostics) == 0 && len(warnDiagnostics) == 0 && len(hintDiagnostics) == 0 && len(infoDiagnostics) == 0 {
424 if len(errorDiagnostics) == 0 && len(warnDiagnostics) == 0 && len(hintDiagnostics) == 0 && len(infoDiagnostics) == 0 {
427− if time.Since(m.timeLoaded) < time.Second*10 {
428− return "Loading diagnostics..."
429− }
430 return "No diagnostics"
425 return "No diagnostics"
431 }
426 }
432
427
@@ -496,7 +491,6 @@ func (m *messagesCmp) SetSize(width int, height int) {
496}
491}
497
492
498func (m *messagesCmp) Init() tea.Cmd {
493func (m *messagesCmp) Init() tea.Cmd {
499− m.timeLoaded = time.Now()
500 return nil
494 return nil
501}
495}
502
496
internal/tui/layout/grid.go+2−2
@@ -127,10 +127,10 @@ func (g *gridLayout) View() string {
127
127
128 // Render each row
128 // Render each row
129 rows := make([]string, g.rows)
129 rows := make([]string, g.rows)
130− for i := 0; i < g.rows; i++ {
130+ for i := range g.rows {
131 // Render each column in this row
131 // Render each column in this row
132 cols := make([]string, len(g.panes[i]))
132 cols := make([]string, len(g.panes[i]))
133− for j := 0; j < len(g.panes[i]); j++ {
133+ for j := range g.panes[i] {
134 if g.panes[i][j] == nil {
134 if g.panes[i][j] == nil {
135 cols[j] = ""
135 cols[j] = ""
136 continue
136 continue
internal/tui/layout/overlay.go+1−6
@@ -159,12 +159,7 @@ func max(a, b int) int {
159 return b
159 return b
160}
160}
161
161
162−func min(a, b int) int {
162+
163− if a < b {
164− return a
165− }
166− return b
167−}
168
163
169type whitespace struct {
164type whitespace struct {
170 style termenv.Style
165 style termenv.Style