Detailed changes
@@ -67,8 +67,8 @@ func getDiagnostics(filePath string, manager *lsp.Manager) string {
return ""
}
- fileDiagnostics := []string{}
- projectDiagnostics := []string{}
+ var fileDiagnostics []string
+ var projectDiagnostics []string
for lspName, client := range manager.Clients().Seq2() {
for location, diags := range client.GetDiagnostics() {
@@ -163,7 +163,7 @@ func formatDiagnostic(pth string, diagnostic protocol.Diagnostic, source string)
tagsInfo := ""
if len(diagnostic.Tags) > 0 {
- tags := []string{}
+ var tags []string
for _, tag := range diagnostic.Tags {
switch tag {
case protocol.Unnecessary:
@@ -171,8 +171,8 @@ func printLogLine(lineText string) {
}
msg := data["msg"]
level := data["level"]
- otherData := []any{}
- keys := []string{}
+ var otherData []any
+ var keys []string
for k := range data {
keys = append(keys, k)
}
@@ -730,7 +730,7 @@ func resolveReadOnlyTools(tools []string) []string {
}
func filterSlice(data []string, mask []string, include bool) []string {
- filtered := []string{}
+ var filtered []string
for _, s := range data {
// if include is true, we include items that ARE in the mask
// if include is false, we include items that are NOT in the mask
@@ -95,7 +95,7 @@ func Load(workingDir, dataDir string, debug bool) (*Config, error) {
}
func PushPopCrushEnv() func() {
- found := []string{}
+ var found []string
for _, ev := range os.Environ() {
if strings.HasPrefix(ev, "CRUSH_") {
pair := strings.SplitN(ev, "=", 2)
@@ -342,12 +342,6 @@ func (c *Config) setDefaults(workingDir, dataDir string) {
if c.Options.TUI == nil {
c.Options.TUI = &TUIOptions{}
}
- if c.Options.ContextPaths == nil {
- c.Options.ContextPaths = []string{}
- }
- if c.Options.SkillsPaths == nil {
- c.Options.SkillsPaths = []string{}
- }
if dataDir != "" {
c.Options.DataDirectory = dataDir
} else if c.Options.DataDirectory == "" {
@@ -513,7 +513,7 @@ func TestConfig_setupAgentsWithEveryReadOnlyToolDisabled(t *testing.T) {
taskAgent, ok := cfg.Agents[AgentTask]
require.True(t, ok)
- assert.Equal(t, []string{}, taskAgent.AllowedTools)
+ assert.Len(t, taskAgent.AllowedTools, 0)
}
func TestConfig_configureProvidersWithDisabledProvider(t *testing.T) {
@@ -242,7 +242,7 @@ func (r *AgenticFetchToolRenderContext) RenderTool(sty *styles.Styles, width int
prompt = strings.ReplaceAll(prompt, "\n", " ")
// Build header with optional URL param.
- toolParams := []string{}
+ var toolParams []string
if params.URL != "" {
toolParams = append(toolParams, params.URL)
}
@@ -38,7 +38,7 @@ func (r *LSPRestartToolRenderContext) RenderTool(sty *styles.Styles, width int,
var params tools.LSPRestartParams
_ = json.Unmarshal([]byte(opts.ToolCall.Input), ¶ms)
- toolParams := []string{}
+ var toolParams []string
if params.Name != "" {
toolParams = append(toolParams, params.Name)
}
@@ -137,7 +137,7 @@ func Status(t *styles.Styles, opts StatusOpts, width int) string {
description = t.Base.Foreground(descriptionColor).Render(description)
}
- content := []string{}
+ var content []string
if icon != "" {
content = append(content, icon)
}
@@ -342,7 +342,7 @@ func (a *Arguments) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
if scrollbar != "" {
content = lipgloss.JoinHorizontal(lipgloss.Top, content, scrollbar)
}
- contentParts := []string{}
+ var contentParts []string
if description != "" {
contentParts = append(contentParts, description)
}
@@ -60,7 +60,7 @@ func (m *UI) lspInfo(width, maxItems int, isSection bool) string {
// lspDiagnostics formats diagnostic counts with appropriate icons and colors.
func lspDiagnostics(t *styles.Styles, diagnostics map[protocol.DiagnosticSeverity]int) string {
- errs := []string{}
+ var errs []string
if diagnostics[protocol.SeverityError] > 0 {
errs = append(errs, t.LSP.ErrorDiagnostic.Render(fmt.Sprintf("%s%d", styles.LSPErrorIcon, diagnostics[protocol.SeverityError])))
}
@@ -36,7 +36,7 @@ func (m *UI) mcpInfo(width, maxItems int, isSection bool) string {
// mcpCounts formats tool, prompt, and resource counts for display.
func mcpCounts(t *styles.Styles, counts mcp.Counts) string {
- parts := []string{}
+ var parts []string
if counts.Tools > 0 {
parts = append(parts, t.Subtle.Render(fmt.Sprintf("%d tools", counts.Tools)))
}