-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Description
Language servers like gopls use Hints for code modernization suggestions (e.g., "use slices.Contains instead of loop"), but there's no way to see these in the Problems panel.
https://pkg.go.dev/golang.org/x/tools/gopls/internal/settings#Analyzer.Severity
says:
Importantly, Hint diagnostics do not appear in the Problems tab in VS Code, so they are less intrusive than Info diagnostics. The rule of thumb is this: use Info if the diagnostic is not a bug, but the author probably didn't mean to write the code that way. Use Hint if the diagnostic is not a bug and the author intended to write the code that way, but there is a simpler or more modern way to express the same logic. An 'unused' diagnostic is Info level, since the author probably didn't mean to check in unreachable code. A 'modernize' or 'deprecated' diagnostic is Hint level, since the author intended to write the code that way, but now there is a better way.
Those DiagnosticSeverity.Hint
don't appear in the Problems panel, and there is no way to see all of them in one place.
The only available filters are: Show Errors, Show Warnings and Show Infos
Can we add a fourth checkbox the to Show Hints, that will be unchecked by default?
That would allow users to see all code improvement suggestions project-wide.
I can see those hints per file, but it would be nice to optionally see all of them right in the problems pane
gopls check -severity=hint 53.maximum-subarray/53.maximum-subarray.go
53.maximum-subarray.go:63:6-25: for loop can be modernized using range over int