vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

Visually de-emphasize `err != nil` checks

Open myaaaaaaaaa opened this issue 5 months ago • 7 comments

Is your feature request related to a problem? Please describe. The Go team has stopped pursuing language changes for error handling. For details, see https://go.dev/blog/error-syntax .

Instead, they have recommended tackling the error handling situation through improved tooling. A direct quote from the blog post follows:

Writing, reading, and debugging code are all quite different activities. Writing repeated error checks can be tedious, but today’s IDEs provide powerful, even LLM-assisted code completion. Writing basic error checks is straightforward for these tools. The verbosity is most obvious when reading code, but tools might help here as well; for instance an IDE with a Go language setting could provide a toggle switch to hide error handling code. Such switches already exist for other code sections such as function bodies.

Describe the solution you'd like err != nil blocks should have their opacity lowered by default, except when the mouse hovers over them or when the cursor is inside them.

See the below demonstration for details:

https://github.com/user-attachments/assets/c1351b72-544a-4405-8fea-23ea81ed229f

This avoids the typical clutter of error handling code while still providing a visual cue to developers that error handling code exists there, and also allows them to easily inspect the error handling code when needed.

myaaaaaaaaa avatar Jun 22 '25 19:06 myaaaaaaaaa