File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ import (
44 "fmt"
55 "path/filepath"
66 "strings"
7+ "os"
78
89 "github.com/charmbracelet/lipgloss"
910 "github.com/epilande/codegrab/internal/ui"
11+ "github.com/epilande/codegrab/internal/utils"
1012)
1113
1214func (m Model ) View () string {
@@ -227,12 +229,20 @@ func (m *Model) refreshViewportContent() {
227229 rawSuffix := ""
228230 if node .IsDir {
229231 if count := dirSelectedCounts [node .Path ]; count > 0 {
230- rawSuffix = fmt .Sprintf (" [%d]" , count )
232+ rawSuffix = fmt .Sprintf (" [%d 📄]" , count )
233+ }
234+ } else {
235+ if node .IsDependency {
236+ rawSuffix += " [dep]"
237+ }
238+ if ok , err := utils .IsTextFile (node .Path ); ok && err == nil {
239+ if contentBytes , err := os .ReadFile (node .Path ); err == nil {
240+ content := string (contentBytes )
241+ tokensEstimate := utils .EstimateTokens (content )
242+ rawSuffix += fmt .Sprintf (" [%d tokens]" , tokensEstimate )
243+ }
231244 }
232- } else if node .IsDependency {
233- rawSuffix = " [dep]"
234245 }
235-
236246 isCursorLine := i == m .cursor
237247
238248 rendered := ui .StyleFileLine (
You can’t perform that action at this time.
0 commit comments