Build Tools in Languages You Don't Know with Cursor

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet

If you have the idea of what you want to build but don't the language you need to build in, Cursor can help. This is a show-case of how I went from an empty Swift project to a fully functional window centering tool in about 15 minutes without any prior knowledge of Swift.

I described the tool I wanted Cursor to build and then followed up with the errors that were encountered until Cursor solved all these errors.

Instructor: [00:00] So as an experiment, I wanted to build a tool that would allow me to, from the command line, say layout center and center the front most window. And I wanted to do that from scratch, and so I opened up composer with no files, and I asked it to start creating code from scratch. Now as you can see, this was successful, and this

[00:20] does work across all my different displays. Based on the mouse position, it will move the front most window to the center of that screen. And the beautiful thing here is that I don't know Swift at all. I just asked it to create this tool based on how I could explain it. The rough problems I did encounter were around syntax errors. So there are quite a few times if I scroll back

[00:39] where I would run into these errors, but whenever that happened, I would literally just copy and paste it in here. I didn't even tell it to fix it. It would notice it was an error, and it would make changes. And then I'd attempt to compile it again, and I'd work through the process just kind of iterating on it. I do wish I could scroll all the way back to my original question, which I dictated in. This

[00:59] entire process was dictated and then copy and paste errors into Composer. But at some point, I hit the escape key or something which cleared the history of my conversation with Composer. All in all, this took about 15 minutes from the original prompt, a completely empty project from scratch, to a usable tool. The biggest frustration was this was working and

[01:19] centering on my primary display almost instantly, but I had to tell it quite a few times that you're not getting the secondary and third display centering logic correctly, where I essentially had to say, no. Try again. No. Try again. No. Try again. You'll see I said you still had the exact same problems last time. So that took about 5 times

[01:38] going through of telling that you have the same problem, same problem, same problem. And I tried to dictate and explain contextually how I understood the balance of the displays and the x y's and the origin of display. And the last one that finally worked was when I added a really think through this because you failed many times at this, whether that was the key to getting it to work or

[01:58] whether it was the fact that since I phrased it like that, it decided to add debug and print statements. I don't know, but after that, now it works correctly across all my displays. So from here, I can continue to have a conversation with this around building a layout tool for organizing Windows on my system.