summaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-04-30 15:23:19 -0500
committeradamdottv <[email protected]>2025-04-30 15:23:19 -0500
commit7bc542abff85d18112b3e61556659a496d6dc668 (patch)
tree6a66c8c8f6d56bc282f22de4b6d598f7e64fc3aa /internal
parented50c3678999e6b0e42bd14367b79e4348db29cf (diff)
downloadopencode-7bc542abff85d18112b3e61556659a496d6dc668.tar.gz
opencode-7bc542abff85d18112b3e61556659a496d6dc668.zip
fix: better diagnostics visual
Diffstat (limited to 'internal')
-rw-r--r--internal/tui/components/core/status.go66
-rw-r--r--internal/tui/styles/icons.go12
2 files changed, 35 insertions, 43 deletions
diff --git a/internal/tui/components/core/status.go b/internal/tui/components/core/status.go
index 75cb9571d..ca02265e1 100644
--- a/internal/tui/components/core/status.go
+++ b/internal/tui/components/core/status.go
@@ -128,9 +128,8 @@ func (m statusCmp) View() string {
status += tokensStyle
}
- diagnostics := styles.Padded().
- Background(t.BackgroundDarker()).
- Render(m.projectDiagnostics())
+ diagnostics :=
+ styles.Padded().Background(t.BackgroundDarker()).Render(m.projectDiagnostics())
model := m.model()
@@ -190,7 +189,6 @@ func (m *statusCmp) projectDiagnostics() string {
// If any server is initializing, show that status
if initializing {
return lipgloss.NewStyle().
- Background(t.BackgroundDarker()).
Foreground(t.Warning()).
Render(fmt.Sprintf("%s Initializing LSP...", styles.SpinnerIcon))
}
@@ -216,40 +214,36 @@ func (m *statusCmp) projectDiagnostics() string {
}
}
- if len(errorDiagnostics) == 0 &&
- len(warnDiagnostics) == 0 &&
- len(hintDiagnostics) == 0 &&
- len(infoDiagnostics) == 0 {
- return "No diagnostics"
- }
-
diagnostics := []string{}
- if len(errorDiagnostics) > 0 {
- errStr := lipgloss.NewStyle().
- Foreground(t.Error()).
- Render(fmt.Sprintf("%s %d", styles.ErrorIcon, len(errorDiagnostics)))
- diagnostics = append(diagnostics, errStr)
- }
- if len(warnDiagnostics) > 0 {
- warnStr := lipgloss.NewStyle().
- Foreground(t.Warning()).
- Render(fmt.Sprintf("%s %d", styles.WarningIcon, len(warnDiagnostics)))
- diagnostics = append(diagnostics, warnStr)
- }
- if len(hintDiagnostics) > 0 {
- hintStr := lipgloss.NewStyle().
- Foreground(t.Text()).
- Render(fmt.Sprintf("%s %d", styles.HintIcon, len(hintDiagnostics)))
- diagnostics = append(diagnostics, hintStr)
- }
- if len(infoDiagnostics) > 0 {
- infoStr := lipgloss.NewStyle().
- Foreground(t.Info()).
- Render(fmt.Sprintf("%s %d", styles.InfoIcon, len(infoDiagnostics)))
- diagnostics = append(diagnostics, infoStr)
- }
- return strings.Join(diagnostics, " ")
+ errStr := lipgloss.NewStyle().
+ Background(t.BackgroundDarker()).
+ Foreground(t.Error()).
+ Render(fmt.Sprintf("%s %d", styles.ErrorIcon, len(errorDiagnostics)))
+ diagnostics = append(diagnostics, errStr)
+
+ warnStr := lipgloss.NewStyle().
+ Background(t.BackgroundDarker()).
+ Foreground(t.Warning()).
+ Render(fmt.Sprintf("%s %d", styles.WarningIcon, len(warnDiagnostics)))
+ diagnostics = append(diagnostics, warnStr)
+
+ infoStr := lipgloss.NewStyle().
+ Background(t.BackgroundDarker()).
+ Foreground(t.Info()).
+ Render(fmt.Sprintf("%s %d", styles.InfoIcon, len(infoDiagnostics)))
+ diagnostics = append(diagnostics, infoStr)
+
+ hintStr := lipgloss.NewStyle().
+ Background(t.BackgroundDarker()).
+ Foreground(t.Text()).
+ Render(fmt.Sprintf("%s %d", styles.HintIcon, len(hintDiagnostics)))
+ diagnostics = append(diagnostics, hintStr)
+
+ return styles.ForceReplaceBackgroundWithLipgloss(
+ strings.Join(diagnostics, " "),
+ t.BackgroundDarker(),
+ )
}
func (m statusCmp) model() string {
diff --git a/internal/tui/styles/icons.go b/internal/tui/styles/icons.go
index 9ed9624d4..e71080275 100644
--- a/internal/tui/styles/icons.go
+++ b/internal/tui/styles/icons.go
@@ -3,11 +3,9 @@ package styles
const (
OpenCodeIcon string = "⌬"
- CheckIcon string = "✓"
- ErrorIcon string = "✖"
- WarningIcon string = "⚠"
- InfoIcon string = "ℹ"
- HintIcon string = "➤"
- SpinnerIcon string = "..."
- LoadingIcon string = "⟳"
+ ErrorIcon string = "ⓧ"
+ WarningIcon string = "ⓦ"
+ InfoIcon string = "ⓘ"
+ HintIcon string = "ⓗ"
+ SpinnerIcon string = "⟳"
)