Skip to content

Commit 3b02540

Browse files
Copilotjakebailey
andcommitted
Fix format string bug in error creation
Use errors.New() instead of fmt.Errorf() when creating error from localized message to avoid treating the message as a format string. Co-authored-by: jakebailey <[email protected]>
1 parent d8a16fb commit 3b02540

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/ls/findallreferences.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package ls
33
import (
44
"cmp"
55
"context"
6+
"errors"
67
"fmt"
78
"slices"
89
"strings"
@@ -670,7 +671,7 @@ func (l *LanguageService) ProvideRenameFromSymbolAndEntries(ctx context.Context,
670671
// Check if ProvideSymbolsAndEntries returned ok=false or no symbols found
671672
// Return an error to inform the user that rename is not available
672673
if symbolsAndEntries == nil || len(symbolsAndEntries) == 0 {
673-
return lsproto.WorkspaceEditOrNull{}, fmt.Errorf(diagnostics.You_cannot_rename_this_element.Localize(locale.FromContext(ctx)))
674+
return lsproto.WorkspaceEditOrNull{}, errors.New(diagnostics.You_cannot_rename_this_element.Localize(locale.FromContext(ctx)))
674675
}
675676

676677
program := l.GetProgram()

0 commit comments

Comments
 (0)