A Small Interaction in Cursor

Published under Mango Snippets, Feb 2, 2025

A lot of us are familiar with GitHub Copilot's multi-line auto-completions. As LLM models improve, they're becoming better productivity multipliers. However, auto-completion is just one way IDEs can leverage LLMs.

I'd like to share a very small interaction I had in Cursor today.

I wrote my website's backend in Go myself. At the bottom of my blog posts, there's a page navigation section that looks like:

« Previous page ---- Page 2 ---- Next page »

I wanted to add the total number of pages:

« Previous page - Page 2 of 51 - Next page »

I originally wrote the following code with a bug (both totalPosts and numPostsPerPage are int in Go):

    data.TotalPosts = totalPosts
    data.NumPages = totalPosts / numPostsPerPage

Instead of directly fixing it, I added a leading comment: // This should be rounded up:. Cursor immediately suggested a fix.

Using comment to fix a small bug.

Cursor suggesting an edit after adding a leading comment.

This is not an auto-completion, but a suggested edit!