Luasnip and Treesitter for Smarter Snippets

TL;DR A context-aware snippet for Go error handling code, returning the right types, with the default values. Demo Snippet Introduction Golang’s error handling is notoriously verbose. It was also the top pain point in the Go Developer Survey Q2 2022. Numerous proposals to simplify error handling have been written, but at the time of writing, none have been accepted. So we have to live with the current state of things. It’s ok, Neovim with Treesitter has a good “understanding” of code, so we can use it to generate the error handling code....

August 30, 2023 · 10 min