DEV Community

Charles Clinton Pustejovsky III
Charles Clinton Pustejovsky III

Posted on

The Power of Ctrl+Click

(For JetBrain IDEs, this all works with Ctrl+B or CMD+B and it already opens in a new tab)

Ctrl+Click (CMD+Click if you're using MacOS) in VS Code is amazing. If you're working with someone else's code either because it's imported from a library or because you're working on a code base you didn't create, you'll often be lost as to what x does or how to use y.

So you'll turn to documentation or a README.md, but sometimes those are incomplete or don't provide the answer you're looking for.

Take the Go code I'm working with right now. I'm using code from github.com/dghubble/go-twitter/twitter. dghubble's README is helpful but I couldn't find all the potential parameters I can pass into the UserTimeline function. So what should I do?

What Parameters can I add to this Go code?

Simple. I ctrl click it and I'm taken to where the code lives. I can see all the types of parameters I can pass in.

type UserTimeLineParams

This will work with any code you're working with as long as it's defined somewhere else in the workplace.

Finally, to make sure you don't lose your place in your own code when ctrl clicking, follow the advice from this Stack Overflow post to make sure files always open in a new tab in VSCode.

Now you're all set. I only realized I could do this a month or so ago and my productivity has skyrocketed. Good luck!

Top comments (0)