One thing about the output the PHP CodeSniffer is it tells you the line number where your problem exists. This feature has obvious benefits – it lets you know exactly where you need to jump to fix the problem.

Our projects, though, are usually a wide set of files with a lot of functions and thus a lot of lines of code. If you’re proficient with your IDE, then it’s a trivial task to hop to the file and the line number.

But what if you’ve migrated to a new IDE or you’re not sure of the shortcuts that exist in your current IDE? That is, maybe you know how to click to find the feature, but using shortcuts is so much faster, isn’t it?

Finding a Line Number in Coda 2

I’ve talked about how I think we should all use the IDE that we find best suited for our job. Rarely are you going to find me justifying my position a piece of software.

That said, if you’ve read this blog for any length of time then you know I use Coda 2 for my day-to-day development. I’ve shared a few tips about how to achieve certain things with it.

And if you’re using the Terminal and the PHP CodeSniffer then you need to be able to jump to line numbers to fix problems.

Finding a Line Number in Coda 2

To jump to a line number in Coda 2 without having to leave the keyboard, you can use the following shortcut:

Shift + Cmd + L

This will bring up the dialog and place the cursor’s focus in a field were you can enter the line number.

It’s quick and easy to look at the problem from the Code Sniffer and to address the problem.

A Word About Terminal

Though you can use an external instance of Terminal, I’m a fan of having it open in a split view to make these things faster.

But that’s another quick tip for another post.

 

Category:
Tips

Join the conversation! 3 Comments

  1. Thanks Tom!

    Just used this trick – faster than mousing over.

  2. Not sure about coda, but in both Sublime and Atom, “Command + Shift + P” brings up the fuzzy search so you can easily jump to files in your project. If you “add colon + line number” to the search or append it to then end of your query, it will jump you to that line.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.