summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdictya <[email protected]>2025-05-15 08:46:40 +0530
committerAdam <[email protected]>2025-05-15 08:29:54 -0500
commit3ee213081ec6bf42f6947d03e256319c29a8ce0e (patch)
treeb5da8dc591d7b78c2a6b31eb77bdbc9ac48d223b
parent15bf40bc102ed5426fa2148b9e8f39acef1174a0 (diff)
downloadopencode-3ee213081ec6bf42f6947d03e256319c29a8ce0e.tar.gz
opencode-3ee213081ec6bf42f6947d03e256319c29a8ce0e.zip
fix(complete-module): logging
-rw-r--r--go.mod1
-rw-r--r--go.sum2
-rw-r--r--internal/completions/files-folders.go14
-rw-r--r--internal/fileutil/fileutil.go5
-rw-r--r--internal/llm/tools/glob.go3
-rw-r--r--internal/tui/components/dialog/complete.go3
6 files changed, 16 insertions, 12 deletions
diff --git a/go.mod b/go.mod
index cb9aa9933..6bc9b150a 100644
--- a/go.mod
+++ b/go.mod
@@ -19,6 +19,7 @@ require (
github.com/fsnotify/fsnotify v1.8.0
github.com/go-logfmt/logfmt v0.6.0
github.com/google/uuid v1.6.0
+ github.com/lithammer/fuzzysearch v1.1.8
github.com/lrstanley/bubblezone v0.0.0-20250315020633-c249a3fe1231
github.com/mark3labs/mcp-go v0.17.0
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6
diff --git a/go.sum b/go.sum
index b5c9d11e6..c6a79ab16 100644
--- a/go.sum
+++ b/go.sum
@@ -144,6 +144,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
+github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4=
+github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4=
github.com/lrstanley/bubblezone v0.0.0-20250315020633-c249a3fe1231 h1:9rjt7AfnrXKNSZhp36A3/4QAZAwGGCGD/p8Bse26zms=
github.com/lrstanley/bubblezone v0.0.0-20250315020633-c249a3fe1231/go.mod h1:S5etECMx+sZnW0Gm100Ma9J1PgVCTgNyFaqGu2b08b4=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
diff --git a/internal/completions/files-folders.go b/internal/completions/files-folders.go
index af1b5a874..a405b34cd 100644
--- a/internal/completions/files-folders.go
+++ b/internal/completions/files-folders.go
@@ -7,9 +7,9 @@ import (
"path/filepath"
"github.com/lithammer/fuzzysearch/fuzzy"
- "github.com/opencode-ai/opencode/internal/fileutil"
- "github.com/opencode-ai/opencode/internal/logging"
- "github.com/opencode-ai/opencode/internal/tui/components/dialog"
+ "github.com/sst/opencode/internal/fileutil"
+ "github.com/sst/opencode/internal/status"
+ "github.com/sst/opencode/internal/tui/components/dialog"
)
type filesAndFoldersContextGroup struct {
@@ -82,7 +82,7 @@ func (cg *filesAndFoldersContextGroup) getFiles(query string) ([]string, error)
errFzf := cmdFzf.Wait()
if errRg != nil {
- logging.Warn(fmt.Sprintf("rg command failed during pipe: %v", errRg))
+ status.Warn(fmt.Sprintf("rg command failed during pipe: %v", errRg))
}
if errFzf != nil {
@@ -96,7 +96,7 @@ func (cg *filesAndFoldersContextGroup) getFiles(query string) ([]string, error)
// Case 2: Only rg available
} else if cmdRg != nil {
- logging.Debug("Using Ripgrep with fuzzy match fallback for file completions")
+ status.Debug("Using Ripgrep with fuzzy match fallback for file completions")
var rgOut bytes.Buffer
var rgErr bytes.Buffer
cmdRg.Stdout = &rgOut
@@ -111,7 +111,7 @@ func (cg *filesAndFoldersContextGroup) getFiles(query string) ([]string, error)
// Case 3: Only fzf available
} else if cmdFzf != nil {
- logging.Debug("Using FZF with doublestar fallback for file completions")
+ status.Debug("Using FZF with doublestar fallback for file completions")
files, _, err := fileutil.GlobWithDoublestar("**/*", ".", 0)
if err != nil {
return nil, fmt.Errorf("failed to list files for fzf: %w", err)
@@ -147,7 +147,7 @@ func (cg *filesAndFoldersContextGroup) getFiles(query string) ([]string, error)
// Case 4: Fallback to doublestar with fuzzy match
} else {
- logging.Debug("Using doublestar with fuzzy match for file completions")
+ status.Debug("Using doublestar with fuzzy match for file completions")
allFiles, _, err := fileutil.GlobWithDoublestar("**/*", ".", 0)
if err != nil {
return nil, fmt.Errorf("failed to glob files: %w", err)
diff --git a/internal/fileutil/fileutil.go b/internal/fileutil/fileutil.go
index 4f2957835..97d0f747e 100644
--- a/internal/fileutil/fileutil.go
+++ b/internal/fileutil/fileutil.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/bmatcuk/doublestar/v4"
+ "github.com/sst/opencode/internal/status"
)
var (
@@ -22,12 +23,12 @@ func init() {
var err error
rgPath, err = exec.LookPath("rg")
if err != nil {
- // logging.("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.")
+ status.Warn("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.")
rgPath = ""
}
fzfPath, err = exec.LookPath("fzf")
if err != nil {
- // logging.Warn("FZF not found in $PATH. Some features might be limited or slower.")
+ status.Warn("FZF not found in $PATH. Some features might be limited or slower.")
fzfPath = ""
}
}
diff --git a/internal/llm/tools/glob.go b/internal/llm/tools/glob.go
index 6b6cab191..43b7bf0ba 100644
--- a/internal/llm/tools/glob.go
+++ b/internal/llm/tools/glob.go
@@ -12,6 +12,7 @@ import (
"github.com/sst/opencode/internal/config"
"github.com/sst/opencode/internal/fileutil"
+ "github.com/sst/opencode/internal/status"
)
const (
@@ -133,7 +134,7 @@ func globFiles(pattern, searchPath string, limit int) ([]string, bool, error) {
if err == nil {
return matches, len(matches) >= limit && limit > 0, nil
}
- // logging.Warn(fmt.Sprintf("Ripgrep execution failed: %v. Falling back to doublestar.", err))
+ status.Warn(fmt.Sprintf("Ripgrep execution failed: %v. Falling back to doublestar.", err))
}
return fileutil.GlobWithDoublestar(pattern, searchPath, limit)
diff --git a/internal/tui/components/dialog/complete.go b/internal/tui/components/dialog/complete.go
index 88e2c3c37..9bd70e9ca 100644
--- a/internal/tui/components/dialog/complete.go
+++ b/internal/tui/components/dialog/complete.go
@@ -153,10 +153,9 @@ func (c *completionDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
if query != c.query {
- logging.Info("Query", query)
items, err := c.completionProvider.GetChildEntries(query)
if err != nil {
- logging.Error("Failed to get child entries", err)
+ status.Error(err.Error())
}
c.listView.SetItems(items)